debug

debug is a command for Claude Code from halflength-ampleness75/claude-code-recipes. It costs 16 tokens per session (931 once invoked), scanned A, original, MIT.

A step-by-step method for investigating unexpected software behaviour. It starts by clarifying the report, reproducing the problem, isolating its cause, fixing it, checking the result, and adding a test to prevent recurrence.

In plain words
What is it for?
Use it for reported bugs, failing features, and unexplained results in a codebase. It searches relevant code, checks existing tests, and can create a small failing test when possible.
Why use it?
It replaces guesswork with evidence and makes sure a fix is verified rather than assumed. A regression test records the failure so the same bug is less likely to return.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution. Also seen: model in frontmatter.

Good fit Use it for reported bugs, failing features, and unexplained results in a codebase. It searches relevant code, checks existing tests, and can create a small failing test when possible.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/halflength-ampleness75/claude-code-recipes/debug
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.

Clone the repo
git clone --depth 1 https://github.com/halflength-ampleness75/claude-code-recipes

Made for: Claude Code.

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/halflength-ampleness75/claude-code-recipes/debug/github.svg)](https://agentmods.dev/commands/halflength-ampleness75/claude-code-recipes/debug)
Your own site
<a href="https://agentmods.dev/commands/halflength-ampleness75/claude-code-recipes/debug"><img src="https://agentmods.dev/badge/commands/halflength-ampleness75/claude-code-recipes/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/halflength-ampleness75/claude-code-recipes/debug"><img src="https://agentmods.dev/badge/commands/halflength-ampleness75/claude-code-recipes/debug.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 931 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.00016 $0.00931
Opus 5.5 $0.00006 $0.00372
Sonnet 5.5 $0.00003 $0.00186
Haiku 4.5 $0.00002 $0.00093

Measured 1mo ago against content hash d3a228cc1183, 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 1mo 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.

commands/debug.md · 96 lines

How it starts

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

You are an expert debugger. The user will describe a bug or unexpected behavior in $ARGUMENTS. Follow a rigorous, systematic debugging process. Do not guess — gather evidence at every step.

Phase 1 — Understand the Bug Report

Parse the user's description and clarify:

  • Observed behavior: What is actually happening?
  • Expected behavior: What should happen instead?
  • Reproduction steps: How to trigger the bug (if provided)
  • Environment: OS, runtime version, browser, relevant config (if mentioned)
  • Frequency: Always, intermittent, or only under specific conditions?

If critical information is missing, ask the user before proceeding. Do not assume.

Phase 2 — Reproduce the Issue

Attempt to reproduce the bug:

  1. Search the codebase for the relevant code paths mentioned in the bug report. Use grep to find error messages, function names, or UI text the user referenced.
  2. Read the relevant source files to understand the intended flow.
  3. If there is a test suite, check whether existing tests cover the failing scenario. Run them.
  4. If possible, write a minimal failing test that demonstrates the bug. This test should:
    • Pass when the bug is fixed
    • Fail right now, proving the bug exists
    • Be as small and focused as possible

If you cannot reproduce the issue, explain what you tried and ask the user for more information.

Phase 3 — Isolate the Root Cause

Use a divide-and-conquer strategy:

  1. Trace the data flow. Start from the entry point (API handler, event listener, UI callback) and follow the data through each function call. Read every file in the chain.
  2. Identify the divergence point. Where does actual behavior first differ from expected behavior? Look for:
    • Incorrect conditional logic
    • Wrong variable being used (typo, shadowing, stale closure)
    • Missing or incorrect type coercion
    • Race condition or ordering issue
    • Off-by-one errors in loops or slicing
    • Incorrect assumptions about external data shape
    • Unhandled null/undefined/None
  3. Check recent changes. Run git log --oneline -20 -- <file> on suspicious files to see if a recent commit introduced the regression.
  4. Verify your hypothesis. Before claiming a root cause, confirm it explains ALL symptoms described by the user. If it only explains some, keep looking.

Read the full file on GitHub · 96 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. 1mo ago First seen · 96 lines · 16 tokens per session scan A d3a228cc1183

Subscribe to this mod's changes

debug is a command published in the GitHub repository halflength-ampleness75/claude-code-recipes (2 stars, last pushed 4d ago), licensed MIT. It adds 16 tokens to every session and 931 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-08-31.