debug

A structured debugging command that reproduces a problem, forms testable explanations, checks them with evidence, and then fixes the confirmed cause.

In plain words
What is it for?
It is for investigating reproducible software bugs by collecting errors and recent changes, ranking possible causes, testing them, and applying a fix.
Why use it?
It replaces guess-and-check debugging with a record of hypotheses and quick tests, making the cause easier to narrow down.

Command for Claude Code

Part of the productionos plugin — 4 skills, 41 commands, 11 agents shipped together

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/shaheerkhawaja/productionos/debug
Clone the repo
git clone --depth 1 https://github.com/ShaheerKhawaja/ProductionOS

Made for: Claude Code.

Or install productionos, the plugin that ships this one along with the rest of its 4 skills, 41 commands, 11 agents.

Per session 25 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 615 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.00025 $0.00615
Opus 5 $0.00013 $0.00308
Sonnet 5 $0.00005 $0.00123
Haiku 4.5 $0.00003 $0.00061

Measured 3d ago against content hash 2bc94275d5a2, 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 3d ago.

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 · 81 lines

What it actually says

/debug — Systematic Debugging

Reproduce. Hypothesize. Test. Narrow. Fix. Never guess-and-check.

Step 0: Preamble

Run templates/PREAMBLE.md.

Step 1: Reproduce

Make the bug happen consistently:

# Run the failing test/command
# Capture the exact error output
# Note: environment, branch, recent changes

If you cannot reproduce: STOP. You cannot fix what you cannot see.

Step 2: Gather Evidence

# Recent changes that might have caused this
git log --oneline -10
# Files most recently modified
git diff --name-only HEAD~5
# Error logs
grep -r "Error\|Exception\|FAIL" logs/ 2>/dev/null | tail -20

Step 3: Generate Hypotheses

Based on evidence, generate up to $ARGUMENTS.max_hypotheses hypotheses:

| # | Hypothesis | Evidence For | Evidence Against | Test |
|---|-----------|-------------|-----------------|------|
| 1 | {cause} | {what supports this} | {what contradicts} | {how to verify} |
| 2 | ... | ... | ... | ... |

Rules:

  • Rank by likelihood (most likely first)
  • Each hypothesis must be testable
  • Each test must be quick (< 2 min)

Step 4: Test Hypotheses

For each hypothesis, starting with most likely:

  1. Design a test that would confirm or eliminate it
  2. Run the test
  3. Record: CONFIRMED or ELIMINATED
  4. If confirmed: proceed to fix
  5. If eliminated: move to next hypothesis

Step 5: Fix

Once root cause identified:

  1. Make the MINIMUM change to fix the bug
  2. Run the original reproduction to verify fix
  3. Write a regression test
  4. Check for similar bugs elsewhere (same pattern)

Agent References

  • Dispatch self-healer for automated fix attempt
  • Dispatch code-reviewer to verify fix quality
  • Dispatch test-architect to design regression test

Self-Eval

Run templates/SELF-EVAL-PROTOCOL.md:

  • Is the root cause identified with evidence? (not guessed)
  • Does the fix address the root cause? (not a symptom)
  • Is there a regression test?
  • Were similar bugs checked?
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. 3d ago First seen · 81 lines · 25 tokens per session scan A 2bc94275d5a2

Subscribe to this mod's changes

debug is a command published in the GitHub repository ShaheerKhawaja/ProductionOS (8 stars, last pushed 4mo ago), licensed MIT. It adds 25 tokens to every session and 615 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-31.