medialibrary-development
Installation
SKILL.md
Media Library Development
Overview
Use spatie/laravel-medialibrary to associate files with Eloquent models. Supports image/video conversions, responsive images, multiple collections, and various storage disks.
When to Activate
- Activate when working with file uploads, media attachments, or image processing in Laravel.
- Activate when code references
HasMedia,InteractsWithMedia, theMediamodel, or media collections/conversions. - Activate when the user wants to add, retrieve, convert, or manage files attached to Eloquent models.
Scope
- In scope: media uploads, collections, conversions, responsive images, custom properties, file retrieval, path/URL generation.
- Out of scope: general file storage without Eloquent association, non-Laravel frameworks.
Workflow
- Identify the task (model setup, adding media, defining conversions, retrieving files, etc.).
- Read
references/medialibrary-guide.mdand focus on the relevant section. - Apply the patterns from the reference, keeping code minimal and Laravel-native.