dripdropz/onchain-voting/medialibrary-development
Claude Code and agent skill by dripdropz/onchain-voting
- community
Checking that the SKILL.md file is still in the repository.
Build and work with spatie/laravel-medialibrary features including associating files with Eloquent models, defining media collections and conversions, generating responsive images, and retrieving media URLs and paths.
Install
npx vskill@latest install dripdropz/onchain-voting/medialibrary-developmentSKILL.md
The same SKILL.md was published earlier as gencau/test-practices-agent-configurations/medialibrary-development.
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.
Core Concepts
Model Setup
Every model that should have media must implement HasMedia and use the InteractsWithMedia trait:
Adding Media
Defining Collections
Defining Conversions
Retrieving Media
Do and Don't
Do:
- Always implement the
HasMediainterface alongside theInteractsWithMediatrait. - Use
?Media $media = nullas the parameter forregisterMediaConversions(). - Call
->toMediaCollection()to finalize adding media. - Use
->nonQueued()for conversions that should run synchronously. - Use
->singleFile()on collections that should only hold one file. - Use
Spatie\Image\Enums\Fitenum values for fit methods.
Don't:
- Don't forget to run
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-migrations"before migrating. - Don't use
env()for disk configuration; useconfig()or set it inconfig/media-library.php. - Don't call
addMedia()without callingtoMediaCollection()— the media won't be saved. - Don't reference conversion names that aren't registered in
registerMediaConversions().
References
references/medialibrary-guide.md
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingapplication/.cursor/skills/medialibrary-development/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dripdropz/onchain-voting/medialibrary-development)