debugging-and-error-recovery
What it does
This guide helps you find and fix computer program errors in an organized way. It teaches you to stop, investigate the root cause, and then fix it, avoiding guesswork.
When to use it
- βWhen a test fails after a change.
- βWhen the program stops working unexpectedly.
- βWhen you don't know why something went wrong.
Skill link
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/debugging-and-error-recovery/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βMy code is giving a strange error I can't figure out, can you help me investigate?β
5 new skills a week. 1 minute to read.
How it works
It suggests following steps like reproducing the error, finding where it happens, simplifying the problem, and then fixing the real cause. Finally, it asks to add a test to prevent the error from returning.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Debugging and Error Recovery
Overview
Systematic debugging with structured triage. When something breaks, stop adding features, preserve evidence, and follow a structured process to find and fix the root cause. Guessing wastes time. The triage checklist works for test failures, build errors, runtime bugs, and production incidents.
When to Use
- Tests fail after a code change
- The build breaks
- Runtime behavior doesn't match expectations
- A bug report arrives
- An error appears in logs or console
- Something worked before and stopped working
The Stop-the-Line Rule
When anything unexpected happens:
1. STOP adding features or making changes
2. PRESERVE evidence (error output, logs, repro steps)
3. DIAGNOSE using the triage checklist
4. FIX the root cause
5. GUARD against recurrence
6. RESUME only after verification passes
Don't push past a failing test or broken build to work on the next feature. Errors compound. A bug in Step 3 that goes unfixed makes Steps 4-6 wrong.
The Triage Checklist
Work through these steps in order. Do not skip steps.
Step 1: Reproduce
Make the failure happen reliably. If you can't reproduce it, you can't fix it with confidence.
Can you reproduce the failure?
βββ YES β Proceed to Step 2
βββ NO
βββ Gather more context (logs, environment details)
βββ Try reproducing in a minimal environment
βββ If truly non-reproducible, document conditions and monitor
When a bug is non-reproducible:
Cannot reproduce on demand:
βββ Timing-dependent?
β βββ Add timestamps to logs around the suspected area
β βββ Try with artificial delays (setTimeout, sleep) to widen race windows
β βββ Run under load or concurrency to increase collision probability
βββ Environment-dependent?
β βββ Compare Node/browser versions, OS, environment variables
β βββ Check for differences in data (empty vs populated database)
β βββ Try reproducing in CI where the environment is clean
βββ State-dependent?
β βββ Check for leaked state between tests or requests
β βββ Look for global variables, singletons, or shared caches
β βββ Run the failing scenario in isolation vs after other operations
βββ Truly random?
βββ Add defensive logging at the suspected location
βββ Set up an alert for the specific error signature
βββ Document the conditions observed and revisit when it recurs
For test failures:
# Run the specific failing test
npm test -- --grep "test name"
# Run with verbose output
npm test -- --verbose
# Run in isolation (rules out test pollution)
npm test -- --testPathPattern="specific-file" --runInBand
Step 2: Localize
Narrow down WHERE the failure happens:
Which layer is failing?
βββ UI/Frontend β Check console, DOM, network tab
βββ API/Backend β Check server logs, request/response
βββ Database β Check queries, schema, data integrity
βββ Build tooling β Check config, dependencies, environment
βββ External service β Check connectivity, API changes, rate limits
βββ Test itself β Check if the test is correct (false negative)
Use bisection for regression bugs:
# Find which commit introduced the bug
git bisect start
git bisect bad # Current commit is broken
git bisect good <known-good-sha> # This commit worked
# Git will checkout midpoint commits; run your test at each
git bisect run npm test -- --grep "failing test"
Step 3: Reduce
Create the minimal failing case:
- Remove unrelated code/config until only the bug remains
- Simplify the input to the smallest example that triggers the failure
- Strip the test to the bare minimum that reproduces the issue
A minimal reproduction makes the root cause obvious and prevents fixing symptoms instead of causes.
Step 4: Fix the Root Cause
Fix the underlying issue, not the symptom:
Symptom: "The user list shows duplicate entries"
Symptom fix (bad):
β Deduplicate in the UI component: [...new Set(users)]
Root cause fix (good):
β The API endpoint has a JOIN that produces duplicates
β Fix the query, add a DISTINCT, or fix the data model
Ask: "Why does this happen?" until you reach the actual cause, not just where it manifests.
Step 5: Guard Against Recurrence
Write a test that catches this specific failure:
// The bug: task titles with special characters broke the search
it('finds tasks with special characters in title', async () => {
β¦
FAQ
What does 'preserve evidence' mean?
It means saving important information about the error, like error messages, logs, or the exact steps that led to the problem, before making any other changes.
What is 'bisection'?
It's a technique to find which specific change caused a problem by comparing old and new versions of the code until you pinpoint where the error appeared.
Why shouldn't I just fix the symptom?
Fixing the symptom is like plugging a leak without addressing the cause. The problem might return or cause other errors. It's better to find and fix the root cause for a permanent solution.
Details
Original description by the author
Guides systematic root-cause debugging. Use when tests fail, builds break, behavior doesn't match expectations, or you encounter any unexpected error. Use when you need a systematic approach to finding and fixing the root cause rather than guessing.
Popularity
- GitHub stars
- 48k
- Ranking position
- #4353
- License
- MIT
- Updated
- 10/15/2026
Comments
- β¦
More skills from this repository
00-andruia-consultant
48kHelps your agent start or improve AI projects. It analyzes code, suggests tools, and creates action plans in Spanish.
007
48kLets your agent perform security audits and threat modeling. It's useful for protecting projects against attacks and vulnerabilities.
10-andruia-skill-smith
48kHelps your agent create or improve AI tools. It defines how tools work, writes documentation, and validates the structure.
20-andruia-niche-intelligence
48kLets your agent create a summary about a specific industry. It's useful for understanding the context, rules, usage patterns, and risks of a project, using reliable sources.
Similar skills
test-driven-development
311kTeaches your agent to write a failing test first, watch it fail, then write the smallest code that passes, before building any feature or fix.
verification-before-completion
311kTeaches your agent to run real checks and read their output before claiming that a task, fix, or build is complete or passing.
migrate-to-shoehorn
310kReplaces risky type casts in your test files with the shoehorn library, so tests can use partial data and still pass type checks.