A 4-phase debugging workflow that ensures bugs are properly analyzed and reproduced before a fix is implemented.
Install
mkdir -p .claude/skills/debug-herbertjulio && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/19547" && unzip -o skill.zip -d .claude/skills/debug-herbertjulio && rm skill.zipInstalls to .claude/skills/debug-herbertjulio
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Use when encountering any bug, test failure, unexpected behavior, or error - before proposing fixes. Use especially when previous fix attempts have failed.Key capabilities
- →Gather error evidence and stack traces
- →Reproduce bugs through documented steps
- →Analyze execution paths and data flow
- →Formulate and rank hypotheses
- →Implement and verify bug fixes
How it works
The process follows a 4-phase methodology: gathering evidence, analyzing patterns, formulating hypotheses, and implementing verified fixes.
Inputs & outputs
When to use debug
- →Diagnose a failing test case
- →Reproduce an intermittent bug
- →Analyze stack traces for root causes
- →Compare broken code against known working modules
About this skill
/debug - Systematic Debugging
Investigate and fix the bug using 4-phase methodology.
Target: $ARGUMENTS
The 4 Phases
Phase 1 Phase 2 Phase 3 Phase 4
┌────────┐ ┌─────────┐ ┌───────────┐ ┌───────────┐
│ GATHER │─►│ ANALYZE │─►│ FORMULATE │─►│ IMPLEMENT │
│Evidence│ │ Patterns│ │ Hypothesis│ │ & Prove │
└────────┘ └─────────┘ └───────────┘ └───────────┘
Workflow
Phase 1: GATHER EVIDENCE
-
Read the error completely:
- Full error message
- Stack trace
- File and line numbers
-
Reproduce the bug:
- Document exact steps
- Confirm reproducible
-
Check recent changes:
git log --oneline -10 git diff HEAD~3 -
Search for related code:
grep -r "error message" .
Output:
## Evidence
Error: [full message]
Location: [file:line]
Stack trace: [trace]
Reproduction:
1. [step]
2. [step]
3. Error occurs
Recent changes:
- [commit]: [relevant change]
BLOCKED until evidence collected.
Phase 2: ANALYZE PATTERNS
-
Trace execution path:
- Entry point → Error location
- Data flow through system
-
Compare with working code:
- Find similar code that works
- Identify differences
-
Identify patterns:
- Consistent or intermittent?
- Data-dependent?
- Timing-dependent?
Output:
## Analysis
Execution: [entry] → [fn1] → [fn2] → [error]
Working vs Broken:
| Aspect | Working | Broken |
|--------|---------|--------|
| [X] | [value] | [value]|
Patterns:
- [pattern 1]
- [pattern 2]
BLOCKED until patterns identified.
Phase 3: FORMULATE HYPOTHESIS
-
Generate hypotheses:
- Multiple, not just one
- Based on evidence
-
Rank by probability:
- Which fits all evidence?
- Simplest explanation?
-
Design tests:
- How to prove/disprove each?
Output:
## Hypotheses
H1: [most likely] (80%)
Evidence for: [...]
Test: [how to verify]
H2: [second option] (15%)
Test: [how to verify]
BLOCKED until hypotheses formulated.
Phase 4: IMPLEMENT & PROVE
-
Test primary hypothesis:
- Execute minimal test
- Capture output
-
If confirmed:
- Write test that reproduces bug
- Implement fix
- Verify test passes
-
If rejected:
- Test next hypothesis
-
Create checkpoint:
git add -A && git commit -m "fix: [description]" git tag checkpoint/bugfix-[name]
Output:
## Resolution
Hypothesis: H1 - CONFIRMED ✓
Root Cause:
[Clear explanation]
Fix:
```diff
- [old code]
+ [new code]
Verification:
- Reproduction test: PASS ✓
- Existing tests: PASS ✓
## Three-Strike Rule
After 3 failed hypotheses:
⚠️ THREE STRIKES Re-evaluating understanding of the system. Looking for deeper architectural issues.
## Output
──── /debug ──── Bug: [description]
Phase 1: Evidence gathered ✓ Phase 2: Patterns identified ✓ Phase 3: Hypotheses formulated ✓ Phase 4: Fix implemented ✓
──── Debug Summary ──── Root cause: [explanation] Fix: [what changed] Checkpoint: checkpoint/bugfix-[name] Confidence: HIGH
## Anti-Rationalization
| Excuse | Reality |
|--------|---------|
| "I know the fix already" | You have a hypothesis, not a fix. Follow the phases. |
| "It's obviously this line" | Obvious fixes that skip investigation create new bugs. |
| "I'll just try this quickly" | Quick fixes without understanding cause regressions. |
| "Too slow to gather evidence" | Debugging without evidence takes 3x longer. |
| "The error message tells me everything" | Error messages are symptoms, not root causes. |
## Rules
1. **Never guess** - Evidence first
2. **Never fix without understanding** - Know the root cause
3. **Never skip phases** - Each prevents blind spots
4. **Always checkpoint** - Fixes must be reversible
When not to use it
- →When attempting to guess a fix without investigation
- →When skipping investigation phases
Prerequisites
Limitations
- →Blocked until evidence is collected
- →Blocked until patterns are identified
- →Blocked until hypotheses are formulated
How it compares
It mandates a structured, evidence-first approach rather than quick, unverified trial-and-error fixes.
Compared to similar skills
debug side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| debug (this skill) | 0 | 4mo | Review | Intermediate |
| python-testing-patterns | 77 | 2mo | Review | Intermediate |
| chrome-devtools | 41 | 6mo | Review | Intermediate |
| bats | 9 | 7mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
python-testing-patterns
wshobson
Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development. Use when writing Python tests, setting up test suites, or implementing testing best practices.
chrome-devtools
mrgoonie
Browser automation, debugging, and performance analysis using Puppeteer CLI scripts. Use for automating browsers, taking screenshots, analyzing performance, monitoring network traffic, web scraping, form automation, and JavaScript debugging.
bats
OleksandrKucherenko
Bash Automated Testing System (BATS) for TDD-style testing of shell scripts. Use when: (1) Writing unit or integration tests for Bash scripts, (2) Testing CLI tools or shell functions, (3) Setting up test infrastructure with setup/teardown hooks, (4) Mocking external commands (curl, git, docker), (5) Generating JUnit reports for CI/CD, (6) Debugging test failures or flaky tests, (7) Implementing test-driven development for shell scripts.
browser-daemon
noiv
Persistent browser automation via Playwright daemon. Keep a browser window open and send it commands (navigate, execute JS, inspect console). Perfect for interactive debugging, development, and testing web applications. Use when you need to interact with a browser repeatedly without opening/closing it.
performance-profiling
davila7
Performance profiling principles. Measurement, analysis, and optimization techniques.
obsidian-local-dev-loop
jeremylongshore
Configure Obsidian plugin development with hot-reload and fast iteration. Use when setting up development workflow, configuring test vaults, or establishing a rapid development cycle. Trigger with phrases like "obsidian dev loop", "obsidian hot reload", "obsidian development workflow", "develop obsidian plugin".