agentleFS
YehudaFrankelYehudaFrankel/clankbrain/.claude/skills/_archived_debug-session/SKILL.md

debug-session-archived

Skill16 starsChanged 7 months agoMITView on GitHub

Structured debugging flow for any bug or unexpected behavior. Follows reproduce → isolate → hypothesize → fix → verify → log. Ends by updating error-lookup.md so the same bug never costs time again. Triggers on "debug session", "can't figure out why", "weird behavior", "something's wrong with", "why is X not working", "help me debug".

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 9 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If a match is found: surface it immediately — "This matches a known error.

    line 21
  2. Distinctive:

    If no match: proceed to Step 2

    line 22
  3. Distinctive:

    Write a one-sentence bug statement: *"When [X], [Y] happens instead of [Z]."*

    line 31
  4. Distinctive:

    Do not guess at the cause yet.

    line 33
  5. Distinctive:

    When did it last work? What changed since then?

    line 39
  6. Distinctive:

    Use Grep and Read to find the relevant code path — don't read entire files.

    line 41
  7. Very specific:

    Follow plan-before-edit.md format: show Before/After, state why this will work.

    line 55
  8. Distinctive:

    If verification fails — return to Step 4 with the new information.

    line 63
  9. Very specific:

    Add an entry to .claude/memory/error-lookup.md:

    line 68
  10. Distinctive:

    Do not skip this prompt. The user can say no.

    line 79
  11. Distinctive:

    After Step 7: always prompt Generate Guards — every logged error is a candidate guard

    line 89

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Skill: debug-session

Trigger: "debug session" · "can't figure out why" · "weird behavior" · "something's wrong with" · "why is X not working" · "help me debug"


Steps

Step 1 — Check error-lookup.md first

Before any investigation:

  • Read .claude/memory/error-lookup.md
  • Keyword-match the described symptom against known entries
  • If a match is found: surface it immediately — "This matches a known error. Known cause: [X]. Known fix: [Y]. Try this first before investigating further."
  • If no match: proceed to Step 2

Step 2 — Reproduce

Establish the exact conditions that trigger the bug:

  • What exact input / action causes it?
  • What is the expected behavior?
  • What is the actual behavior (exact error message, wrong output, or missing behavior)?
  • Is it consistent or intermittent?

Write a one-sentence bug statement: "When [X], [Y] happens instead of [Z]."

Do not guess at the cause yet.

Step 3 — Isolate

Narrow the blast radius before reading code:

  • Which layer is it in — frontend, backend, DB, config, network?
  • Does it reproduce in a minimal case (no other factors)?
  • When did it last work? What changed since then?

Use Grep and Read to find the relevant code path — don't read entire files. List every file that could be responsible. Cross off files that aren't.

Step 4 — Hypothesize

State 2–3 specific hypotheses ranked by likelihood:

  1. Most likely: [specific thing that could cause this exact symptom]
  2. Less likely: [alternative]
  3. Edge case: [if neither of above]

For each hypothesis: what evidence would confirm or rule it out?

Step 5 — Fix

Pick the most likely hypothesis. Apply the minimal fix — change only what the hypothesis requires.

Follow plan-before-edit.md format: show Before/After, state why this will work.

Step 6 — Verify

After the fix:

  • Does the original symptom reproduce? (it should not)
  • Does anything adjacent break? (run Guard Check or smoke test if available)
  • Is the fix consistent, or does it only work sometimes?

If verification fails — return to Step 4 with the new information. Do not stack additional fixes on top of a failing one.

Step 7 — Log it

Always do this, even if the fix took 2 minutes.

Add an entry to .claude/memory/error-lookup.md:

Error message / symptomCauseFix
[exact symptom from Step 2][root cause from Step 4][what was changed in Step 5]

Then check: does this belong in regret.md (rejected approach) or guard-patterns.md (recurring class of mistake)?

After writing the entry, always say this:

"Error logged. Run Generate Guards now to convert your error history into automated prevention? I can scan error-lookup.md, regret.md, and lessons.md and propose guards that would catch this class of mistake before it ships — takes about 30 seconds."

Do not skip this prompt. The user can say no. But they should always be offered it.


Closing message

"Bug fixed. Root cause: [X]. Fix: [Y]. Logged to error-lookup.md. [N] minutes this costs next time: 0. Run Generate Guards to make this class of mistake impossible to repeat."

Auto-Chain

  • After Step 5 (fix applied): automatically invoke verification-loop — do not wait for user to ask. Run it immediately.
  • On verification failure: loop back to Step 4 with updated hypotheses — do not escalate until 2 hypotheses have been ruled out
  • After Step 7: always prompt Generate Guards — every logged error is a candidate guard

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.