Debug

Debug errors with systematic 6-step protocol. Paste error message or describe the bug.

RhythmMittal19 f1f649a 1.2 KB Updated

File contents

Error/Bug Report

$ARGUMENTS

Current State

!git branch --show-current 2>/dev/null !git diff --stat 2>/dev/null | head -10

Debugging Protocol — Follow these steps IN ORDER:

Step 1: Reproduce

  • Identify the exact trigger for the error
  • Note the full stack trace and error message

Step 2: Isolate

  • Use subagents to search for relevant code: the error source, related modules, tests
  • Identify the smallest possible scope where the bug lives

Step 3: Hypothesize

  • Form 2-3 hypotheses about root cause
  • List evidence for/against each

Step 4: Verify

  • Test the most likely hypothesis FIRST
  • Use targeted reads, not full-file scans
  • Check git blame if the code worked before: when did it break?

Step 5: Fix

  • Make the minimal change that fixes the root cause (not symptoms)
  • NEVER change code you don't understand hoping it fixes things

Step 6: Confirm

  • Run tests to verify the fix
  • Check for regressions in related functionality
  • Explain what caused the bug and why the fix works

IMPORTANT: If you've tried the same approach twice and it didn't work, STOP and try a fundamentally different strategy.

RhythmMittal19/claude-config/tree/main/skills/debug commit f1f649ac8e

Frequently asked questions

npx skillmds@latest add rhythmmittal19/debug