systematic-debugging
Comprehensive 4-phase debugging methodology for complex bugs. Use for bugs that aren't immediately obvious or have resisted quick fixes. Keywords: bug, error…
by VoDaiLocz★ 28 GitHub stars
Install systematic-debugging in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
🔍 Systematic Debugging Skill
Philosophy: Understand before you fix. Verify before you celebrate.
When to Use
Use this skill when:
- Bug is not immediately obvious
- Previous quick fixes have failed
- Error involves multiple components
- Need to ensure no regression from fix
- Production issue requiring careful handling
Do NOT use this skill when:
- Bug is trivial (typo, missing import)
- Just need a quick syntax check
- Issue is really a feature request
Prerequisites
Before starting:
- Have access to the codebase
- Can reproduce the bug OR have error logs
- Understand the expected behavior
- Know which environment is affected
Process
Phase 1: ROOT CAUSE INVESTIGATION 🔬
Goal: Find the TRUE cause, not just symptoms.
Steps:
Reproduce the Bug
Ask yourself: - Can I make this happen consistently? - What are the exact steps? - What input causes it?Gather Evidence
- Error messages (complete, not truncated)
- Stack traces
- Relevant logs
- Recent changes (git log, blame)
Trace the Flow
Start from: Error location Work backward: How did we get here? Find: Where does expected != actual?Identify the Root Cause
- Not "it crashed" but "WHY it crashed"
- Not "wrong output" but "WHAT produced wrong output"
Output: Clear statement of root cause.
Red Flags (STOP if you find yourself doing these):
- ❌ Immediately jumping to code changes
- ❌ Assuming you know the cause without evidence
- ❌ Changing things randomly hoping they'll work
- ❌ Ignoring the stack trace
Phase 2: PATTERN ANALYSIS 📊
Goal: Understand the shape of the problem.
Steps:
Scope Assessment
- Is this isolated or systemic?
- Does it affect other components?
- Has this happened before?
Similar Pattern Search
# Search for similar patterns in codebase grep -r "similar_pattern" src/Dependency Check
- What depends on the broken code?
- What does the broken code depend on?
Risk Assessment
- What could break if we fix this?
- Are there other places with same bug?
Output: Understanding of bug's scope and risk.
Phase 3: HYPOTHESIS & TESTING 🧪
Goal: Develop and test fix hypothesis.
Steps:
Form Hypothesis
"If I change X to Y, then Z should work because..."Good hypothesis includes:
- Specific change
- Expected outcome
- Reasoning
Design the Fix
- Minimal change principle
- Don't fix what isn't broken
- Consider edge cases
Mental/Paper Test
- Walk through the code with fix
- Does it address root cause?
- Any side effects?
Create Test Case
- Before implementing fix, write test that fails
- Test should pass after fix
- Include edge cases
Output: Tested hypothesis ready for implementation.
Phase 4: IMPLEMENTATION & VERIFICATION ✅
Goal: Apply fix and verify it works.
Steps:
Implement the Fix
- Apply minimal necessary changes
- Add comments explaining WHY (not just what)
- Follow project coding standards
Run Existing Tests
# All tests must pass npm test # or pytest, etc.Run New Test Case
- Test you wrote in Phase 3 should now pass
- Verify fix addresses root cause
Verify No Regression
- Related functionality still works
- No new errors introduced
- Performance not degraded
Documentation
- Update relevant docs if needed
- Consider adding to known issues/patterns
Output: Verified fix with passing tests.
Debugging Decision Tree
Bug Report Received
│
▼
┌─────────────────┐
│ Can reproduce? │
└────────┬────────┘
YES │ NO
│ └──► Gather more info, check logs, ask for steps
▼
┌─────────────────┐
│ Error obvious? │
└────────┬────────┘
YES │ NO
│ └──► Phase 1: Root Cause Investigation
▼
Quick fix
│
▼
┌─────────────────┐
│ Fix verified? │
└────────┬────────┘
YES │ NO
│ └──► Return to investigation
▼
Complete ✓
Guidelines
DO ✅
- Read the full stack trace
- Reproduce before fixing
- Change one thing at a time
- Test after each change
- Keep notes during investigation
- Ask "WHY" at least 3 times
DON'T ❌
- Assume you know the cause
- Make multiple changes at once
- Skip testing
- Ignore "unrelated" errors
- Rush to deploy fix
- Delete old code without understanding it
Common Patterns
Pattern: Off-by-One Error
When: Array/loop issues, boundary conditions
Detection:
- Works for most cases, fails at edges
- Index out of bounds errors
- Missing first/last item
Solution:
- Check
<vs<= - Check starting index (0 vs 1)
- Verify array length handling
Pattern: Async/Timing Issue
When: Race
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the systematic-debugging skill do?
Comprehensive 4-phase debugging methodology for complex bugs. Use for bugs that aren't immediately obvious or have resisted quick fixes. Keywords: bug, error, fix, debug, broken, crash, fail, exception
How do I install the systematic-debugging skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the systematic-debugging skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…