agentleFS
josephneumannjosephneumann/claude-corps/skills/debug/SKILL.md

debug

Skill4 starsChanged 8 months agoMITView on GitHub

Use when facing a bug, test failure, or unexpected behavior that isn't immediately obvious

144 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use add-ollama-tool, add-slack and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • MicrosoftSkill

    add-ollama-tool

    Add Ollama MCP server so the container agent can call local models and optionally manage the Ollama model library.

    Also in 6 projects that use this

  • MicrosoftSkill

    add-slack

    Add Slack channel integration via Chat SDK.

    Also in 6 projects that use this

  • sskarzSkill

    add-telegram-swarm

    Add Agent Swarm (Teams) support to Telegram. Each subagent gets its own bot identity in the group. Requires Telegram channel to be set up first (use /add-telegram). Triggers on "agent swarm", "agent teams telegram", "telegram swarm", "bot pool".

    Also in 5 projects that use this

  • +9 more from microsoft

The file

Show its rules and text

We split this skill into the rules it gives an agent

19 rules. 0 are common, 18 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 127 edited versions we read keep these.

  • 18

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Iron Law: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.

    line 9
  2. Distinctive:

    If you can't reproduce it, you can't fix it

    line 15
  3. Distinctive:

    Before forming hypotheses, collect facts:

    line 20
  4. Distinctive:

    Read the actual code path from input to failure point.

    line 22
  5. Very specific:

    Check recent changes: git log --oneline -10 -- <file>

    line 23
  6. Distinctive:

    Add temporary logging or assertions at key points to trace data flow

    line 24
  7. Distinctive:

    If a stack trace exists, trace backward through the call chain to the origin

    line 26
  8. Distinctive:

    If the bug matches a known pattern, state which one and focus investigation there.

    line 40
  9. Distinctive:

    Test one variable at a time

    line 46
  10. Distinctive:

    If your prediction is wrong, update your mental model — don't just try the next thing

    line 47
  11. Distinctive:

    Keep asking why until you reach something you can fix directly.

    line 56
  12. Distinctive:

    Keep the diff minimal — only change what's needed to fix the bug

    line 62
  13. Distinctive:

    Run the original failing test to confirm the fix

    line 63
  14. Distinctive:

    Run the full test suite to check for regressions

    line 64
  15. Distinctive:

    If 3 hypotheses have failed, STOP.

    line 68
  16. Distinctive:

    Use AskUserQuestion to escalate: describe what you've tried, what you've ruled out, and where you're stuck

    line 72
  17. Distinctive:

    If you catch yourself thinking any of these, STOP:

    line 79
  18. Distinctive:

    After resolution, output a structured report:

    line 98
  19. Distinctive:

    If the root cause was non-obvious, save debugging insights to auto-memory.

    line 119

“Common” is measured: kept by at least 6 in 10 of the 127 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

Systematic Debugging

Iron Law: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.

Phase 1: Reproduce & Isolate

  • Reproduce the failure reliably before anything else
  • Isolate the smallest failing case
  • If you can't reproduce it, you can't fix it
  • Record the exact command, input, and output that demonstrates the failure

Phase 2: Gather Evidence

Before forming hypotheses, collect facts:

  • Read the actual code path from input to failure point. Don't guess from memory.
  • Check recent changes: git log --oneline -10 -- <file>
  • Add temporary logging or assertions at key points to trace data flow
  • Collect the full error message, stack trace, and relevant log output
  • If a stack trace exists, trace backward through the call chain to the origin

Known bug patterns — check these first:

PatternSignature
Race conditionIntermittent failure, timing-dependent, works in debugger
Nil/null propagationundefined is not a function, NoMethodError, NoneType
State corruptionWorks first time, fails on second; stale data after mutation
Integration failureWorks in isolation, fails with real dependency (DB, API, queue)
Configuration driftWorks locally, fails in CI/staging; env var mismatch
Stale cacheOld behavior persists after code change; hard refresh fixes it
Off-by-one / boundaryFails at 0, 1, max, or empty input; pagination edge cases

If the bug matches a known pattern, state which one and focus investigation there.

Phase 3: Hypothesize & Test

  • Form a specific hypothesis: "The root cause is X because evidence Y"
  • Predict the outcome BEFORE running each test
  • Test one variable at a time
  • If your prediction is wrong, update your mental model — don't just try the next thing

"5 Whys" drill-down — when the cause isn't obvious, ask why iteratively:

  1. Why did the request fail? → The handler returned null
  2. Why did it return null? → The query returned no rows
  3. Why did the query return no rows? → The ID was from a different tenant
  4. Why was the ID from a different tenant? → The session wasn't scoped to tenant
  5. Why wasn't the session scoped? → Root cause: middleware ordering

Keep asking why until you reach something you can fix directly.

Phase 4: Fix & Verify

  1. Write a regression test that fails without the fix and passes with it. This is not optional.
  2. Fix the root cause, not the symptom
  3. Keep the diff minimal — only change what's needed to fix the bug
  4. Run the original failing test to confirm the fix
  5. Run the full test suite to check for regressions

Three-Strikes Rule

If 3 hypotheses have failed, STOP. You are likely wrong about the root cause.

  • Go back to Phase 2 and re-read the code path from scratch
  • Question your assumptions about the architecture
  • Use AskUserQuestion to escalate: describe what you've tried, what you've ruled out, and where you're stuck
  • Optionally WebSearch for the error message or pattern — someone may have hit this before

Escalation is not failure. Bad work is worse than no work. Stop guessing.

Red Flags

If you catch yourself thinking any of these, STOP:

  • "Let me just try..." — You're guessing, not tracing.
  • "Maybe if I..." — Form a hypothesis and predict the outcome first.
  • "This might work..." — Why would it work? What's your evidence?
  • "It's probably this..." — Probably based on what? State the evidence.

Anti-Rationalization Table

ExcuseReality
"Let me try a quick fix first"Quick fixes without root cause analysis create new bugs.
"I know what the problem is"Then state your hypothesis and predict the test outcome.
"It works now after my change"Correlation is not causation. Verify your fix addresses the root cause.
"The test is flaky, not my code"Reproduce it 3 times. If it fails 2/3, it's your code.
"I'll add better error handling"Error handling hides bugs. Fix the cause, not the symptom.

Debug Report

After resolution, output a structured report:

═══════════════════════════════════════════
DEBUG REPORT
═══════════════════════════════════════════
Status: DONE / DONE_WITH_CONCERNS / BLOCKED
Symptom: [what was observed]
Root Cause: [what was actually wrong]
Pattern: [known pattern match, if any]
Fix: [what was changed and why]
Regression Test: [test name and what it verifies]
Evidence: [how you confirmed the fix addresses the root cause]
Hypotheses Tested: N (list failed ones if >1)
═══════════════════════════════════════════
  • DONE — Root cause identified, fix applied, regression test passes, full suite green
  • DONE_WITH_CONCERNS — Fixed, but related issues discovered. Note them for follow-up.
  • BLOCKED — Cannot resolve. Document what was tried and what's needed to proceed.

If the root cause was non-obvious, save debugging insights to auto-memory.

Evolved from obra/superpowers systematic-debugging skill with patterns from garrytan/gstack and community best practices.

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.