debug

A guided debugging command for finding and fixing the underlying cause of a failing test, build, or running service.

In plain words
What is it for?
Use it to investigate test failures, compiler or bundler errors, runtime logs, database or message-queue problems, and lint errors.
Why use it?
It prevents quick symptom fixes that hide the real bug. It requires evidence, a testable explanation, a focused fix, and verification.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/brain-bootstrap/claude-code-brain-bootstrap/debug
Clone the repo
git clone --depth 1 https://github.com/brain-bootstrap/claude-code-brain-bootstrap

Made for: Claude Code.

Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 678 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00019 $0.00678
Opus 5 $0.00010 $0.00339
Sonnet 5 $0.00004 $0.00136
Haiku 4.5 $0.00002 $0.00068

Measured yesterday against content hash e73c646d24fe, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

debug scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/debug.md · 67 lines

How it starts

The opening of the file, as written. The whole thing — 67 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Debug a failing test, build, or service issue: $ARGUMENTS

ultrathink — use extended reasoning for root cause analysis.

Iron Law

NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST

Symptom fixes are failure. A fix that makes a test pass without understanding why it was failing is not a fix — it is a masked bug. This law is especially critical under time pressure, after 2+ failed fix attempts, or when there is a "just try this quick thing" temptation.

4 Phases (do not skip or reorder):

  1. Root Cause — gather all evidence, classify the failure
  2. Hypothesis — form a specific, testable hypothesis about the cause
  3. Fix Design — design a minimal fix that addresses the root cause only
  4. Verification — run the test/build, confirm fix, check for regressions

Instructions

Read claude/tasks/lessons.md for known pitfalls before starting.

Phase 1 — Root Cause (gather ALL evidence before hypothesizing):

  1. Identify the failure type from the arguments:

    • Test failure → read test file + source under test
    • Build failure → read error output, check compiler/bundler errors
    • Runtime error → read logs, check DB state, check message queues
    • Lint error → run linter on the file
  2. Gather evidence (do ALL of these before proposing a fix):

    • Read the full error message/stack trace
    • Read the failing source file
    • Check if the error is pre-existing: git stash && <run-test> && git stash pop
    • Search claude/tasks/lessons.md for similar past issues
    • Check if the file was recently modified: git --no-pager log --oneline -5 -- <file>

Phase 2 — Hypothesis (form one specific, testable hypothesis before acting):

Write it explicitly: "I believe the root cause is X because Y."

Phase 3 — Fix Design (fix only the root cause, no opportunistic changes):

  1. Diagnose root cause — classify:
    Category Symptoms Typical fix
    Missing import ReferenceError, is not defined Add import statement
    Type mismatch TypeError, Cannot read properties Fix type/null check
    DB schema drift column X does not exist Check migration
    Stale build Works after clean build Clean + rebuild
    Stub mismatch Test assertion fails Verify stub key matches export name

Read the full file on GitHub · 67 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 67 lines · 19 tokens per session scan A e73c646d24fe

Subscribe to this mod's changes

debug is a command published in the GitHub repository brain-bootstrap/claude-code-brain-bootstrap (11 stars, last pushed 4mo ago), licensed MIT. It adds 19 tokens to every session and 678 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.