debug

debug is a command for Claude Code from MadAppGang/magus. It costs 26 tokens per session (1,994 once invoked), scanned A, original, MIT.

A debugging command that chooses between a quick patch, a structured investigation, and a production-grade test-driven fix. It can locate faults using error traces, keywords, or code structure.

In plain words
What is it for?
Use it to investigate errors, trace likely causes, detect the relevant project stack, apply fixes, and verify larger fixes with tests.
Why use it?
It removes the need to decide manually how much debugging process a problem deserves. It can also escalate a simple investigation when the problem turns out to be more complex.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md; names the AskUserQuestion tool.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the dev plugin — 19 skills, 15 commands, 12 agents shipped together

Good fit Use it to investigate errors, trace likely causes, detect the relevant project stack, apply fixes, and verify larger fixes with tests.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add MadAppGang/magus
Claude Code
/plugin install dev

Made for: Claude Code.

Or install dev, the plugin that ships this one along with the rest of its 19 skills, 15 commands, 12 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for debug

README.md
[![agentmods](https://agentmods.dev/badge/commands/madappgang/magus/debug/github.svg)](https://agentmods.dev/commands/madappgang/magus/debug)
Your own site
<a href="https://agentmods.dev/commands/madappgang/magus/debug"><img src="https://agentmods.dev/badge/commands/madappgang/magus/debug/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for debug

Your own site · 80×15
<a href="https://agentmods.dev/commands/madappgang/magus/debug"><img src="https://agentmods.dev/badge/commands/madappgang/magus/debug.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 26 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,994 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00026 $0.01994
Opus 5.5 $0.00010 $0.00798
Sonnet 5.5 $0.00005 $0.00399
Haiku 4.5 $0.00003 $0.00199

Measured 2mo ago against content hash 0a825dcb0e66, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo 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.

plugins/dev/commands/debug.md · 188 lines

How it starts

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

<user_request> $ARGUMENTS </user_request>

<value_banner> Display ONCE at the start of the command:

/dev:debug — Structured Debugging Workflow Beyond what Claude does natively, this command adds:

  • 3 depth levels: quick patch / systematic 6-phase debug / production-grade TDD fix
  • Fault localization with stack trace, keyword, and AST strategies
  • Auto-inference detects the right depth from your description
  • Escalation: quick-patch auto-upgrades when complexity grows

For quick debugging, just ask Claude directly. </value_banner>

<critical_override> THIS COMMAND OVERRIDES THE CLAUDE.md TASK ROUTING TABLE FOR AGENT SELECTION.

Routing rules for this command only:

  • Stack detection → dev:stack-detector agent
  • Error analysis → dev:debugger agent (standard debug path only, via skill)
  • Applying fixes → dev:developer agent

QUICK-PATCH: root cause analysis is INLINE (no agent delegation) DO NOT use code-search:analyze (READ-ONLY agent, not for fixing) </critical_override>

<scope_selection> MANDATORY: Determine debugging scope before starting.

Auto-inference rules (skip the question when any of these match):

  • Stack trace present + single file mentioned → Quick patch
  • Keywords: "production", "critical", "intermittent", "uncertain root cause" → /dev:fix
  • Keywords: "root cause", "investigate first", "systematic" → Standard debug
  • Simple error message with obvious single-location cause → Quick patch
  • --downgrade flag in $ARGUMENTS → Standard debug (bypass all inference)
  • Default (none of the above): Ask user

If auto-inference cannot determine scope, use AskUserQuestion with these options:

  • Quick patch: "Fast: stack trace → inline analysis → patch. Auto-escalates if scope grows."
  • Standard debug: "Thorough: reproduce → localize (3 strategies) → root cause → patch → validate"
  • Production-grade fix: "Full TDD + multimodel review. Run /dev:fix for this depth."

Decision:

  • "Quick patch" → execute the Quick-Patch Workflow below
  • "Standard debug" → load dev:systematic-debugging and follow workflow.md exactly
  • "Production-grade fix" → output: "Scope: Production-grade fix. Run /dev:fix {bug description} for the full TDD + review workflow." then STOP </scope_selection>

<quick_patch_workflow> Execute this workflow inline when scope = Quick patch.

Phase 0: Initialize

  • Follow dev:systematic-debugging → session-setup.md for session setup (prefix: "dev-debug-quickfix")
  • Parse flags from $ARGUMENTS:
    • --review: opt-in multimodel patch quality vote at Phase 4
    • --tdd: write RED test before applying patch
    • --interactive: approval gate before PATCH phase

Phase 1: REPRODUCE

  • Use context from session-setup.md
  • If reproduction steps were provided in $ARGUMENTS, attempt reproduction via Bash
  • Document reproduction result in session

Phase 2: LOCALIZE (Strategy A — stack trace first)

  • If stack trace present: extract file:line with Grep, Read ±20 lines of surrounding context
  • If no stack trace: fall back to keyword search across codebase with Grep
  • Write localization.md to session directory

Escalation check #1: if candidates span > 3 files → offer upgrade to Standard debug

Phase 3: PLAN (inline root cause — no agent delegation)

  • Perform root cause analysis directly in this context
  • Generate: hypothesis, fix approach, files to modify
  • Self-critique checklist:
    • MINIMAL_CHANGE: is the fix as small as possible?
    • ROOT_CAUSE_NOT_SYMPTOM: does this fix the cause, not mask it?
    • REGRESSION_SAFETY: what existing behavior could break?
    • TEST_COVERAGE: is there a test that would catch this?
    • REGRESSION_RISK: LOW / MEDIUM / HIGH
    • COMPETING_HYPOTHESES: YES / NO
  • Write root-cause.md to session directory

Read the full file on GitHub · 188 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. 2mo ago Changed · -1 lines 0a825dcb0e66
  2. 2mo ago Changed e48d4451c808
  3. 2mo ago First seen · 189 lines · 26 tokens per session scan A a6ceda4bba87

Subscribe to this mod's changes

debug is a command published in the GitHub repository MadAppGang/magus (16 stars, last pushed today), licensed MIT. It adds 26 tokens to every session and 1,994 once invoked, about $0.0001 per session on Opus 5.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-09-04.

Related

debug compared with commands from other repositories

debug next to 6 commands from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
debugMadAppGang/magusCommand16todayMITA26Claude Code
qa-changesOpenHands/extensionsCommand190todayMITA63Claude Code
auditar-cascadingluanpdd/kit-mcpCommand5yesterdayMITA54Claude Code
react-nativegetsentry/toolkitCommand977yesterdaynoneA0Claude Code
doctordoncheli/don-cheli-sddCommand593mo agoApache-2.0A76Claude Code
doctorfatihkan/badiCommand81mo agoMITA0Claude Code
fixstefan-jansen/claude-code-toolkitCommand1014mo agoMITA9Claude Code