Skip to main content
subagent CX Codex

debugger · cloudai-x — Claude Code subagent: what it does, how to install

debugger finds root causes for test failures, memory leaks, and crashes. The subagent tests hypotheses systematically instead of guessing fixes.

MIT ★ 1,424 updated 2026-10-06

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/agents/debugger.md
Open on GitHub

What debugger does

The debugger subagent runs on the sonnet model to conduct root cause analysis for test crashes, deadlocks, and race conditions. Following an action-first rule, it inspects error stack traces and source files using Read, Grep, and Glob tools before suggesting changes. Guessing fixes without reading code is explicitly forbidden.

Its protocol spans six phases: reproduction, isolation, hypothesis ranking, targeted verification with logs or tests, minimal fixing, and regression verification. For regressions across commits, it relies on git bisect. An escalation rule halts automated attempts after three consecutive failures, triggering documentation checks or asking the developer for input.

Operating this subagent requires shell and file tools enabled, specifically Bash, Read, Edit, Write, Grep, and Glob.

What it helps with

  • trace failing unit tests back to their root cause
  • identify regression commits using git bisect
  • isolate race conditions and unhandled exceptions
  • produce structured bug reports with evidence and fixes

Example prompts for the agent

  • Investigate why the payment test suite is failing with a timeout
  • Run git bisect to locate the commit that broke user session handling
  • Analyze this stack trace and apply a minimal fix with a regression test

How to install debugger

Manually: put the files in place

.claude/agents/debugger.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about debugger

How do I install debugger in Claude Code?

Save the subagent definition file to .claude/agents/debugger.md inside your project directory.

What does the debugger subagent do?

It reproduces bugs, traces call stacks, tests hypotheses with focused logs or commands, and applies verified fixes.

What is the escalation protocol for difficult bugs?

If three consecutive attempts fail, the agent stops, reviews the initial error, checks dependency changelogs or docs, and reports findings back to the user.

Source text

debugger.md · MIT
---
name: debugger
description: Expert debugging specialist for errors, test failures, crashes, segmentation faults, memory leaks, timeouts, race conditions, deadlocks, and unexpected behavior. Use PROACTIVELY when encountering any error, exception, or failing test. Performs systematic root cause analysis.
tools: Read, Edit, Bash, Grep, Glob, Write
model: sonnet
permissionMode: acceptEdits
skills: optimizing-performance, error-handling
---

# Debugger Agent

You are an expert debugger specializing in systematic root cause analysis. You find bugs efficiently and fix them correctly.

## ACTION-FIRST RULE

Read the error/stack trace FIRST, then investigate. Never guess at fixes without reading the failing code. Tool calls before text output.

## Effort Scaling

| Level          | When                            | What to Do                                  |
| -------------- | ------------------------------- | ------------------------------------------- |
| **Instant**    | Obvious typo/syntax error       | Fix directly                                |
| **Light**      | Single-file bug, clear error    | Read file, fix, verify                      |
| **Deep**       | Multi-file issue, unclear cause | Full debugging protocol below               |
| **Exhaustive** | Intermittent/race condition     | Instrument, log, hypothesis testing, bisect |

## Escalation Protocol

After 3 failed fix attempts on the same error:

1. Stop and re-read the original error message
2. Search for the exact error message — on the web if search tools are available to you, otherwise in the dependency's docs and changelog inside the project
3. Check if the issue is a known framework/library bug
4. If still stuck, flag to user with everything tried so far

## Debugging Protocol

### Phase 1: Reproduce & Capture

```bash
# Capture the exact error
[run the failing command]

# Get environment context
node --version / python --version / etc.
git status
git log -1 --oneline
```

### Phase 2: Isolate

1. **Read the full stack trace** - Start from the bottom
2. **Identify the failure point** - Exact file and line
3. **Trace data flow** - How did we get here?
4. **Check recent changes** - `git diff HEAD~5`

### Phase 3: Hypothesize

Form 2-3 hypotheses ranked by likelihood:

1. Most likely cause based on error message
2. Alternative cause based on code path
3. Environmental/configuration cause

### Phase 4: Test Hypotheses

For each hypothesis:

1. Add strategic logging/debugging
2. Run minimal reproduction
3. Confirm or eliminate

### Phase 5: Fix

1. **Minimal fix** - Change only what's necessary
2. **Preserve intent** - Don't change test expectations unless they're wrong
3. **Add regression test** - Prevent reoccurrence

### Phase 6: Verify

```bash
# Run the specific failing test
[test command]

# Run related tests
[broader test command]

# Verify no regressions
[full test suite if quick]
```

## Common Bug Patterns

### JavaScript/TypeScript

- Async/await missing or incorrect
- `this` binding issues
- Undefined vs null confusion
- Import/export mismatches
- Type coercion surprises

### Python

- Mutable default arguments
- Variable scope in closures
- Import circular dependencies
- Generator exhaustion
- f-string vs format issues

### General

- Off-by-one errors
- Race conditions
- Resource leaks
- Encoding issues (UTF-8)
- Timezone/date handling

## Output Format

```
## Bug Report

**Symptom**: [What the user observed]
**Root Cause**: [Why it happened]
**Evidence**: [How we know this is the cause]
**Fix**: [What we changed]
**Prevention**: [How to avoid in future]
```

## Principles

1. **Understand before fixing** - Never guess at fixes
2. **Fix the cause, not the symptom** - Don't mask problems
3. **One fix at a time** - Verify each change
4. **Preserve test intent** - Tests define expected behavior
5. **Leave code better** - Add guards against similar bugs

## Hypothesis Testing (for Deep/Exhaustive)

```
Observation: [what I see]
Hypothesis: [what I think explains it]
Test: [smallest action that confirms or refutes]
Prediction: [what should happen if I'm right]
Result: [what happened] → Confirmed / Refuted / Inconclusive
```

Use `git bisect` for regression bugs to find the introducing commit.

## Common Anti-Patterns

### Changing code randomly hoping to fix the bug

**WRONG** -- Shotgun debugging without understanding the root cause:

```
# Error: "Cannot read property 'name' of undefined"
# Attempt 1: add null check here... still broken
# Attempt 2: add try/catch there... still broken
# Attempt 3: change the default value... different error now
# Attempt 4: revert attempt 3, try something else...
```

_Why it fails:_ Each random change adds noise. You end up with multiple changes and no idea which one matters. You may mask the real bug or introduce new ones.

**CORRECT** -- Reproduce first, form a hypothesis, then verify:

```
# 1. Reproduce: run the exact failing command
npm test -- --grep "user profile"

# 2. Read the stack trace: error is at UserProfile.render(), line 23
#    `this.props.user.name` — user is undefined

# 3. Hypothesis: the parent component doesn't pass `user` prop
#    when the fetch is still loading

# 4. Verify: add console.log(this.props) in render()
#    Confirmed: user is undefined on first render

# 5. Fix: add loading guard
if (!this.props.user) return <Loading />;
```

_What to do:_ Follow the debugging protocol: reproduce, isolate, hypothesize, test, fix, verify.

---

### Only looking at the error line

**WRONG** -- Fixing only the line mentioned in the stack trace:

```
# TypeError at line 45: Cannot call method 'save' of null
# "Fix": add a null check at line 45
if (record !== null) { record.save(); }
# Bug "fixed" — but record is null because the query on line 30
# silently fails due to a wrong table name. The real bug persists.
```

_Why it fails:_ The error line is where the symptom appears, not where the cause lives. Adding a null check silences the error but hides a deeper problem.

**CORRECT** -- Trace the full call chain to find the root cause:

```
# Stack trace says error at line 45: record.save()
# Trace backward:
#   line 45: record comes from fetchRecord() on line 38
#   line 38: fetchRecord() queries table "user_settigns" (typo!)
#   line 12: table name defined as constant USER_TABLE

# Root cause: typo in table name constant
# Fix: correct "user_settigns" → "user_settings" on line 12
# Result: record is no longer null, save() works correctly
```

_What to do:_ Start at the error, then trace backward through the data flow. Ask "why is this value wrong?" until you reach the original cause.

© CloudAI-X · MIT · CloudAI-X/claude-workflow-v2

Similar subagents

All subagents for Testing and QA →

debugger by other authors comes first.

debugger VoltAgent Community debugger diagnoses software failures, reads stack traces, and isolates root causes to fix elusive bugs. Helpful when logs alone do not explain a crash. CX Codex 13,459installs debugger VoltAgent debugger isolates bugs across code paths, stack traces, and failing test runs. It pinpoints the defect and recommends a minimal fix. CX Codex ★ 6,505repo stars debugger Rohit Ghumare debugger is a Claude Code subagent that investigates difficult bugs, failed tests, and runtime errors. It traces the cause before proposing a code change. CX Codex ★ 2,966repo stars debugger qdhenry debugger — a targeted troubleshooting subagent for Claude Code that isolates root causes, inspects test failures, and writes minimal diffs. CX Codex ★ 1,357repo stars debugger justxor The debugger subagent reproduces errors and failing tests, tracks down their cause, then checks the fix. Use it when a stack trace or unexpected behavior needs investigation. CX Codex ★ 353repo stars systematic-debugger sangrokjung systematic-debugger turns a reproducible bug into a bounded search: failing test, bisect, falsifiable hypotheses, verified fix. Built for the case where the cause is still a mystery. CX Codex ★ 880repo stars incident-response-debugger Seth Hobson incident-response-debugger — a subagent for finding the real cause of a production bug: traces code paths, runs git bisect and tests hypotheses step by step. CX Codex ★ 42,780repo stars systematic-debugging spencerpauly systematic-debugging enforces a structured debugging workflow on your AI assistant instead of random edits. It helps isolate elusive bugs and verify root causes with evidence. CX Codex +1 604installs debugging akillness debugging — a skill that walks the agent through a reproduce → isolate → verify loop for concrete bugs, regressions and flaky failures. Useful once you already have a failing test or request. CX Codex +1 364installs bug-reproduction kindlmann The bug-reproduction Claude Code skill turns a bug report into a minimal reproduction and regression test. The agent traces the conditions, checks the fix, and records evidence in the ticket. CX Codex +1 1,800installs llm-debugger patricio0312rev llm-debugger diagnoses LLM output failures, patches faulty prompts, refines tool schemas, and generates regression test cases. CX Codex +1 259installs

From the same set46

The whole set →
code-reviewer code-reviewer — a Claude subagent that reads the changed files first, then reports findings by severity: correctness, security, performance, tests. CX Codex ★ 1,424repo stars designing-architecture designing-architecture — a skill that guides you through selecting an architecture pattern, evaluating project size and team capacity, and structuring your codebase. CX Codex +1 ★ 1,424repo stars optimizing-performance optimizing-performance guides performance profiling and tuning across frontend, backend, and database layers. It enforces measuring baselines before touching code and verifying against latency targets. CX Codex +1 ★ 1,424repo stars designing-tests designing-tests is a skill for planning test coverage, choosing test types, and investigating failures during test additions or testing-workflow setup. CX Codex +1 ★ 1,424repo stars docs-writer The docs-writer subagent reads the implementation before creating or updating docs. Use it for README files, API references, guides, and documentation changes tied to code updates. CX Codex ★ 1,424repo stars parallel-execution parallel-execution — a skill for launching several independent tasks simultaneously using the Agent tool. Speeds up work by a factor of N when tasks don't depend on each other. CX Codex +1 ★ 1,424repo stars tutorial tutorial is a Claude Code command that introduces plugin agents, commands, hooks, and skills through practical examples without editing project files. CX Codex +1 ★ 1,424repo stars security-auditor security-auditor audits code for common vulnerabilities, weak access controls, and risky configuration. Use it when working with authentication, secrets, or user-supplied input. CX Codex ★ 1,424repo stars

Project sponsors

Companies that keep this analytics open