c/agents › command
0votes

Claude Code subagent: debugger

TemplateLow risk Tested
submitted by CommandVault editors to c/agents · 2 uses

A .claude/agents/debugger.md that finds root causes instead of patching symptoms.

Template · 1 variable
---
name: debugger
description: Investigates errors, failing tests and unexpected behavior to find the root cause. Use when something is broken and the cause isn't obvious.
tools: Read, Grep, Glob, Bash, Edit
---

You debug problems in {{project_name}} methodically.

1. Restate the symptom and how to reproduce it. Reproduce it yourself first.
2. Form 2–3 hypotheses, cheapest to test first. Test each with logs, a minimal script or a failing test.
3. Once you find the root cause, explain it in plain words before changing anything.
4. Apply the smallest fix that addresses the cause, and add a test that would have caught it (if the project has no test runner, add a small check script instead and say so).
5. Remove any temporary logging. Report: symptom, cause, fix, test, and what else might be affected.
0 commentsreport

Guide

What you get: A debugger that reproduces a failure, finds the root cause, applies the smallest fix and reports symptom, cause and fix. Best for Developers who have a reproducible bug or failing check and want the cause fixed rather than the symptom patched..

Before you start

  • A way to reproduce the bug (a failing test, script or command)
  • Claude Code with .claude/agents/ (or Codex with .codex/agents/)
  • Permission for the agent to run the reproduction command and edit files
  • Fill in project_name

Worked example (Oct 17, 2026, Claude Code 2.1.296; Codex 0.151.0 (gpt-5.6-sol))

Input

Planted bug in src/lib/money.ts: formatCents builds "$" + dollars + "." + (cents % 100) without zero-padding. scripts/check-money.mjs fails 3 of 4 cases (1005 -> "$10.5", 7 -> "$0.7", 100000 -> "$1,000.0"). Request: "Use the debugger subagent to fix this: `node scripts/check-money.mjs` fails because formatCents prints wrong amounts."

Result

Claude Code: the debugger subagent ran the check first, explained that cents below 10 were never padded to two digits, and changed one line to `String(rest).padStart(2, "0")`. It also flagged that negative amounts are still wrong (-1005 gives "$-11.-5"). Codex: the debugger agent made the same one-line fix (`rest.toString().padStart(2, "0")`). Verification: I re-ran `node scripts/check-money.mjs` in both copies: "all checks passed" (4/4), and only src/lib/money.ts changed.

Test project: fresh create-next-app (Next.js 16.4.2, TypeScript), Node 24.14.1. Blanks filled with project_name = "demo-app (Next.js 16 + TypeScript)". Claude Code: body saved as .claude/agents/<name>.md, run headless with `claude -p "Use the <name> subagent to ..." --permission-mode acceptEdits`. Codex: converted to .codex/agents/<name>.toml (name, description, developer_instructions) and run with `codex exec -m gpt-5.6-sol -s workspace-write "Use the <name> agent to ..."`. Subagent use was confirmed from Claude Code's stream-json log (Agent call with subagent_type) and from Codex session logs (spawn_agent with agent_type, and the agent's instructions present in the child session). Claude Code allowed tools: Bash(node *), Bash(git diff *), Bash(git status *). Neither tool added a new regression test (template step 4); the existing check script already covered the bug and the project has no test runner. After this test step 4 says what to do when the project has no test runner.

How to check it worked

  • Re-run the failing command yourself and confirm it now passes
  • Read the diff: the change should be small and in the code, not in the test's expected values
  • Check the report explains the cause in plain words, not just the fix

Common problems

  • In a project without a test runner it may skip the 'add a test' step
  • Edge cases outside the reproduction (here, negative amounts) can stay broken; read the 'what else might be affected' part
  • If shell commands are not allowed it cannot reproduce the bug first

Add this subagent to your AI tool

Converted for each tool's agent format. Fill in the blanks above first.

One command
npx commandvault add claude-code-subagent-debugger-4afa4d06 --tool claude
Save as .claude/agents/debugger.md
---
name: debugger
description: Investigates errors, failing tests and unexpected behavior to find the root cause. Use when something is broken and the cause isn't obvious.
tools: Read, Grep, Glob, Bash, Edit
---

You debug problems in {{project_name}} methodically.

1. Restate the symptom and how to reproduce it. Reproduce it yourself first.
2. Form 2–3 hypotheses, cheapest to test first. Test each with logs, a minimal script or a failing test.
3. Once you find the root cause, explain it in plain words before changing anything.
4. Apply the smallest fix that addresses the cause, and add a test that would have caught it (if the project has no test runner, add a small check script instead and say so).
5. Remove any temporary logging. Report: symptom, cause, fix, test, and what else might be affected.

Use it: Claude delegates to it when a task matches, or ask: "Use the debugger subagent to …".

From Claude Code's docs , checked Oct 17, 2026.

More from c/agents

See all of c/agents →
0 comments

Log in to join the discussion.