/laravel-skill:laravel-rest-apifrom laravel-skill
REST API and HTTP-edge rules for Laravel covering authorization, validation, route model binding, JSON resources, thin controllers, domain exception mapping, and outbound HTTP client calls with timeouts and retries.
Ships in laravel-skill. 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.
Rules for the edge of a Laravel application, inbound and outbound: 37 rules across 7 sections.
The edge has one job — translate HTTP into domain types and back. Illuminate\Http\Request stops at the controller or Form Request; nothing inward ever sees it. See the laravel-patterns skill for what happens after that.
authorize() and a controller Gate::authorize() on the same route.where() with paginate(), and including relations read off $request->user().#[\SensitiveParameter]./conversations/{conversation}/messages/{message})| About to write | Read |
|---|---|
| Any new endpoint | authz-exactly-one-authorization-site, controller-thin-delegates-to-action |
| Validation for a payload | request-validation-in-form-requests, request-to-dto |
| An ownership or tenancy check | authz-policies-per-model, authz-never-trust-request-ids |
| An endpoint that lists records | controller-no-query-construction |
| A nested resource URL | route-scoped-bindings-for-nested-resources, route-shallow-nesting |
| A JSON response | resource-json-resource-only, resource-when-loaded-for-relations |
A throw | error-context-specific-exception-classes, error-map-status-centrally |
| A function taking a password, token or key | error-sensitive-parameter-attribute |
| A route file entry | route-model-binding-over-manual-lookup, route-cacheable-controller-routes |
| A call to a third-party API | client-explicit-timeouts, client-handle-status-explicitly |
| A URL that came from a request | client-reject-user-supplied-urls |
| A POST a client may retry | controller-idempotency-key-on-unsafe-writes |
| A call that fails intermittently | client-retry-with-backoff |
| Several independent API calls | client-pool-concurrent-requests |
^12.0 || ^13.0 and PHP ^8.3. If you need something these rules do not name, check the docs — never infer an API from its name.composer.json first; on Laravel 12 use the fallback the rule gives.rules/{slug}.md before adapting it to a case the example does not show.| # | Section | Impact | Prefix |
|---|---|---|---|
| 1 | Authorization | CRITICAL | authz- |
| 2 | Form Requests and Validation | HIGH | request- |
| 3 | Routing and Model Binding | HIGH | route- |
| 4 | API Serialization | HIGH | resource- |
| 5 | Errors and Exceptions | MEDIUM-HIGH | error- |
| 6 | Controllers | MEDIUM-HIGH | controller- |
| 7 | Outbound HTTP | MEDIUM-HIGH | client- |
authz-check-before-the-domain-runs — Authorize at the edge, before the Action executesauthz-exactly-one-authorization-site — One authorization site per route, never twoauthz-policies-per-model — Put the rule in a Policy, not in a conditionalauthz-never-trust-request-ids — An ID in a request is a claim, not a factrequest-validation-in-form-requests — Validation lives in a Form Requestrequest-authorize-in-form-request — Put the authorization decision in authorize()request-to-dto — Convert the validated payload into a DTOrequest-prepare-for-validation-normalizes — Normalize input before the rules runrequest-array-rules-per-item — Validate array items, not just the arrayrequest-never-pass-request-inward — The Request stops at the controllerroute-model-binding-over-manual-lookup — Bind models instead of looking them uproute-scoped-bindings-for-nested-resources — Scope nested bindings to their parentroute-parameter-matches-model — Name the parameter after the bound modelroute-consistent-prefixes-no-double-nesting — Keep prefixes and paths consistentroute-shallow-nesting — Nest only as deep as the parent is neededroute-missing-callback — Handle a missing bound model deliberatelyroute-cacheable-controller-routes — No closure routes, so route:cache worksresource-json-resource-only — Serialize through a Resource, never a raw Modelresource-when-loaded-for-relations — Guard relations with whenLoaded()resource-live-in-domain — Resources live with their domainresource-stable-payload-shape — Explicit wire types, stable keysresource-jsonapi-when-the-spec-applies — First-party JSON:API resources (Laravel 13)error-context-specific-exception-classes — Never throw a bare Exceptionerror-named-constructors — A named constructor per failure modeerror-map-status-centrally — Map exceptions to status once, in the handlererror-never-leak-internals — Log the detail, return a stable messageerror-sensitive-parameter-attribute — Mark secret parameters #[\SensitiveParameter]controller-thin-delegates-to-action — Map HTTP, delegate, shape the responsecontroller-invokable-single-action — Prefer single-action invokable controllerscontroller-no-query-construction — A controller constructs no queriescontroller-attributes-for-middleware-and-authorization — #[Middleware] / #[Authorize] (Laravel 13)controller-idempotency-key-on-unsafe-writes — A client retry must not create a second recordclient-explicit-timeouts — A timeout and a connect timeout on every callclient-retry-with-backoff — Retry transient failures only, with increasing delaysclient-handle-status-explicitly — Throw, or handle the status; never parse an error bodyclient-pool-concurrent-requests — Pool independent calls instead of waiting three timesclient-reject-user-supplied-urls — Never fetch an address the client chose| Feature | Availability |
|---|---|
#[Middleware], #[Authorize] on controllers | Laravel 13+ |
| First-party JSON:API resources | Laravel 13+ |
PreventRequestForgery (origin-aware CSRF) | Laravel 13+ |
->scopeBindings(), ->missing() | Laravel 9+ |
#[\SensitiveParameter] | PHP 8.2+ |
bootstrap/app.php exception configuration | Laravel 11+ |
references/request-lifecycle-boundaries.md — what each edge layer may and may not doreferences/nested-routing-recipes.md — worked nested-resource route definitionsreferences/checklist.md — pre-merge self-check for the HTTP layerLoad in this order and stop when the answer is clear:
rules/route-scoped-bindings-for-nested-resources.md
rules/resource-when-loaded-for-relations.md
references/ file only when a rule points at one.AGENTS.md is every rule compiled into one document (~12k tokens), for agents that read the AGENTS.md convention. Do not load it when the individual rule files are reachable.
laravel-engineering — read callers and configuration before changing a boundarylaravel-patterns — where the logic goes once the request is translatedlaravel-eloquent — pagination, eager loading and query rules behind the Repositorylaravel-async — dispatching work from a request without blocking the responselaravel-testing — feature tests, authorization tests and query-count assertionsAGENTS.md (opens in a new tab)README.md (opens in a new tab)metadata.json (opens in a new tab)references/checklist.md (opens in a new tab)references/nested-routing-recipes.md (opens in a new tab)references/request-lifecycle-boundaries.md (opens in a new tab)rules/_sections.md (opens in a new tab)rules/_template.md (opens in a new tab)rules/authz-check-before-the-domain-runs.md (opens in a new tab)rules/authz-exactly-one-authorization-site.md (opens in a new tab)rules/authz-never-trust-request-ids.md (opens in a new tab)rules/authz-policies-per-model.md (opens in a new tab)rules/client-explicit-timeouts.md (opens in a new tab)rules/client-handle-status-explicitly.md (opens in a new tab)rules/client-pool-concurrent-requests.md (opens in a new tab)rules/client-reject-user-supplied-urls.md (opens in a new tab)rules/client-retry-with-backoff.md (opens in a new tab)rules/controller-attributes-for-middleware-and-authorization.md (opens in a new tab)rules/controller-idempotency-key-on-unsafe-writes.md (opens in a new tab)rules/controller-invokable-single-action.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
6 skills in this plugin
/laravel-asyncAsynchronous and caching rules for Laravel — idempotent queued jobs with retries and backoff, domain events for side effects, queue separation and failure handling, deterministic cache keys with event-driven invalidation, and scheduled tasks that queue rather than block. Use when writing or reviewing jobs, events, listeners, queue configuration, caching or scheduled tasks, or when work is duplicated, lost, or blocking a request./laravel-eloquentEloquent and query-layer engineering rules for Laravel — eliminating N+1, choosing a pagination strategy, short atomic transactions, casts and scopes on the model, where raw SQL is allowed, and how migrations declare the schema those queries depend on. Use when writing or reviewing Eloquent models, migrations, query classes, repositories, exports or reporting queries, or when a Laravel endpoint is slow, leaking memory, or returning wrongly-typed columns./laravel-engineeringnpx claudepluginhub foysal50x/skills --plugin laravel-skillOther plugins' skills for the same job