jaegertracing/jaeger/detect-n-plus-one
Claude Code and agent skill by jaegertracing/jaeger
- community
Checking that the SKILL.md file is still in the repository.
Detect N+1 query patterns in a trace, where one parent operation triggers many near-identical child spans (often database calls). Use when a trace is slow and shows repeated downstream calls, or when the user asks about N+1, repeated queries, or chatty DB access.
Install
npx vskill@latest install jaegertracing/jaeger/detect-n-plus-oneSKILL.md
The same SKILL.md was published earlier as jaegertracing/jaeger/detect-n-plus-one.
Detect N+1 Query Patterns
When this applies
A parent span has many child spans with the same operation name and similar duration, typically database queries or RPC calls.
Procedure
- Find candidate traces with
find_traces. - Pull the span tree with
get_trace_topology; group child spans by operation
name under each parent. Operation name alone is not enough to make a group: spans sharing a name may call different endpoints, and one unrelated call left in the group distorts every measurement in step 3. Confirm with get_span_details that a group targets one downstream operation, and split it where it does not.
- A group is a candidate only if it is both repeated and serial. Take the
group's elapsed window — earliest start to latest end — and compare it with the sum of the siblings' own durations. Roughly equal means each call waited for the one before it, which is the N+1. A sum larger than the window means the calls overlapped, and no number of them makes an N+1.
- Apply the count last, to groups that survived step 3: more than 10 serial
siblings is worth reporting.
- Look at what varies between the siblings you kept. An N+1 repeats one call
with a single changing parameter — a row id, a driver id — while everything else stays fixed. If the calls vary in more than that, they may be distinct work that happens to share a name.
- Report: the parent span (service, operation), the repeated child operation,
the count, the elapsed window and the summed duration that established the calls were serial.
Gotchas
- Do not decide from duration similarity. A real N+1 containing one retry is
less uniform than a fan-out of evenly-sized parallel calls, so the more uniform group is often the one that is not an N+1.
- Overlap is frequently partial: a worker pool runs a few calls at a time, so
only some siblings overlap. Any excess of summed duration over the elapsed window means concurrency, and the group is a fan-out.
- Batch operations may share an operation name but carry different payloads —
check span attributes to distinguish.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingcmd/jaeger/internal/extension/jaegerquery/internal/mcptools/skills/detect-n-plus-one/SKILL.md
Popularity
- Repository stars
- 23,253
- Repository forks
- 3,137
- 7-day trend score
- 50
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/jaegertracing/jaeger/detect-n-plus-one)