debugging
Systematic root-cause debugging: reproduce, investigate, hypothesize, fix with verification. Use when asked to "debug this", "fix this bug", "why is this failing", "troubleshoot", or mentions errors, stack traces, broken tests, flaky tests, regressions, or unexpected behavior.
Install
npx skills add https://github.com/iliaal/whetstone/tree/master/distillery/generated-skills/debugging
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install iliaal-whetstone@llmmart
git clone https://github.com/iliaal/whetstone.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole iliaal/whetstone collection as a plugin from our marketplace. Git is the plain clone.
Skill manifest
Debugging
The Iron Law
Never propose a fix without first identifying the root cause. "Quick fix now, investigate later" is forbidden — it creates harder bugs.
Process
1. Reproduce — make the bug consistent. If intermittent, run N times under stress or simulate poor conditions (slow network, low memory) until it triggers reliably.
2. Investigate — trace backward through the call chain from the symptom. Add diagnostic logging at each component boundary. Compare working vs broken state using a differential table (environment, version, data, timing — what changed?).
3. Hypothesize and test — one change at a time. If a hypothesis is wrong, fully revert before testing the next. Use git bisect to find regressions efficiently.
4. Fix and verify — create a failing test FIRST, then fix. Run the test. Confirm the original reproduction case passes. No completion claims without fresh verification evidence.
Three-Fix Threshold
After 3 failed fix attempts, STOP. The problem is likely architectural, not a surface bug. Step back and question assumptions about how the system works. Read the actual code path end-to-end instead of spot-checking.
Escalation: Competing Hypotheses
When the cause is unclear across multiple components, use Analysis of Competing Hypotheses:
- Generate hypotheses across failure modes: logic error, data issue, state problem, integration failure, resource exhaustion, environment
- Investigate each with evidence: Direct (strong), Correlational (medium), Testimonial (weak)
- Cite evidence with
file:linereferences - Rank by confidence. If multiple hypotheses are equally supported, suspect compound causes.
Intermittent Issues
- Track with correlation IDs across distributed components
- Race conditions: look for shared mutable state, check-then-act patterns, missing locks
- Resource exhaustion: monitor memory growth, connection pool depletion, file descriptor leaks
- Timing-dependent: replace arbitrary
sleep()with condition-based polling — wait for the actual state, not a duration
Defense-in-Depth Validation
After fixing, validate at every layer — not just where the bug appeared:
- Entry: does invalid input get caught?
- Business logic: does the fix handle edge cases?
- Environment: does it work across configurations?
- Instrumentation: add logging to detect recurrence
Bug Triage
When multiple bugs exist, prioritize by:
- Severity (data loss > crash > wrong output > cosmetic) separately from Priority (blocking release > customer-facing > internal)
- Reproducibility: always > sometimes > once. "Sometimes" bugs need instrumentation before fixing.
- Quick wins: if a fix is < 5 minutes and unblocks others, do it first
Common Patterns
- Null/undefined access — trace where the value was expected to be set, check all code paths
- Off-by-one — check
<vs<=, array length vs last index, loop boundaries - Async ordering — missing
await, unhandled promise rejection, callback firing before setup completes - Type coercion —
==vs===, string-to-number conversion, truthy/falsy edge cases - Timezone — always store UTC, convert at display. Check DST transitions.
Anti-Patterns
- Shotgun debugging (random changes without hypothesis) — revert and think instead
- Multiple simultaneous changes — isolate each change or you can't learn what worked
- Fixing the symptom not the cause — the same bug will resurface differently
- Ignoring intermittent failures ("works on my machine") — instrument and reproduce under load instead
Files (whetstone)
-
manifest.json 1 KB
{ "query": "debugging", "search_queries": [ "debugging", "debug troubleshoot fix bugs" ], "generated": "2026-02-13", "token_count": 1036, "sources": [ { "id": "obra/superpowers/systematic-debugging", "installs": 6345, "sha1": "d5e4c57573966f4dcc6a0cdd64316cec9b221440" }, { "id": "wshobson/agents/debugging-strategies", "installs": 2993, "sha1": "de786c301e9801a632697ea47a33da4e8d094986" }, { "id": "wshobson/agents/parallel-debugging", "installs": 1529, "sha1": "1607060dfcb8932c683b50c2275c6c31c3010dab" }, { "id": "jeffallan/claude-skills/debugging-wizard", "installs": 286, "sha1": "da2d1c39951cc2c6ce93e8bfd220cc9909e38f40" }, { "id": "mrgoonie/claudekit-skills/debugging", "installs": 380, "sha1": "6891ddb858bf4b3cf01c14a53cbd06ba751cd010" }, { "id": "davila7/claude-code-templates/systematic-debugging", "installs": 140, "sha1": "d5e4c57573966f4dcc6a0cdd64316cec9b221440" } ] } -
SKILL.md 3.9 KB
--- name: debugging description: >- Systematic root-cause debugging: reproduce, investigate, hypothesize, fix with verification. Use when asked to "debug this", "fix this bug", "why is this failing", "troubleshoot", or mentions errors, stack traces, broken tests, flaky tests, regressions, or unexpected behavior. --- # Debugging ## The Iron Law Never propose a fix without first identifying the root cause. "Quick fix now, investigate later" is forbidden — it creates harder bugs. ## Process **1. Reproduce** — make the bug consistent. If intermittent, run N times under stress or simulate poor conditions (slow network, low memory) until it triggers reliably. **2. Investigate** — trace backward through the call chain from the symptom. Add diagnostic logging at each component boundary. Compare working vs broken state using a differential table (environment, version, data, timing — what changed?). **3. Hypothesize and test** — one change at a time. If a hypothesis is wrong, fully revert before testing the next. Use `git bisect` to find regressions efficiently. **4. Fix and verify** — create a failing test FIRST, then fix. Run the test. Confirm the original reproduction case passes. No completion claims without fresh verification evidence. ## Three-Fix Threshold After 3 failed fix attempts, STOP. The problem is likely architectural, not a surface bug. Step back and question assumptions about how the system works. Read the actual code path end-to-end instead of spot-checking. ## Escalation: Competing Hypotheses When the cause is unclear across multiple components, use Analysis of Competing Hypotheses: - Generate hypotheses across failure modes: logic error, data issue, state problem, integration failure, resource exhaustion, environment - Investigate each with evidence: Direct (strong), Correlational (medium), Testimonial (weak) - Cite evidence with `file:line` references - Rank by confidence. If multiple hypotheses are equally supported, suspect compound causes. ## Intermittent Issues - Track with correlation IDs across distributed components - Race conditions: look for shared mutable state, check-then-act patterns, missing locks - Resource exhaustion: monitor memory growth, connection pool depletion, file descriptor leaks - Timing-dependent: replace arbitrary `sleep()` with condition-based polling — wait for the actual state, not a duration ## Defense-in-Depth Validation After fixing, validate at every layer — not just where the bug appeared: - **Entry**: does invalid input get caught? - **Business logic**: does the fix handle edge cases? - **Environment**: does it work across configurations? - **Instrumentation**: add logging to detect recurrence ## Bug Triage When multiple bugs exist, prioritize by: - **Severity** (data loss > crash > wrong output > cosmetic) separately from **Priority** (blocking release > customer-facing > internal) - Reproducibility: always > sometimes > once. "Sometimes" bugs need instrumentation before fixing. - Quick wins: if a fix is < 5 minutes and unblocks others, do it first ## Common Patterns - **Null/undefined access** — trace where the value was expected to be set, check all code paths - **Off-by-one** — check `<` vs `<=`, array length vs last index, loop boundaries - **Async ordering** — missing `await`, unhandled promise rejection, callback firing before setup completes - **Type coercion** — `==` vs `===`, string-to-number conversion, truthy/falsy edge cases - **Timezone** — always store UTC, convert at display. Check DST transitions. ## Anti-Patterns - Shotgun debugging (random changes without hypothesis) — revert and think instead - Multiple simultaneous changes — isolate each change or you can't learn what worked - Fixing the symptom not the cause — the same bug will resurface differently - Ignoring intermittent failures ("works on my machine") — instrument and reproduce under load instead
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.