debug

A step-by-step debugging method that finds the underlying cause of a bug before changing code, then proves the fix with a regression test.

In plain words
What is it for?
Use it for bugs, crashes, and failing tests by collecting symptoms, tracing the code path, checking recent changes, reproducing the failure, and testing a cause-based fix.
Why use it?
It reduces guesswork and prevents symptom-only fixes that leave the original problem or create new ones.

Skill for Claude CodeCodex

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 skills/genai-io/san/debug
Any agent
npx skills add genai-io/san --skill debug
Clone the repo
git clone --depth 1 https://github.com/genai-io/san

Made for: Claude Code, Codex.

Per session 84 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 696 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.00084 $0.00696
Opus 5 $0.00042 $0.00348
Sonnet 5 $0.00017 $0.00139
Haiku 4.5 $0.00008 $0.00070

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

.san/personas/software-engineer/skills/debug/SKILL.md · 64 lines

How it starts

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

Debug: root cause before fix

The iron law: no fix without a root cause first. Patching a symptom you don't understand turns one bug into whack-a-mole — every blind fix makes the next bug harder to find. Find why it breaks, then fix that.

Phase 1: Investigate

Gather evidence before forming any hypothesis.

  1. Collect the symptoms. Read the exact error, stack trace, and the steps that trigger it. If you don't have enough to reproduce, ask the user one precise question at a time — don't guess your way forward.
  2. Trace the code path. From the symptom, work backward toward possible causes: Grep for the call sites, Read the logic. Understand what the code actually does before theorizing about why it's wrong.
  3. Check what changed. git log --oneline -20 -- <affected files> and read the recent diffs. If it worked before, the cause is almost certainly in a change — a regression narrows the search to the diff.
  4. Reproduce it deterministically. Get to a command or test that fails every time. If you can't reproduce it reliably, you don't yet understand it — gather more evidence before going further. An intermittent bug reproduced is half solved.

End Phase 1 with one sentence: "Root cause hypothesis: …" — a specific, testable claim about what is wrong and why, not a vague area of suspicion.

Phase 2: Test the hypothesis

  • Confirm the cause directly: a failing assertion, a log at the suspect line, a minimal snippet that isolates it. Prove the hypothesis before acting on it.
  • If the evidence contradicts the hypothesis, discard it and return to Phase 1. Do not bend the evidence to fit a theory you're attached to.
  • Lock scope to the module the root cause lives in. Resist "while I'm here" edits to unrelated code — they widen the blast radius and hide the real fix.

Phase 3: Fix and prove it

  1. Write a test that reproduces the bug and fails for the right reason.
  2. Make the smallest change that addresses the cause — not the symptom, not a nearby cleanup. If a proper fix is large or risky, present the options and ask.
  3. Run the new test (now green) and the surrounding suite (still green). The regression test stays, so this exact bug cannot come back silently.

Read the full file on GitHub · 64 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 · 64 lines · 84 tokens per session scan A b2557159d9e3

Subscribe to this mod's changes

debug is a skill published in the GitHub repository genai-io/san (75 stars, last pushed 5d ago), licensed Apache-2.0. It adds 84 tokens to every session and 696 once invoked, about $0.0004 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-30.