Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use this skill when debugging code, diagnosing unexpected behavior, troubleshooting errors, or approaching a problem systematically. Trigger on keywords: debug, bug, error, not working, unexpected behavior, troubleshoot, investigate, root cause, why is this, something is wrong, failing test, crash.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-15 | ✓→✗ | ▼ Worse | 62% | 0% |
| case-18 | ✓→✓ | = Same ✓ | 25% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 20% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 36% | 0% |
| case-06 | ✓→✓ | = Same ✓ | 26% | 0% |
Debug the system, not your assumptions.
Most bugs persist because developers debug what they think is happening instead of what's actually happening. Every assumption is a potential hiding place for a bug.
1. OBSERVE — What exactly is the symptom? (not interpretation, raw facts)
2. HYPOTHESIZE — What are the possible causes?
3. TEST — Design the smallest possible test to confirm/deny each hypothesis
4. CONCLUDE — What does the evidence tell you?
5. FIX — Address the root cause, not the symptom
6. VERIFY — Confirm the fix works and nothing else broke
7. PREVENT — Add a test that would catch this regressionNever skip step 7. Every bug is a test that doesn't exist yet.
Before writing a single line of debug code, answer these:
Answering these five questions often reveals the bug before you even look at code.
For complex bugs in large codebases:
1. Identify the full path of execution involved
2. Pick the midpoint
3. Add a check there — does the data look correct?
4. If yes → bug is in second half. If no → bug is in first half.
5. Repeat until you've narrowed to a single function or line.This is binary search for bugs. Cuts debugging time in half at each step.
Most developers skim error messages. Read them:
For cryptic errors: paste the exact error into the AI with context, not a paraphrase.
| Pattern | Signs | Fix | |---|---|---| | Off-by-one | Wrong count, first/last element skipped | Check loop bounds and index math | | Null / undefined | "Cannot read property of undefined" | Add null guards, check API contracts | | Async/await | Data appears empty, timing-sensitive | Ensure every async call is awaited | | Stale state | Works sometimes, not always | Check state mutation, cache invalidation | | Type mismatch | Unexpected behavior with numbers/strings | Check types explicitly, don't trust coercion | | Environment diff | Works locally, fails in prod | Check env vars, dependency versions, OS differences | | Race condition | Fails under load, works in isolation | Add locks, use atomic operations, review shared state |
Explain the bug out loud (to a rubber duck, a colleague, or an AI) as if they know nothing:
The act of explaining forces you to examine every assumption. 60-70% of the time, you find the bug while explaining — before anyone responds.
After 20-30 minutes without progress:
Context: [what the code is doing]
Expected: [what should happen]
Actual: [what is happening — exact error/output]
Tried: [what you've already attempted]
Suspicion: [your current best hypothesis] fix(auth): handle null session on token refresh
Previously crashed when session expired during token refresh. Root cause: session.user was null after expiry but code assumed it was always present. Added null guard and redirect to login.
Other measured skills in the registry, with their headline benchmark lift.