Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

medialibrary-development

Skill by spatie

Guides Laravel developers through spatie/laravel-medialibrary. It covers attaching files to Eloquent models, defining collections and conversions, generating responsive images, and retrieving media URLs and paths.

  • Score 90
  • 6.2k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install medialibrary-development

Built from the published package, never by AI.

git clone --depth 1 https://github.com/spatie/laravel-medialibrary /tmp/laravel-medialibrary && mkdir -p ~/.claude/skills && cp -r /tmp/laravel-medialibrary/resources/boost/skills/medialibrary-development ~/.claude/skills/medialibrary-development

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install medialibrary-development in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

This skill gives an AI assistant the patterns for working with spatie/laravel-medialibrary in Laravel. It explains how to make a model implement HasMedia and use the InteractsWithMedia trait, then add files from an upload, a URL, or a request with toMediaCollection(). It also shows how to define media collections, including single-file collections and per-collection disks, and how to register conversions such as a fitted thumbnail.

The skill also covers retrieving media with getFirstMediaUrl() and getMedia(), and lists common mistakes, such as calling addMedia() without toMediaCollection() or using env() for disk configuration. It points to a bundled reference guide for deeper detail. It is aimed at Laravel developers who handle file uploads, attachments, or image processing tied to Eloquent models.

Written from the project's SKILL.md and checked against it.

What it can do

  • Model setupShows how to implement HasMedia and use the InteractsWithMedia trait on an Eloquent model.
  • Adding mediaCovers adding files with addMedia, addMediaFromUrl, and addMediaFromRequest, finished with toMediaCollection.
  • Defining collectionsShows registering media collections, including singleFile and a custom disk such as s3.
  • Defining conversionsShows registering conversions with fit settings and nonQueued processing in registerMediaConversions.
  • Retrieving mediaShows getFirstMediaUrl, conversion URLs, and getMedia to fetch attached files.
  • Responsive imagesCovers generating responsive images, as stated in the skill description.

What you need

  • Laravel application
  • spatie/laravel-medialibrary package
  • Published medialibrary migrations run before migrating

Try asking

  • Add a media collection named avatar that holds a single file on my User model
  • Create a thumb conversion at 300x300 for my BlogPost images
  • Show me how to get the URL of the first image attached to a post

Good to know

  • Out of scope: general file storage that is not associated with Eloquent models
  • Out of scope: non-Laravel frameworks
  • Conversions marked nonQueued run synchronously
  • Detailed patterns are in a separate reference guide that the skill reads

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: resources/boost/skills/medialibrary-development/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • SKILL.md3 KB
  • references/medialibrary-guide.md14 KB

Alternatives to medialibrary-development

All alternatives →

Compare with obsidian-clipper-template-creator, harness-creator or xberg-extracting-with-ocr

medialibrary-development: common questions

What does spatie medialibrary skill do for Laravel?

It helps an assistant attach files to Eloquent models and manage collections, conversions, and media URLs or paths. The source frames it for Laravel only.

Which trait and interface are needed on a model?

The model must implement the HasMedia interface and use the InteractsWithMedia trait. The source states both are required together.

Why is toMediaCollection required when adding media?

The source says media is not saved if addMedia() is called without toMediaCollection(). It is the step that finalizes the upload.

How do I install medialibrary-development?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is medialibrary-development free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is medialibrary-development safe to use?

It scores 90 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to medialibrary-development?

Similar skills: obsidian-clipper-template-creator, harness-creator, xberg-extracting-with-ocr, file-edit-in-place.

medialibrary-development Install

Add to stack

Loading.