Reduce controller bloat using Form Requests for auth/validation, small Actions/Services with DTOs, and resource/single-action controllers
Write focused controller tests using HTTP assertions; keep heavy logic in Actions/Services and unit test them
Use interfaces and dependency injection to decouple code; bind implementations in the container
Create and register small, pure helper functions when they improve clarity; keep them organized and tested
Use the Strategy pattern to select behavior at runtime; bind multiple implementations to a shared interface
Schedule tasks with safety; use withoutOverlapping, onOneServer, and visibility settings for reliable cron execution
Apply per-user and per-route limits with RateLimiter and throttle middleware; use backoffs and headers for clients
Wrap multi-write operations in transactions; use dispatchAfterCommit and idempotency patterns to ensure consistency
Store and serve files via Storage; set visibility, generate URLs, and handle streaming safely
Enforce access via Policies and Gates; use authorize() and authorizeResource() to standardize controller protections
Safe database change patterns; when to modify vs add migrations; always pair models with migrations and factories; seeding guidance
Refine AI-generated code through specific feedback—point out errors, identify gaps, show desired changes, reference style guides
Replace hardcoded values with constants, enums, and configuration for maintainability; use PHP 8.1+ enums and config files
Keep routes clean and focused on mapping requests to controllers; avoid business logic, validation, or database operations in route files
Remove unneeded Composer packages and assets to improve boot time, memory, and security surface
Select only required columns to reduce memory and transfer costs; apply to base queries and relations
Prevent N+1 queries by eager loading; enable lazy-loading protection in non-production; choose selective fields
Use API Resources with pagination and conditional fields; keep response shapes stable and cache-friendly
Portable storage configuration across S3/R2/MinIO with optional CDN—env toggles, path-style endpoints, and URL generation
Stabilize workflows with Template Method or Strategy; extend by adding new classes instead of editing core logic