Skills

Systematic Debugging

4-phase root cause analysis: observe, hypothesize, verify, fix.

Install

npx skills add SethGammon/Citadel --skill systematic-debugging -g -a claude-code -y
Repository
SethGammon/Citadel927
Category
Testing
Updated
5d ago
License
MIT
Context cost
Lightabout 1,252 tokens
Runs scripts
No, instructions only

What it does

4-phase root cause analysis: observe, hypothesize, verify, fix. Enforces investigation before any code changes. Emergency stop after 2 failed fixes. Prevents shotgun debugging and fix cascades.

/systematic-debugging, Root Cause Before Fix

Orientation

Use when: root cause is unknown and premature fixes keep failing -- enforces observe -> hypothesize -> verify before touching code. Don't use when: root cause is already known (use /marshal to implement the fix); the bug is shallow and the stack trace is enough (use /do).

Protocol

Phase 1: OBSERVATION & REPRODUCTION

  1. Read the error message, stack trace, or bug description
  2. Reproduce the issue:
    • If it's a type error: run typecheck and read the full error
    • If it's a runtime error: identify the triggering conditions
    • If it's a behavioral bug: document expected vs actual behavior
  3. Isolate the failing component/function:
    • What file? What function? What line?
    • What are the inputs when it fails?
    • Does it fail consistently or intermittently?

Output: A clear problem statement: "{Component} does {X} when it should do {Y}, triggered by {condition}"

Phase 2: HYPOTHESIS & VERIFICATION

  1. Formulate up to 3 hypotheses for WHY the bug exists:

    • H1: {most likely cause}, because {evidence}
    • H2: {second candidate}, because {evidence}
    • H3: {third candidate}, because {evidence}
  2. For each hypothesis, define a verification step:

    • Add a console.log / diagnostic read / breakpoint
    • Check a specific value at a specific point
    • DO NOT change any logic yet, only observe
  3. Run the verification:

    • Which hypothesis was confirmed?
    • Which were eliminated?
    • If none confirmed: formulate new hypotheses with the new information

CRITICAL: Do not skip this phase. Do not "just try" a fix. Verify first.

Phase 3: ROOT CAUSE ANALYSIS

Once a hypothesis is confirmed:

Read the whole SKILL.md on GitHub

More in Testing