
Laravel Database Optimization
This is your go-to reference for keeping Laravel database queries fast. It covers the usual suspects: eliminating N+1 queries with eager loading, adding the right indexes, using Redis caching effectively, and handling large datasets with cursor pagination. The 33 rules are organized by impact level, so you tackle critical performance issues first. It's built for Laravel 13 and includes practical patterns like preventing lazy loading in development, using withCount instead of loading full relations, and writing zero-downtime migrations. The rule categories are well structured, from query optimization and indexing to transactions and naming conventions. Solid for both fixing existing bottlenecks and writing performant code from the start.
- skills.sh installs
- 1.1K
- GitHub stars
- 102
- last updated
- Aug 21, 2026
Install
$ npx -y skills add asyrafhussin/agent-skills --skill laravel-database-optimization --agent claude-codeInstalls into .claude/skills of the current project.
Files
Laravel Database Optimization
Comprehensive database optimization guide for Laravel 13 applications. Contains 33 rules across 9 categories for writing performant database queries, proper indexing, efficient caching, naming conventions, and debugging slow queries in Laravel 13.
Metadata
- Version: 1.1.0
- Framework: Laravel 13.x
- PHP: 8.3+
When to Apply
Reference these guidelines when:
- Writing Eloquent queries or using the query builder
- Diagnosing and fixing N+1 query problems
- Adding database indexes to migrations
- Implementing Redis or cache-based optimizations
- Paginating or processing large datasets
- Wrapping operations in database transactions
- Creating or modifying migrations for production databases
- Debugging slow queries with EXPLAIN or Laravel Debugbar
Rule Categories by Priority
Sponsors
Details
- Repository
- github.com/asyrafhussin/agent-skills
- Categories
- Backend & APIs, Documentation, AI & Agent Building, Debugging, PHP & Laravel, Databases
- First seen
- Jun 3, 2026
More from asyrafhussin/agent-skills
All 14- Laravel Owasp Security1.1K
- Tailwind Best Practices1K
- Api Design Patterns984
- Testing Best Practices957
- Web Design Guidelines948
- Git Workflow890
- State Management834
- Php Best Practices3.8K
- React Vite Best Practices3K
- Laravel Best Practices2.4K
- Laravel Inertia React2K
- Clean Code Principles1.9K
- Typescript React Patterns1.1K