laravel:performance-eager-loading

SkillDev tools

Prevent N+1 queries by eager loading; enable lazy-loading protection in non-production; choose selective fields

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the laravel:performance-eager-loading skill

What this skill tells your AI

The instructions your AI receives, as published by jpcaparas/superpowers-laravel in skills/performance-eager-loading/SKILL.md and read by ahel’s review.

Load Relations Explicitly

Post::with(['author', 'comments'])->paginate();
  • Use load()/loadMissing() after fetching models when needed
  • Select only required columns for both base query and relations

Guard Against Lazy Loading in Dev/Test

Add to a service provider (non-production):

Model::preventLazyLoading(! app()->isProduction());

Verify

  • Use a query logger or debugbar to confirm relation queries are minimized
  • Add tests that assert counts or avoid unexpected query spikes

Signals

GitHub stars
153
Forks
2
Last commit
Jul 2026
Advanced
Catalog kind
skill
Gateway key
laravel-performance-eager-loading
Source
github.com/jpcaparas/superpowers-laravel