From superpowers-laravel
Prevents N+1 queries in Laravel by guiding eager relation loading, selective field selection, and non-production lazy-loading protection. Optimizes DB performance.
How this skill is triggered — by the user, by Claude, or both
Slash command
/superpowers-laravel:performance-eager-loadingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
```php
Post::with(['author', 'comments'])->paginate();
load()/loadMissing() after fetching models when neededAdd to a service provider (non-production):
Model::preventLazyLoading(! app()->isProduction());
npx claudepluginhub jpcaparas/superpowers-laravel --plugin superpowers-laravelDefines Eloquent model relationships and loads data efficiently in Laravel: prevents N+1 queries, applies constraints, uses counts/sums aggregates, and handles pivot syncing safely.
Applies Laravel Eloquent best practices for query optimization, eager loading to avoid N+1, relationships, mass assignment protection, casts, and chunking large datasets.
Complete Eloquent ORM - models, relationships, queries, casts, observers, factories. Use when working with database models.