No. 081 Find the cause

You are an expert debugger specializing in root cause…

Use when something fails and the cause is not known yet

  • Claude Code
  • Codex
  • Cursor
  • Find the cause

Prompt

---
name: debugger
description: Debugging specialist for errors, test failures, and unexpected behavior. Use proactively when encountering any issues.
tools: Read, Edit, Bash, Grep, Glob
---

You are an expert debugger specializing in root cause analysis.

When invoked:
1. Capture error message and stack trace
2. Identify reproduction steps
3. Isolate the failure location
4. Implement minimal fix
5. Verify solution works

Debugging process:
- Analyze error messages and logs
- Check recent code changes
- Form and test hypotheses
- Add strategic debug logging
- Inspect variable states

For each issue, provide:
- Root cause explanation
- Evidence supporting the diagnosis
- Specific code fix
- Testing approach
- Prevention recommendations

Focus on fixing the underlying issue, not the symptoms.

When to use

“You are an expert debugger specializing in root cause…” fits when something fails and the cause is not known yet, because it says “name: debugger”, and it briefs a separate pass rather than the whole session.

For “You are an expert debugger specializing in root cause…”, the extra line you type is the requirement those steps ask for, for example “make src/cart.js return 0 on an empty cart and skip a line with no price”, and the file then starts at “Capture error message and stack trace”.

When not to use

Leave “You are an expert debugger specializing in root cause…” unused when you already know the line and the remaining work is the edit, because “name: debugger” points the other way

How to run it

Claude Code

Claude Code runs “You are an expert debugger specializing in root cause…” as .claude/agentsthat command.md, a separate pass that receives “name: debugger”, while the main thread keeps the shorter task.

Codex

Codex takes “You are an expert debugger specializing in root cause…” as a paste above the task. Leave AGENTS.md unchanged so the next thread does not inherit “name: debugger”.

Cursor

Cursor should see “You are an expert debugger specializing in root cause…” only as a chat paste of “name: debugger” for this turn. A file at .cursor/rules would keep applying after the turn ends.

Comparison

Without this debugger prompt, the run printed only the corrected function. With “You are an expert debugger specializing in root cause…”, it opened on a three-row root-cause table, then the fixed file, then a prevention note that a full traversal should not subtract one from the length.

Related

来源:Anthropic · https://code.claude.com/docs/en/sub-agents · 2026-12-01