detect-n-plus-one

Detect N+1 query patterns in loops across multiple languages with file locations and fixes.

3|Updated May 29, 2026
One-click install
npx skills add https://github.com/anortham/miller --skill detect-n-plus-one
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: detect-n-plus-one
Source: https://github.com/anortham/miller/tree/main/.claude/skills/detect-n-plus-one
Command: npx skills add https://github.com/anortham/miller --skill detect-n-plus-one

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill systematically detects N+1 query patterns that occur when code fetches a list and then issues a separate query for each item, causing performance bottlenecks. It helps identify N+1 patterns across languages and suggests batching strategies.

Core Features & Use Cases

  • Semantic search for loop + query patterns across languages
  • Language-specific idiom detection for C#, TypeScript, Python, and Java
  • Execution trace to verify paths leading to per-item queries and propose batch fetching

Quick Start

Run the detect-n-plus-one skill to scan your codebase and surface N+1 patterns, with concrete batching fixes.

Frequently Asked Questions about detect-n-plus-one

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

FAQPage Schema
How do I detect N+1 query patterns in my codebase?▼

N+1 query detection identifies loops that fetch a list then issue separate queries per item, causing performance bottlenecks. This Skill scans code across languages, traces execution paths, and outputs structured findings with file locations, confidence levels, and batching fixes.

What languages does N+1 query detection support?▼

N+1 query detection works across multiple languages including C#, TypeScript, Python, and Java, using language-specific idiom patterns to identify loops coupled with per-item queries in backend services, APIs, and data access layers.

Can N+1 query detection work with my database queries?▼

Yes. N+1 query detection applies to any codebase where loops perform per-item queries—across ORMs, raw SQL, and API calls. It traces call paths to verify performance hotspots and proposes batching strategies for your specific query patterns.

How does N+1 query detection verify results?▼

N+1 query detection applies semantic and static analysis phases, traces execution call paths to confirm loops leading to per-item queries, and outputs actionable findings with confidence levels so you can prioritize fixes.

What's the difference between detecting N+1 queries and manual code review?▼

Automated N+1 detection systematically scans entire codebases across multiple languages, traces execution flows that manual review misses, and delivers structured findings with precise line locations and recommended batching strategies at scale.

When should I run N+1 query detection in my development workflow?▼

Run N+1 query detection during code review or before deployment to surface performance bottlenecks early. It's especially valuable after adding data access logic, refactoring queries, or scaling backend services where per-item query costs compound.