agentleFS
creoaurea-devlabcreoaurea-devlab/agentic-skills/skills/debug-loop/SKILL.md

debug-loop

Skill4 starsChanged 8 months agoMITView on GitHub

Autonomous debugging workflow: reproduce the failure, isolate the highest-leverage blocker, fix it, rerun, and prove success with runtime evidence. Use this skill when the user reports a bug, a test failure, a crash, a startup error, a build failure, or says anything like: "it's broken", "not working", "error", "crash", "fix this", "debug", "why does this fail", "help me find the bug", "it worked before", or when you encounter an error during implementation that needs systematic debugging. Also use when launching an app for the first time and verifying it runs correctly.

  • Reads credentials
  • Deletes or force-pushes
  • Installs packages

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. proffesor-for-testing/agentic-qe★ 524same name
    2. tyroneross/claude-code-debugger★ 2same name
    3. archiforge/agent-craft★ 0same name
    4. bt2go/claude-skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository4 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. 0 are common, 16 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 16

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before touching code, gather information:

    line 37
  2. Distinctive:

    Run the exact command the user ran (or the exact action that triggers the bug).

    line 50
  3. Distinctive:

    If it doesn't reproduce:

    line 59
  4. Distinctive:

    Check environment differences (Node version, OS, env vars)

    line 60
  5. Distinctive:

    Ask for exact reproduction steps

    line 61
  6. Distinctive:

    When the root cause isn't obvious:

    line 85
  7. Distinctive:

    Prefer upstream fixes over downstream workarounds

    line 100
  8. Distinctive:

    If the fix is >10 lines, pause and reconsider — you might be fixing the wrong thing

    line 101
  9. Distinctive:

    Run the exact same command from Phase 2.

    line 118
  10. Distinctive:

    If the original error is gone but a new one appears → go back to Phase 3 (isolate the new blocker).

    line 120
  11. Distinctive:

    If the error persists → your fix was wrong.

    line 122
  12. Distinctive:

    Test output showing green passes

    line 131
  13. Distinctive:

    When launching an app for the first time, the debug loop becomes a verification loop:

    line 141
  14. Very specific:

    Check for missing env vars (.env.example vs .env)

    line 144
  15. Very specific:

    Run build (pnpm build) — fix any type/compile errors

    line 145
  16. Very specific:

    Run dev server (pnpm dev) — verify it starts

    line 146
  17. Very specific:

    Run tests (pnpm test) — verify test suite passes

    line 148
  18. Distinctive:

    Never debug runtime issues if the app won't even start.

    line 162
  19. Distinctive:

    When debugging is complete, report:

    line 168
  20. Distinctive:

    Downstream workarounds: instead of upstream fixes — masks the real problem

    line 185

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Debug Loop

Prove the root cause before fixing. Every debug session follows the same loop until the problem is solved or you run out of hypotheses to test.


The Loop

1. CONTEXT    → Read error messages, logs, recent changes
2. REPRODUCE  → Run the exact command/action that fails
3. ISOLATE    → Find the single highest-leverage blocker
4. FIX        → Apply the minimal fix (one change at a time)
5. RERUN      → Run the exact same command/action again
6. PROVE      → Show runtime evidence of success

Repeat steps 3-6 until all blockers are resolved. Never skip REPRODUCE or PROVE.


Phase 1: Context

Before touching code, gather information:

  1. Read the error — the full stack trace, not just the first line
  2. Check recent changes — git diff HEAD~3 or recent file modifications
  3. Read the config — package.json scripts, tsconfig, env files
  4. Check dependencies — node_modules exists? Lock file matches?

The error message usually tells you where to look. Read it carefully.


Phase 2: Reproduce

Run the exact command the user ran (or the exact action that triggers the bug).

# Whatever they told you, run it verbatim first
pnpm dev
pnpm test
pnpm build

If it doesn't reproduce:

  • Check environment differences (Node version, OS, env vars)
  • Ask for exact reproduction steps
  • Try rm -rf node_modules && pnpm install for dependency issues

You cannot fix what you cannot reproduce.


Phase 3: Isolate

You likely see multiple errors. Don't fix them all at once. Find the first domino:

Priority ladder

  1. Missing dependency / import error — nothing works until this is fixed
  2. Type error at build time — prevents compilation
  3. Runtime crash on startup — app never reaches functional state
  4. Runtime error on action — specific feature is broken
  5. Wrong behavior — works but produces incorrect results
  6. Performance issue — works correctly but too slow

Fix from the top. Lower-priority issues often disappear when higher ones are resolved.

Isolation technique

When the root cause isn't obvious:

  • Binary search — comment out half the code, does it still fail?
  • Minimal reproduction — extract the failing code into a standalone file
  • Dependency elimination — does it fail with mocked dependencies?
  • Git bisect — which commit introduced the regression?

Phase 4: Fix

Apply the minimal fix that addresses the root cause:

  • Fix the cause, not the symptom
  • Change one thing at a time
  • Prefer upstream fixes over downstream workarounds
  • If the fix is >10 lines, pause and reconsider — you might be fixing the wrong thing

Common fix patterns

SymptomLikely causeFix
Cannot find moduleMissing dep or wrong import pathpnpm add X or fix path
TypeError: X is not a functionWrong import (default vs named)Check the library's export
EADDRINUSEPort already occupiedKill existing process or change port
Type 'X' is not assignableSchema/type mismatch after changeUpdate the type or the usage
CORS errorServer doesn't allow originAdd CORS headers server-side
Module not found in buildMissing from dependencies (in devDependencies)Move to correct section

Phase 5: Rerun

Run the exact same command from Phase 2. Not a different one. Not a subset.

If the original error is gone but a new one appears → go back to Phase 3 (isolate the new blocker).

If the error persists → your fix was wrong. Revert it. Go back to Phase 3 with new information.


Phase 6: Prove

Show runtime evidence that the fix works:

  • Terminal output showing clean startup
  • Test output showing green passes
  • Browser/app screenshot showing the feature working
  • HTTP response showing correct data

"I think it should work now" is not proof. Run it and show the output.


Launch Verification (for first-time startup)

When launching an app for the first time, the debug loop becomes a verification loop:

  1. Install dependencies (pnpm install)
  2. Check for missing env vars (.env.example vs .env)
  3. Run build (pnpm build) — fix any type/compile errors
  4. Run dev server (pnpm dev) — verify it starts
  5. Hit the main endpoint/UI — verify it responds
  6. Run tests (pnpm test) — verify test suite passes

Each step that fails enters the debug loop until resolved.


Separate Launcher from Runtime Bugs

Launcher bugs prevent the app from starting at all. Fix these first:

  • Missing env vars, wrong Node version, missing deps, port conflicts, bad config

Runtime bugs appear after startup. Fix these second:

  • Broken features, wrong data, UI issues, API errors

Never debug runtime issues if the app won't even start.


Handoff Summary

When debugging is complete, report:

## Debug Summary
- **Problem**: [1-sentence description of the original issue]
- **Root cause**: [what actually caused it]
- **Fix**: [what you changed, with file paths]
- **Evidence**: [command + output proving it works]
- **Regression risk**: [low/medium/high + what to watch for]

Anti-Patterns

  • Fixing without reproducing — you're guessing, not debugging
  • Fixing multiple things at once — you won't know which fix worked
  • Downstream workarounds instead of upstream fixes — masks the real problem
  • Reading code instead of running code — theories need runtime evidence
  • Ignoring the stack trace — it literally tells you where the bug is
  • "It works on my machine" — reproduce in the exact failing environment

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.