laravel-best-practices
Laravel 13 conventions and best practices. Use when creating controllers, models, migrations, validation, services, or structuring Laravel applications. Triggers on tasks involving Laravel architecture, Eloquent, database, API development, or PHP patterns.
Security Assessment
About laravel-best-practices
laravel-best-practices is a conventions-and-patterns reference for building Laravel 13 applications. It packages 31 rules across seven prioritized categories (architecture, Eloquent/database, controllers/routing, validation, security, performance, and API design) so that an agent generating or reviewing Laravel code produces scalable, maintainable results that follow community-accepted patterns rather than ad-hoc code.
Each rule lives in its own Markdown file with a consistent structure: an impact rating, a bad example, a good example, and a rationale. Coverage includes extracting business logic into service and action classes, repository and DTO patterns, event-driven decoupling with listeners and queues, feature-folder organization, Eloquent practices (eager loading to prevent N+1 queries, chunking, query scopes, casts, soft deletes, pruning, and pgvector-based vector search), resource controllers and form requests, and layered validation techniques including conditional, array, and after-hook rules. A dedicated security rule covers protecting against mass assignment. The SKILL.md provides a quick-reference index and essential code snippets such as a controller wired to a form request.
The skill targets Laravel and PHP developers (Laravel 13.x, PHP 8.3+) writing controllers, models, migrations, services, or APIs, and teams wanting a shared style guide for reviews. Note that the Performance and API Design categories are listed but currently have no rule files, so it is a substantial but still-growing reference. All content is illustrative code and prose guidance; it executes nothing itself.
FAQ
What Laravel and PHP versions does it target?
Laravel 13.x and PHP 8.3+ per the skill metadata, including Laravel 13+ features like centralized queue routing and pgvector-based vector search.
How are the rules organized?
Into seven priority categories (architecture, Eloquent/database, controllers, validation, security, performance, API design), each rule in its own file with impact rating, bad example, good example, and a why section.
Are all categories fully covered?
No. The SKILL.md notes that the Performance and API Design categories are defined but have no rule files yet, so those areas are placeholders.
Does it run or modify my code?
No. It is a set of reference Markdown files with example snippets; it provides guidance for writing and reviewing code but performs no execution.
Who is it for?
Laravel/PHP developers building controllers, models, services, migrations, validation, and APIs, and teams wanting a consistent architecture and review reference.
All Files
37 filesInstall laravel-best-practices
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
asyrafhussin/agent-skills