lc:find-n-plus-one

Detect N+1 database queries in Laravel Blade and Livewire files.

12|2|Updated Apr 8, 2026
One-click install
npx skills add https://github.com/edulazaro/laraclaude --skill lc-find-n-plus-one
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lc:find-n-plus-one
Source: https://github.com/edulazaro/laraclaude/tree/main/skills/find-n-plus-one
Command: npx skills add https://github.com/edulazaro/laraclaude --skill lc-find-n-plus-one

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill identifies and resolves N+1 query performance issues where database relationships are accessed inside loops without eager loading, which can cause significant application slowdowns.

Core Features & Use Cases

  • Automated Detection: Scans Blade views, Livewire components, and controllers to find inefficient relationship access patterns.
  • Intelligent Fixing: Automatically suggests or applies with() eager loading to optimize database queries.
  • Use Case: When a list of 50 properties is displayed in a view, this skill detects if the office name is being fetched for each property individually, and helps you refactor the query to fetch all office data in a single additional query.

Quick Start

Use the lc:find-n-plus-one skill to scan the entire project for N+1 query problems and report the findings.

Frequently Asked Questions about lc:find-n-plus-one

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find and fix N+1 query problems in a Laravel application?

To fix Laravel N+1 query problems, scan Blade views, Livewire components, and Eloquent controllers to detect relationship access inside loops. It suggests or applies with() eager loading to optimize database queries and resolve the bottlenecks.

What are N+1 database query bottlenecks and how do they affect performance?

N+1 database query bottlenecks occur when relationships are accessed inside loops without eager loading, triggering individual queries for each item. This causes significant application slowdowns when displaying lists with related Eloquent data.

Does N+1 query detection work with Livewire components and Blade templates?

Yes, N+1 query detection works with Livewire components and Blade templates. It scans these view files alongside Eloquent controllers to find inefficient relationship access patterns and suggests applying with() eager loading optimizations.

What is the best way to optimize Eloquent relationship loading in loops?

The best way to optimize Eloquent relationship loading in loops is to use eager loading. By applying with() or load() clauses to your queries, you fetch all related data in a single additional query instead of querying individually for each item in the loop.

Why is my Laravel application slow when displaying lists with related model data?

Your Laravel application is likely slow due to N+1 query bottlenecks where database relationships are accessed inside loops without eager loading. Scanning your Eloquent controllers and Blade views can detect missing with() clauses causing the performance bottleneck.