Laravel Performance Eager Loading

•
137
•

Optimizes Laravel application performance by preventing N+1 queries through efficient eager loading and lazy-loading protection.

This Claude Code skill empowers developers to write more efficient Laravel code by identifying and resolving N+1 query bottlenecks. It provides domain-specific guidance on implementing eager loading using with(), load(), and loadMissing(), while enforcing best practices like selective column selection and environment-specific lazy-loading protection. By integrating these patterns, developers can significantly reduce database load and improve response times for complex data relationships.

Key Features

01Identifies and resolves N+1 query patterns in Eloquent models
02Enforces lazy-loading protection for development and testing environments
03Implements explicit eager loading using with() and loadMissing()
04Optimizes memory usage through selective column selection in relations
05137 GitHub stars
06Provides verification strategies using query loggers and performance tests

Use Cases

01Reducing database load when fetching large collections of models with relationships
02Hardening a Laravel codebase against accidental lazy loading during local development
03Refactoring slow API endpoints caused by inefficient database interaction patterns