laravel-standards
Use when building or reviewing a Laravel 11/12 app in a touchstone repo — structure, Eloquent, Form Requests, API Resources, queues, frontend, testing. Triggers on `laravel/framework` in composer.json, `artisan`, `app/Http/`, `routes/web.php|api.php`, `*FormRequest`/`JsonResource`. PHP-language rules live in the php skill; this is the framework layer.
- License 许可
- MIT
- 最近更新
- 2026-08-26
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- laravel-standards
- license
- MIT
- metadata
- { "author": "touchstone", "version": "0.2.0" }
- description
- Use when building or reviewing a Laravel 11/12 app in a touchstone repo — structure, Eloquent, Form Requests, API Resources, queues, frontend, testing. Triggers on `laravel/framework` in composer.json, `artisan`, `app/Http/`, `routes/web.php|api.php`, `*FormRequest`/`JsonResource`. PHP-language rules live in the php skill; this is the framework layer.
03 SKILL.md 正文
Laravel (framework)
Full standard: standards/frameworks/laravel.md (layers on standards/languages/php.md). Rules:
Always
- Thin controllers (prefer single-action
__invoke); business logic inapp/Services/app/Actions; avoid fat models (casts/relations/scopes only). Configure inbootstrap/app.php— no resurrected kernels. - Validate at the boundary in a Form Request with a real
authorize(); hand actions$request->validated(), never$request->all(). - Eloquent hygiene: guard mass assignment (
$fillableallowlist, neverunguard()); eager-load to kill N+1 and enablepreventLazyLoading/shouldBeStrictin non-prod; reviewed migrations, backfills as separate jobs; shortDB::transaction. - APIs through
JsonResource(never raw models); auth via Sanctum (Passport only for OAuth2); Policies deny-by-default. - Queued jobs for out-of-request work — idempotent,
ShouldBeUnique/retries/failed(), dispatchedafterCommit; Horizon for Redis. env()only insideconfig/; secrets out of source;config:cache/route:cachein prod; Pint + Larastan + Pest gate CI.
Defer (don't duplicate)
- Schema/migrations/expand-contract →
../../standards/platform/database.md; API contract/errors →../../standards/design/api-design.md; authN/authZ/OWASP →../../standards/practices/app-security.md; job retries/idempotency →../../standards/design/resilience.md; PHP language/static-analysis baseline →../../standards/languages/php.md; test strategy →../../standards/practices/testing-strategy.md.
Done
thin controllers + service/action layer · Form Request validation with authorize() · mass assignment guarded + N+1 killed · JsonResource APIs, Sanctum, deny-by-default Policies · idempotent queued jobs afterCommit · config cached, no secrets in source · Pest on a real DB · Pint/Larastan/Pest gate CI. See standards/frameworks/laravel.md.
04 同仓库更多 Skills
ok-standards
Use when writing shell, per standards/languages/shell.md.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.