Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Systematically debug issues using a structured REPRO → GATHER → HYPOTHESIZE → TEST → FIX → VERIFY workflow. Use when diagnosing bugs, investigating failures, tracing errors, or troubleshooting unexpected behavior in code. Do NOT use when the issue is already identified and a fix is obvious, for code exploration without a specific problem, or for proactive code review.
.claude/skills/marco-souza-debug/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 50% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 72% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 72% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 70% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 74% | 0% |
Apply a systematic, repeatable workflow to diagnose and resolve bugs. Avoid guessing — every hypothesis must be grounded in evidence.
Follow these six stages in order. Do not skip ahead — each stage builds on the previous one.
Before investigating, confirm you can trigger the bug reliably.
Actions:
Commands:
bash# Run the specific failing test go test ./path/to/pkg -run TestFunctionName -v # Re-run the command that triggers the error <exact command the user reported> # Check recent commits that may have introduced the bug git log --oneline -10 -- <affected-file> # Record environment details go version git log --oneline -3
Checkpoint: You can reproduce the bug consistently before moving on.
Read the relevant code, logs, and context surrounding the failure.
Actions:
Commands:
bash# Read the file where the error occurs cat src/affected-file.ts # Trace imports and callers grep -rn "functionName" --include="*.ts" . # Check git blame for recent changes git log --oneline -5 -- src/affected-file.ts git blame src/affected-file.ts | head -40 # Find related tests grep -rn "TestFunctionName\|functionName" --include="*_test.go" . # Search for error handling around the area grep -B 5 -A 5 "errorMessage" src/affected-file.ts
Checkpoint: You understand what the code is doing, what it should do, and where the gap is.
Based on gathered evidence, propose possible root causes ranked by likelihood.
Actions:
Template:
markdown## Hypothesis 1 (Most Likely) - **Theory:** [description of suspected root cause] - **Evidence for:** [what you've observed that supports this] - **Evidence against:** [what contradicts this] - **How to test:** [specific action to confirm or rule out] ## Hypothesis 2 - **Theory:** [description] - **Evidence for:** [supporting observations] - **Evidence against:** [contradicting observations] - **How to test:** [specific action]
Checkpoint: You have at least one testable hypothesis with a clear verification step.
Run targeted experiments to confirm or eliminate each hypothesis.
Actions:
Commands:
bash# Add debug logging temporarily echo "DEBUG: variableName = $variableName" >&2 # Run with verbose output go test ./path -v -run TestName # Use a debugger or print statements to inspect state # Check intermediate values at key points in the code # If hypothesis is about a specific commit, test before/after git stash # revert changes go test ./... # does it pass? git stash pop # restore changes go test ./... # does it fail?
Checkpoint: You have confirmed the root cause through targeted testing.
Apply the minimal fix that addresses the confirmed root cause.
Actions:
Guidelines:
Validate that the bug is resolved and nothing else broke.
Actions:
Commands:
bash# Re-run the original failing test go test ./path/to/pkg -run TestFunctionName -v # Run the full test suite go test ./... # Run vet/lint to catch additional issues go vet ./... # Check for leftover debug code grep -rn "DEBUG\|TODO.*fix\|HACK" --include="*.go" .
Checkpoint: The bug no longer reproduces, all tests pass, and no debugging artifacts remain.
Scenario: TestUserCreate returns a nil pointer error.
REPRO:
bashgo test ./internal/user -run TestUserCreate -v # Output: panic: runtime error: invalid memory address # at user.Create(): user.go:42
GATHER:
bashcat internal/user/user.go | head -50 # Line 42: result.Email = input.Email # result is the return value of repository.FindByEmail() grep -rn "FindByEmail" --include="*.go" . # Found in internal/user/repository.go:28 cat internal/user/repository.go | sed -n '25,35p' # FindByEmail returns nil, nil when no user is found (correct behavior) # but caller doesn't check for nil before accessing .Email
HYPOTHESIS: The Create function calls FindByEmail to check for duplicates, but doesn't handle the nil-return case when no existing user is found.
TEST: Add a nil check before line 42 and re-run the test.
FIX: Add if result != nil { return nil, ErrAlreadyExists } before accessing result.Email.
VERIFY:
bashgo test ./internal/user -run TestUserCreate -v # passes go test ./internal/user/... -v # all user tests pass
Scenario: API returns 500 on POST /api/orders intermittently.
REPRO:
bashcurl -X POST localhost:3000/api/orders \ -H "Content-Type: application/json" \ -d '{"items": [{"id": 1, "qty": 1}]}' # {"error": "internal server error"} — fails ~30% of the time
GATHER:
bash# Check server logs tail -f logs/app.log | grep "order" # Intermittent: "ERROR: connection refused to database" # Check database connection pool config cat config/database.go | grep -A 5 "Pool" # MaxOpenConns: 5 (too low for production traffic) # Check for long-running queries grep -rn "SELECT" --include="*.go" src/order/ | head -10
HYPOTHESIS: The connection pool is exhausted under load, causing intermittent connection failures. The 30% failure rate matches peak traffic patterns.
TEST: Increase pool to 20 and load-test locally.
FIX: Update MaxOpenConns to 20 and add connection timeout config.
VERIFY:
bash# Load test ab -n 1000 -c 50 http://localhost:3000/api/orders # All requests return 200, no connection errors in logs
If the bug cannot be reproduced:
If the root cause is in a third-party library:
If several independent issues contribute to the bug:
a subagent for a second perspective
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 7,911 | 2,334 | -70% | 1 | 1 | 0% | 1,580 | 2,624 | +66% | 0 | 0 | — |
case-02 | fail→pass | 17,456 | 9,673 | -45% | 1 | 1 | 0% | 2,694 | 4,031 | +50% | 0 | 0 | — |
case-03 | fail→pass | 9,847 | 3,722 | -62% | 1 | 1 | 0% | 1,847 | 3,170 | +72% | 0 | 0 | — |
case-04 | fail→fail | 10,403 | 4,942 | -52% | 1 | 1 | 0% | 1,886 | 3,277 | +74% | 0 | 0 | — |
case-05 | pass→pass | 8,081 | 3,717 | -54% | 1 | 1 | 0% | 1,534 | 3,025 | +97% | 0 | 0 | — |
case-06 | fail→pass | 9,958 | 5,345 | -46% | 1 | 1 | 0% | 1,953 | 3,367 | +72% | 0 | 0 | — |
case-07 | fail→pass | 12,354 | 8,961 | -27% | 1 | 1 | 0% | 2,300 | 3,908 | +70% | 0 | 0 | — |
case-08 | pass→pass | 10,866 | 5,644 | -48% | 1 | 1 | 0% | 2,132 | 3,356 | +57% | 0 | 0 | — |
case-09 | pass→pass | 9,429 | 5,506 | -42% | 1 | 1 | 0% | 1,810 | 3,436 | +90% | 0 | 0 | — |
case-10 | pass→pass | 11,128 | 5,947 | -47% | 1 | 1 | 0% | 2,096 | 3,328 | +59% | 0 | 0 | — |
case-11 | pass→pass | 4,230 | 2,185 | -48% | 1 | 1 | 0% | 714 | 2,738 | +283% | 0 | 0 | — |
case-12 | pass→pass | 5,992 | 2,418 | -60% | 1 | 1 | 0% | 1,186 | 2,806 | +137% | 0 | 0 | — |
case-13 | pass→pass | 7,895 | 6,839 | -13% | 1 | 1 | 0% | 1,667 | 3,791 | +127% | 0 | 0 | — |
case-14 | pass→pass | 7,409 | 1,833 | -75% | 1 | 1 | 0% | 1,451 | 2,647 | +82% | 0 | 0 | — |
case-15 | fail→pass | 10,853 | 7,231 | -33% | 1 | 1 | 0% | 2,152 | 3,738 | +74% | 0 | 0 | — |
case-16 | pass→pass | 6,805 | 4,007 | -41% | 1 | 1 | 0% | 1,138 | 3,060 | +169% | 0 | 0 | — |
case-17 | pass→pass | 7,704 | 3,134 | -59% | 1 | 1 | 0% | 1,390 | 2,906 | +109% | 0 | 0 | — |
case-18 | pass→pass | 7,646 | 3,325 | -57% | 1 | 1 | 0% | 1,544 | 2,972 | +92% | 0 | 0 | — |
case-19 | pass→pass | 12,533 | 3,930 | -69% | 1 | 1 | 0% | 2,326 | 3,124 | +34% | 0 | 0 | — |
case-20 | fail→fail | 2,209 | 2,726 | +23% | 1 | 1 | 0% | 393 | 2,895 | +637% | 0 | 0 | — |
case-21 | pass→pass | 3,676 | 3,298 | -10% | 1 | 1 | 0% | 680 | 2,953 | +334% | 0 | 0 | — |
case-22 | pass→pass | 9,774 | 8,283 | -15% | 1 | 1 | 0% | 2,439 | 4,273 | +75% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +23 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.