diff --git a/.agents/skills/project-request-validation-style/SKILL.md b/.agents/skills/project-request-validation-style/SKILL.md new file mode 100644 index 0000000..69747cb --- /dev/null +++ b/.agents/skills/project-request-validation-style/SKILL.md @@ -0,0 +1,28 @@ +--- +name: project-request-validation-style +description: "Always apply in this project when changing Laravel controllers or FormRequest classes. Enforces dedicated FormRequest usage for controller validation, validated-array access via Arr::get(), and forbids custom single-field getter methods or request helper extraction like boolean()/integer()/string() for app input handling." +--- + +# Project Request Validation Style + +## When to Apply + +Activate this skill whenever work in this project changes: + +- Laravel controllers +- Laravel FormRequest classes +- Validation flow between controllers and requests + +## Rules + +- Do not add inline controller validation with `$request->validate(...)` when the endpoint has request-specific validation needs. +- Prefer dedicated `FormRequest` classes and use `$validated = $request->validated();` in controllers. +- When reading validated arrays, use `Arr::get($validated, 'key')` instead of direct array access. +- Do not use request helper extraction like `$request->boolean()`, `$request->integer()`, `$request->string()`, or similar helpers for application input handling. +- Do not add custom FormRequest getter helpers such as `points()`, `branchName()`, `ticketAttributes()`, or similar single-purpose accessors. +- Build controller payloads from the validated array directly with `Arr::get(...)`. + +## Notes + +- `Arr::get(...)` already returns `null` by default, so do not wrap it in redundant existence checks when `null` is acceptable. +- Keep validation logic in the FormRequest and payload shaping in the controller or dedicated action. diff --git a/AGENTS.md b/AGENTS.md index 884e1c5..8d2c268 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -37,6 +37,7 @@ This project has domain-specific skills available. You MUST activate the relevan - `inertia-vue-development` — Develops Inertia.js v2 Vue client-side applications. Activates when creating Vue pages, forms, or navigation; using ,