/laraclaude:lc:laracrate-collection [collection-name]from laraclaude
Adds or edits a Laracrate file collection in config/laracrate.php with disk, access, types, variants, and per-model scoping. Useful for configuring file uploads per model.
Ships in laraclaude. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Add a new Laracrate collection (or edit an existing one) in the app's config/laracrate.php, generating a correct config block and wiring its dependencies (disk, embeddings, usage tracking, policies).
A "collection" is the per-context grouping a file belongs to (avatar, documents, lawsuit-document...). It decides the disk, the access mode, the accepted types, the variants/previews to derive, whether text extraction and embeddings run, and per-model scoping. The anatomy has many keys with non-obvious rules, so this skill encodes them.
| Subcommand | Description |
|---|---|
| (no argument) | Prompt for the collection name and its options, then add it. |
[collection-name] | Add (or edit, if it already exists) the named collection. |
This is a generator skill: it edits config/laracrate.php. Always confirm the final block with the user before writing if anything was assumed.
Grep to check edulazaro/laracrate in composer.json.Laracrate is not installed. Install it with:
composer require edulazaro/laracrate
php artisan vendor:publish --tag=laracrate-config
Read on config/laracrate.php.php artisan vendor:publish --tag=laracrate-config
then read it.vendor/. Only the app's config/laracrate.php.From config/laracrate.php, note:
collections array and its formatting (indentation, trailing commas) so the new block matches.defaults per type (image, document, audio, video): accepted mime types, max sizes, default variants. A collection inherits these and only overrides what it declares.embeddings, chunks, watermark, and placeholders blocks (you may need to touch them for dependent wiring in Step 5).morphMap / Relation::enforceMorphMap is used in the app (affects the models block keys).If not obvious from the argument or the conversation, ask only for what you need. Defaults in parentheses:
avatar, documents).Storage::disk() name from config/filesystems.php. There is no default; a missing disk is an intentional error in Laracrate.public (CDN-direct URL), signed (temporary signed URL), or stream (controller with audit and per-request viewer binding). Default public.image, document, audio, video. Default: infer from intent (an "avatar"/"gallery" is image, "documents" is document).width/height, optional fit to crop square, format, watermark).preview (document: page, width, engine, nested variants; video: frame_at, nested variants).single (one file per owner, replacing), sensitive (bind URL to viewer), encrypt (encrypt at rest, requires server-side upload), ttl_hours (auto-purge), quota_bytes, track_usage (live counters), component (default blade), placeholder.extract (extract text) and embed (generate embeddings + index in the ChunkStore). Each is a bool or an array of types (['document','image']) or extras (['video.visual']).models block (keyed by morph alias).Compose the block from the gathered options, following these rules exactly:
variants live INSIDE types (types.image.variants), never at the top level of the collection.preview lives inside types.document / types.video; its own derivatives go in preview.variants.defaults. The merge is recursive; lists (variants, accepted_mime_types, accepted_extensions) replace wholesale when declared.access must be exactly public, signed, or stream.path key. The object key is always {fileable_morph}/{id}/{collection}/{file} (tenant-prefixed when the file has a tenant), built by CreateFileAction. Do not invent a path/template key, it is ignored.extract/embed are the canonical keys. extract_text is only a legacy boolean alias, prefer extract. Array form filters by file type.watermark is opt-in per variant: 'display' => ['width' => 1200, 'watermark' => true]. The original is never watermarked. The watermark image/text come from the top-level watermark config block.placeholder can be a string or a callable (collection, type, model). If callable, use a callable array [App\Support\InitialsAvatar::class, 'placeholderFor'], NOT a Closure (Closures break php artisan config:cache).models block restricts the collection to the listed morph aliases and merges a per-model override (array_replace_recursive). Any model not listed throws CollectionNotAllowedForModel. Omit it for a flat, all-models collection.Reference anatomy:
| Key | Type | Purpose |
|---|---|---|
disk | string | Storage disk (required, no default). |
access | string | public / signed / stream. |
single | bool | One file per owner; replacing force-deletes the previous. |
sensitive | bool | Bind access to the authenticated viewer, re-validate each request. |
encrypt | bool | Encrypt the binary at rest (needs server-side upload, not presigned). |
ttl_hours | int | Auto-purge via laracrate:purge-expired. |
quota_bytes | int | Limit the app checks via UsageReporter (not enforced by the package). |
track_usage | bool | Maintain live counters in laracrate_folderables. |
component | string | Default blade component for rendering. |
placeholder | string|callable | Fallback when the file is missing. |
types | array | Per-type config keyed by image/document/audio/video. |
extract | bool|array | Extract text (extract_text is a legacy alias). |
embed | bool|array | Generate embeddings and index in the ChunkStore. |
actions | array | Custom pipeline steps (FileActionInterface classes) for this collection. |
models | array | Per-morph scoping and overrides. |
Examples to mirror:
// Public single avatar with cropped square variants and an initials fallback.
'avatar' => [
'disk' => 'media',
'access' => 'public',
'single' => true,
'placeholder' => [\App\Support\InitialsAvatar::class, 'placeholderFor'],
'types' => [
'image' => [
'variants' => [
'small' => ['width' => 64, 'height' => 64, 'fit' => true],
'medium' => ['width' => 128, 'height' => 128, 'fit' => true],
],
],
],
],
// Signed PDFs with first-page preview, text extraction and embeddings (RAG).
'documents' => [
'disk' => 'documents',
'access' => 'signed',
'extract' => true,
'embed' => true,
'types' => [
'document' => [
'preview' => ['page' => 1, 'width' => 2000, 'variants' => [
'thumbnail' => ['width' => 300],
'medium' => ['width' => 800],
]],
],
],
],
// Sensitive, streamed, encrypted IDs with a watermarked display variant.
'identity' => [
'disk' => 'documents',
'access' => 'stream',
'sensitive' => true,
'encrypt' => true,
'types' => [
'image' => ['variants' => ['display' => ['width' => 1200, 'watermark' => true]]],
'document' => ['preview' => ['page' => 1, 'width' => 2000]],
],
],
Edit to add the block inside the collections array in config/laracrate.php, matching the file's existing indentation and trailing-comma style. If the collection already exists, update it in place.disk exists in config/filesystems.php. If not, add an s3 (R2/S3) or local disk, or tell the user to add it. Laracrate intentionally errors on a missing disk.extract/embed: these only run if embeddings.enabled is true. Confirm a provider (OpenAiEmbeddingProvider needs LARACRATE_EMBEDDINGS_API_KEY) and the chunks.driver (mysql or meilisearch). Point the user to the env keys.track_usage: counters live in laracrate_folderables and are rebuilt with php artisan laracrate:recompute-usage.access: stream or sensitive: authorization comes from PolicyRegistry. Remind the user to register viewable/editable/deletable for the owner morph in a service provider.placeholder callable: must be a callable array, not a Closure (see Step 4).php -l config/laracrate.php (Docker-aware: detect the container from docker-compose.yml/compose.yaml).php artisan config:clear so the new collection is picked up.variants are nested under types.After a successful add, show how to use it from a model:
// The owner model needs the HasFiles trait.
$model->addFile($request->file('upload'), '{collection}');
$model->setFile('{collection}', $upload); // single collections
$url = $model->fileLink('{collection}', 'medium');
config/laracrate.php, never the copy under vendor/.variants belong inside types, preview inside types.document/types.video. This is the most common mistake.path key: the object key layout is fixed and not configurable.extract/embed need embeddings.enabled => true to actually run.filesystems.php.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub edulazaro/laraclaude --plugin laraclaude32 skills in this plugin
/lc:analyze-errorPaste a Laravel stacktrace and get root cause analysis with suggested fix./lc:analyze-modelDeep analysis of a Laravel Eloquent model - relationships, scopes, casts, fillable, observers, keepers, actions./lc:api-docsGenerate API documentation from routes, controllers, and form requests./lc:blade-auditDetect hardcoded text without @text(), duplicate CSS classes, unused Blade components, and accessibility issues./lc:boost-inspectRuntime-verified Laravel inspection using the Laravel Boost MCP server (Tinker, Database Query/Schema, Last Error) instead of static grep. Falls back to Docker/Tinker if Boost is not installed./lc:cache-opportunitiesDetect repeated queries and computations that should be cached.Other plugins' skills for the same job