← ClaudeAtlas

laravel-best-practiceslisted

Apply this skill whenever writing, reviewing, or refactoring Laravel PHP code. This includes creating or modifying controllers, models, migrations, form requests, policies, jobs, scheduled commands, service classes, and Eloquent queries. Triggers for N+1 and query performance issues, caching strategies, authorization and security patterns, validation, error handling, queue and job configuration, route definitions, and architectural decisions. Also use for Laravel code reviews and refactoring existing Laravel code to follow best practices. Covers any task involving Laravel backend PHP code patterns.
paulocmguerreiro/findocprocessor-backend-laravel · ★ 0 · API & Backend · score 75
Install: claude install-skill paulocmguerreiro/findocprocessor-backend-laravel
# Laravel Best Practices Best practices for Laravel, prioritized by impact. Each rule teaches what to do and why. For exact API syntax, verify with `search-docs`. ## Pré-condição obrigatória — MCP laravel-boost Antes de gerar ou alterar qualquer código, executar obrigatoriamente: 1. `search-docs` — uma ou mais queries temáticas relevantes para o contexto da tarefa (ex: `"form request validation"`, `"eloquent relationships"`) 2. `database-schema` — **sempre** que a tarefa envolva Models, migrations, ou queries Eloquent 3. `database-query` — **sempre** que a tarefa envolva repositórios ou queries complexas (verificar dados reais) Não saltar este passo. O código gerado sem consultar `search-docs` pode usar APIs incorrectas para a versão instalada. ## Consistency First Before applying any rule, check what the application already does. Laravel offers multiple valid approaches — the best choice is the one the codebase already uses, even if another pattern would be theoretically better. Inconsistency is worse than a suboptimal pattern. Check sibling files, related controllers, models, or tests for established patterns. If one exists, follow it — don't introduce a second way. These rules are defaults for when no pattern exists yet, not overrides. ## Quick Reference ### 1. Database Performance → `rules/db-performance.md` - Eager load with `with()` to prevent N+1 queries - Enable `Model::preventLazyLoading()` in development - Select only needed columns, avoid `SELECT *` - `c