home / skills / jcastillotx / vibe-skeleton-app / laravel-best-practices
This skill enforces Laravel best practices to optimize security, Eloquent, performance, API design, and testing across applications.
npx playbooks add skill jcastillotx/vibe-skeleton-app --skill laravel-best-practicesReview the files below or copy the command above to add this skill to your agents.
---
name: laravel-best-practices
description: Laravel development standards. Triggers when working with Laravel applications, Eloquent ORM, Blade templates, or Livewire components.
trigger_patterns:
- laravel
- eloquent
- blade
- livewire
- artisan
- composer.json
- app/Models
- app/Http
auto_load_with:
- php-best-practices
- mysql-best-practices
---
# Laravel Best Practices
Comprehensive coding standards for Laravel applications, optimized for AI agents and LLMs.
## Overview
This skill provides 26 rules organized across 8 categories:
1. **Security (security-)** - CSRF, XSS, SQL injection, mass assignment [CRITICAL]
2. **Eloquent Optimization (eloquent-)** - Eager loading, chunking, lazy collections [CRITICAL]
3. **Performance (perf-)** - Route caching, config caching, OPcache [HIGH]
4. **Architecture (arch-)** - Service containers, repositories, actions [HIGH]
5. **API Development (api-)** - Resources, rate limiting, versioning [MEDIUM-HIGH]
6. **Testing (test-)** - Feature tests, mocking, factories [MEDIUM]
7. **Queue & Jobs (queue-)** - Job batching, rate limiting, retries [MEDIUM]
8. **Livewire (livewire-)** - Wire navigation, lazy loading, polling [LOW-MEDIUM]
## Usage
Reference this skill when:
- Building Laravel applications
- Optimizing Eloquent queries
- Implementing API endpoints
- Setting up job queues
- Writing tests
## Build
```bash
pnpm build # Compile rules to AGENTS.md
pnpm validate # Validate rule files
```
This skill codifies Laravel development standards focused on security, Eloquent optimization, performance, architecture, API design, testing, queues, and Livewire patterns. It organizes 26 practical rules across eight categories to guide safe, efficient, and maintainable Laravel apps. Use it as a checklist and reference when building or reviewing Laravel projects.
The skill inspects common Laravel development areas and recommends concrete practices: prevent CSRF/XSS/SQL injection, guard against mass assignment, optimize Eloquent with eager loading and chunking, and enable caching and OPcache for production. It also covers architecture choices (service containers, actions), API conventions (resources, rate limiting), testing strategies, job/queue handling, and Livewire optimizations.
Do these rules apply to all Laravel versions?
The principles are broadly applicable, but check framework-specific features and available helpers for your Laravel version before applying changes.
Which category should I prioritize for a production launch?
Prioritize Security and Eloquent Optimization first, then Performance and Architecture to ensure safety and responsiveness at scale.