laravel:form-requests
Move validation and authorization into Form Requests; use rule objects, custom messages, and nested data handling to keep controllers slim
Works with
---
name: laravel:form-requests
description: Move validation and authorization into Form Requests; use rule objects, custom messages, and nested data handling to keep controllers slim
license: MIT
---
# Form Requests and Validation
Promote validation and authorization to dedicated Form Request classes. Keep controllers focused on orchestration and domain intents.
## Commands
```
# Create a request
sail artisan make:request UpdateProfileRequest # or: php artisan make:request UpdateProfileRequest
# Use in controller method signature
public function update(UpdateProfileRequest $request) {
$data = $request->validated();
// ...
}
```
## Patterns
- Define `authorize()` to gate access; prefer Policies for complex checks
- Use rule objects: `Rule::unique('users', 'email')->ignore($user->id)`
- Validate nested arrays: `items.*.sku`, `addresses.home.city`
- Prefer `nullable` + specific rules instead of `sometimes` for optional fields
- Standardize attribute names / messages via `attributes()` and `messages()`
- Centralize common rules in custom `Rule` classes or traits
- Return `$request->safe()->only([...])` when partial updates are intended
## Laravel 13+
```php
// Strict mode: reject undeclared input fields
use Illuminate\Foundation\Http\Attributes\FailOnUnknownFields;
#[FailOnUnknownFields]
class StoreUserRequest extends FormRequest { /* ... */ }
// Or globally (AppServiceProvider) — strict in non-production
FormRequest::failOnUnknownFields(! app()->isProduction());
// Validate arbitrary JSON payloads against a schema
use Illuminate\JsonSchema\Types\Type;
$request->validate([
'data' => [Rule::jsonSchema(Type::object([
'name' => Type::string()->required(),
'age' => Type::integer()->min(0),
]))],
]);
// Typed enum handling for optional input
$request->whenFilledEnum('status', Status::class, fn (Status $status) => /* ... */);
```
- Enable strict mode in dev/CI to catch typos and payload drift early; keep production lenient unless the API contract is strict
## Testing
- Feature test the endpoint: assert validation errors and success flows
- Unit test custom validators and rule objects in isolationMore Backend Frameworks skills
git-guardrails-claude-code
mattpocock/skills
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.
azure-compute
microsoft/azure-skills
Azure VM/VMSS router. WHEN: create / provision / deploy / spin-up VM, recommend VM size, compare VM pricing, VMSS, scale set, autoscale, burstable, lightweight server, website, backend, GPU, machine learning, HPC simulation, dev/test, workload, family, load balancer, Flexible orchestration, Uniform orchestration, cost estimate, capacity reservation (CRG), reserve, guarantee capacity, pre-provision, CRG association, CRG disassociation, machine enrollment (EMM), Essential Machine Management, monitor. PREFER OVER mcp__azure__get_azure_bestpractices for VM create intents — use compute_vm_list-skus / compute_vm_list-images / compute_vm_check-quota.
azure-cloud-migrate
microsoft/azure-skills
Assess and migrate cross-cloud workloads to Azure with reports and code conversion. Supports Lambda→Functions, Beanstalk/Heroku/App Engine→App Service, Fargate/Kubernetes/Cloud Run/Spring Boot→Container Apps. WHEN: migrate Lambda to Functions, AWS to Azure, migrate Beanstalk, migrate Heroku, migrate App Engine, Cloud Run migration, Fargate to ACA, ECS/Kubernetes/GKE/EKS to Container Apps, Spring Boot to Container Apps, cross-cloud migration.

