debug

A command for diagnosing errors or unexpected software behavior before attempting a fix.

In plain words
What is it for?
Use it for failing tests, broken builds, regressions, and problems in the user interface, backend, database, build tools, external services, or tests themselves.
Why use it?
It provides a step-by-step investigation that preserves evidence, identifies the failing part, fixes the underlying cause, and verifies the result.

Command

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/juanmhidalgo/claude-plugins/debug
Clone the repo
git clone --depth 1 https://github.com/juanmhidalgo/claude-plugins
Per session 31 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 901 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.00031 $0.00901
Opus 5 $0.00015 $0.00451
Sonnet 5 $0.00006 $0.00180
Haiku 4.5 $0.00003 $0.00090

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

debug/commands/debug.md · 127 lines

How it starts

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

Context

  • Branch: !git branch --show-current
  • Recent commits: !git log --oneline -10

<best_practices> @debug/skills/debugging-strategies/SKILL.md </best_practices>

Systematic Debugging Workflow

Error or failing behavior: $ARGUMENTS

Follow the Stop-the-Line Rule. Do NOT add new features or push past failures.

Step 1: Reproduce

Make the failure happen reliably. If you can't reproduce it, you can't fix it with confidence.

  • Run the specific failing test or trigger the error
  • If intermittent: check for timing, environment, or state dependencies
  • If can't reproduce: gather more context (logs, environment details, minimal environment)
  • Document exact reproduction steps

Step 2: Localize

Narrow down WHERE the failure happens:

Which layer is failing?
├── UI/Frontend     → Check console, DOM, network tab
├── API/Backend     → Check server logs, request/response
├── Database        → Check queries, schema, data integrity
├── Build tooling   → Check config, dependencies, environment
├── External service → Check connectivity, API changes, rate limits
└── Test itself     → Check if the test is correct (false negative)

For regressions, use git bisect to find the introducing commit:

git bisect start
git bisect bad
git bisect good <known-good-sha>
git bisect run <test-command>

Step 3: Reduce

Create the minimal failing case:

  • Remove unrelated code/config until only the bug remains
  • Simplify input to the smallest example that triggers the failure
  • A minimal reproduction makes the root cause obvious

Step 4: Root Cause

Fix the underlying issue, NOT the symptom.

Ask "why does this happen?" until you reach the actual cause. Example:

  • Symptom: "User list shows duplicates"
  • Symptom fix (bad): [...new Set(users)] in the UI
  • Root cause fix (good): The API JOIN produces duplicates → fix the query

Step 5: Guard

Write a regression test that:

  • Fails without the fix
  • Passes with the fix
  • Covers the specific scenario that caused the bug

Read the full file on GitHub · 127 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. 2d ago First seen · 127 lines · 31 tokens per session scan A 0efea248a1eb

Subscribe to this mod's changes

debug is a command published in the GitHub repository juanmhidalgo/claude-plugins (8 stars, last pushed 7d ago), licensed MIT. It adds 31 tokens to every session and 901 once invoked, about $0.0002 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.