debug

A debugging command that uses a step-by-step process to find the cause of a software bug. It compares expected and actual behavior using errors, logs, code history, and targeted investigation.

In plain words
What is it for?
Use it to reproduce a problem, inspect recent changes, narrow down the faulty code with tools such as git bisect, and verify the fix.
Why use it?
It prevents random fixes and helps distinguish the underlying cause from symptoms or follow-on errors.

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/versoxbt/claude-initial-setup/debug
Clone the repo
git clone --depth 1 https://github.com/VersoXBT/claude-initial-setup
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 511 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.00009 $0.00511
Opus 5 $0.00005 $0.00255
Sonnet 5 $0.00002 $0.00102
Haiku 4.5 $0.00001 $0.00051

Measured yesterday against content hash 4f9dd7c1d6b1, 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.

commands/debug.md · 69 lines

How it starts

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

Systematic Debugging

Follow a structured approach to identify, isolate, and fix bugs efficiently.

Steps

  1. Reproduce the issue:

    • Identify the exact steps, inputs, or conditions that trigger the bug.
    • Confirm the issue is reproducible and not intermittent.
    • Note the expected behavior versus the actual behavior.
  2. Gather evidence:

    • Read error messages, stack traces, and log output carefully.
    • Check recent changes to see if the bug was introduced recently.
    • Identify the affected files and functions from the stack trace.
    git log --oneline -20
    git diff
    
  3. Form a hypothesis:

    • Based on the evidence, propose what is causing the bug.
    • Write down the hypothesis before investigating further.
  4. Isolate the root cause:

    • Use binary search / bisect to narrow down the problem area.
    • If recent regression: use git bisect to find the offending commit.
    • If logic error: add targeted logging or use a debugger to trace execution flow.
    • Verify assumptions — check that inputs, state, and dependencies are what you expect.
    git bisect start
    git bisect bad HEAD
    git bisect good <known-good-commit>
    
  5. Validate the hypothesis:

    • Confirm the root cause matches the observed behavior.
    • If the hypothesis is wrong, return to step 3 with new evidence.
  6. Implement the fix:

    • Fix the root cause, not just the symptom.
    • Use immutable patterns — do not mutate existing objects.
    • Keep the fix minimal and focused.
  7. Verify the fix:

    • Reproduce the original steps — the bug should no longer occur.
    • Run the full test suite to check for regressions.
    • Write a test that would have caught this bug to prevent recurrence.
  8. Check for related issues:

    • Search the codebase for similar patterns that may have the same bug.
    • Fix any related occurrences found.

If the Bug Cannot Be Reproduced

  • Check environment differences (OS, Node version, database state).
  • Review logs from the environment where the bug occurred.
  • Add additional logging to capture more context for next occurrence.

Read the full file on GitHub · 69 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 · 69 lines · 9 tokens per session scan A 4f9dd7c1d6b1

Subscribe to this mod's changes

debug is a command published in the GitHub repository VersoXBT/claude-initial-setup (4 stars, last pushed 3mo ago), licensed MIT. It adds 9 tokens to every session and 511 once invoked, about $0.0000 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.