Use when investigating bugs, diagnosing issues, or understanding unexpected behavior. Provides systematic approaches to finding root causes.
View on GitHubSelect agents to install to:
npx add-skill https://github.com/TheBushidoCollective/han/blob/main/core/skills/debugging/SKILL.md -a claude-code --skill debuggingInstallation paths:
.claude/skills/debugging/# Debugging Skill Systematic approaches to investigating and diagnosing bugs. ## Core Principle **Understand before fixing.** A proper diagnosis leads to a proper fix. ## The Scientific Method for Debugging ### 1. Observe **Gather all the facts:** - What's the symptom? (What's happening that shouldn't?) - When does it happen? (Always, sometimes, specific conditions?) - Who's affected? (All users, some users, specific scenarios?) - Error messages? (Exact text, stack traces, error codes?) - Recent changes? (What changed before this started?) **Evidence to collect:** - Error messages and stack traces - Application logs - User reports - Reproduction steps - Environment details (browser, OS, versions) - Network requests/responses - Database query logs ### 2. Form Hypothesis **Based on symptoms, what could cause this?** **Common categories:** - **Logic error:** Code does wrong thing - **State management:** State gets out of sync - **Async/timing:** Race condition, callback hell - **Data issue:** Unexpected input format - **Integration:** API change, service down - **Environment:** Config, permissions, network - **Resource:** Memory leak, connection pool exhausted **Prioritize hypotheses:** 1. Most likely causes first 2. Easiest to test first (when equal likelihood) 3. Most impactful if true ### 3. Test Hypothesis **Design experiment to prove/disprove:** - Add logging to see values - Add breakpoints to pause execution - Modify input to isolate variable - Disable feature to rule out - Compare with working version **Keep notes:** ```markdown **Hypothesis:** Database query timeout **Test:** Add query timing logs **Result:** Query completes in 50ms **Conclusion:** Not the database ❌ **Hypothesis:** Network latency **Test:** Check network tab, add timing **Result:** API call takes 5 seconds **Conclusion:** Found the issue ✅ ``` ### 4. Analyze Results **What did you learn?** - Hypothesis confirmed or rejected? - New questions raised? - Unexpected findings