/fuse-laravel:laravel-jsonapifrom fuse-laravel
Builds JSON:API v1.1-compliant endpoints in Laravel 13 using the first-party JsonApiResource base class. Covers attributes, relationships, sparse fieldsets, inclusion, resource identifiers, and content-type handling.
Ships in fuse-laravel. 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.
Read when SKILL.md points to them.
Before ANY implementation, spawn 3 agents in parallel, one Agent call each with a name:
JsonResource classes to migratelaravel.com/docs/13.x/eloquent-resources examplesAfter implementation, run fuse-ai-pilot:sniper for validation.
| Feature | Description |
|---|---|
JsonApiResource | Base class extending JsonResource with spec compliance |
| Content-Type | Auto-sets application/vnd.api+json |
| Sparse fieldsets | ?fields[posts]=title,created_at |
| Inclusion | ?include=author,comments with included array |
| Resource identifiers | {"id":"1","type":"posts"} in relationships |
| Links / meta | toLinks() / toMeta() overrides |
JsonApiResource - Never roll your own JSON:API serializer; the base class handles spec edge casesPostResource → posts) - override toType() only when it must differ$attributes / toAttributes() not toArray() - JSON:API splits attributes from identifiers; mixing them breaks compliance$relationships (or toRelationships()) with only the relations clients may includeAccept: application/vnd.api+jsonapp/Http/Resources/
├── PostResource.php # extends JsonApiResource → type "posts"
├── UserResource.php # extends JsonApiResource → type "users"
└── CommentResource.php # extends JsonApiResource → type "comments"
app/Http/Controllers/
└── Api/PostController.php # returns PostResource::collection($posts)
→ See PostResource.php.md for full example
| Topic | Reference | When to Consult |
|---|---|---|
| Base resource class | resources.md | Structuring JsonApiResource subclasses |
| Sparse fieldsets | sparse-fieldsets.md | Implementing fields[type]=a,b |
| Relationships | relationships.md | Inclusion + identifiers + links |
| Template | When to Use |
|---|---|
| PostResource.php.md | Resource with belongsTo + hasMany |
| UserResource.php.md | Simple resource with sparse fields |
// php artisan make:resource PostResource --json-api
use Illuminate\Http\Resources\JsonApi\JsonApiResource;
class PostResource extends JsonApiResource
{
public $attributes = ['title', 'body'];
public $relationships = ['author', 'comments'];
}
return PostResource::collection(Post::with('author')->get());
→ See PostResource.php.md for complete example
include to avoid N+1 (?include=author → with('author'))include and fields parameters in your OpenAPI spectoType() only when the derived type must differ from the class name (e.g. AuthorResource wrapping User)toLinks() to expose self / related linksJsonApiResource base class - manual JSON breaks subtle spec rules (e.g., null vs empty data)$relationships / toRelationships() - silent ignoring keeps APIs predictabletoArray() and toAttributes() - the JSON:API base class expects the latterWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
23 skills in this plugin
/fusecoreUse when creating modules, understanding FuseCore structure, or implementing features in a FuseCore modular-monolith Laravel project./laravel-ai-sdkUse when integrating AI agents, tool calling, embeddings, structured output, or streaming in Laravel 13 via the `laravel/ai` package./laravel-apiUse when creating API endpoints, transforming responses with API Resources, or handling API authentication, rate limiting, or versioning.npx claudepluginhub fusengine/claude-plugins --plugin fuse-laravelOther plugins' skills for the same job