asyrafhussin avatar

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-code

Installs 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
1dbt-labs avatarconfiguring-dbt-mcp-serverdbt-labs/dbt-agent-skillsGenerates MCP server configuration JSON, resolves authentication setup, and validates server connectivity for dbt. Use when setting up, configuring, or troubles1.1Kskills.sh installs
2tencentcloudbase avatarauth-tool-cloudbasetencentcloudbase/skillsCloudBase auth provider configuration and login-readiness guide. This skill should be used when users need to inspect, enable, disable, or configure auth provid1Kskills.sh installs
3asyrafhussin avatarapi-design-patternsasyrafhussin/agent-skillsRESTful API design, error handling, versioning, and best practices. Use when designing APIs, reviewing endpoints, implementing error responses, or setting up AP984skills.sh installs
4tencentcloudbase avatarauth-nodejs-cloudbasetencentcloudbase/skillsCloudBase Node SDK auth guide for server-side identity, user lookup, and custom login tickets. This skill should be used when Node.js code must read caller iden964skills.sh installs
5kostja94 avatarapi-page-generatorkostja94/marketing-skillsWhen the user wants to create, optimize, or audit the API introduction/overview page. Also use when the user mentions "API page," "API landing page," "/api page851skills.sh installs
6secondsky avatarsap-api-stylesecondsky/sap-skillsThis skill provides comprehensive guidance for documenting SAP APIs following the SAP API Style Guide standards. It should be used when creating or reviewing AP848skills.sh installs