skills/debugging-and-error-recovery/SKILL.md
Use when tests fail, builds break, or behaviour doesn't match expectations. Use when you need a systematic approach to finding root cause instead of guessing.
npx skillsauth add paulund/skills debugging-and-error-recoveryInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Stop-the-Line Rule: When anything unexpected happens — STOP adding features. Preserve evidence. Follow this process in order.
REPRODUCE — make the failure happen reliably. If you can't reproduce it, you can't fix it with confidence.
npm test -- --grep "test name"LOCALIZE — narrow down which layer fails (UI / API / DB / build tooling / external service).
git bisect for regressions: git bisect start && git bisect bad && git bisect good <sha>REDUCE — create the minimal failing case.
FIX ROOT CAUSE — fix the underlying issue, not the symptom.
[...new Set(users)] in the UI. Root cause fix: the query has a JOIN that produces duplicatesGUARD — write a regression test specific to this failure.
VERIFY END-TO-END — run the full test suite, build, and a manual spot-check if applicable.
| Rationalization | Reality | |---|---| | "I know what the bug is, I'll just fix it" | You might be right 70% of the time. The other 30% costs hours. Reproduce first. | | "The failing test is probably wrong" | Verify that assumption. If the test is wrong, fix the test — don't skip it. | | "It works on my machine" | Environments differ. Check CI, config, and dependencies. | | "This is a flaky test, ignore it" | Flaky tests mask real bugs. Fix the flakiness or understand why it's intermittent. | | "I'll fix it in the next commit" | Fix it now. The next commit introduces new bugs on top of this one. |
After fixing a bug:
development
Use when implementing any logic, fixing any bug, or changing any behaviour. Use when you need to prove code works, when a bug report arrives, or when modifying existing functionality. Do NOT use for config changes, data migrations, or dependency updates.
development
Use when starting a new feature, when requirements are unclear, when asked to write code without a clear spec, or before any non-trivial implementation. Do NOT use for trivial bug fixes or one-line changes.
development
Use when you want authoritative, source-cited code free from outdated patterns. Use when building with any framework or library where correctness matters. Detects the stack from dependency files, fetches official documentation, implements following documented patterns, and cites sources for every framework-specific decision.
development
Use when preparing to ship a feature, release, or deployment. Use before merging to main, creating a release, or deploying to production. Do NOT use for CI-only changes or internal refactors that don't reach production.