agentleFS
matshoppenbrouwersmatshoppenbrouwers/session-flow/skills/session-debug/SKILL.md

session-debug

Skill3 starsChanged 5 months agoMITView on GitHub

Use when the user reports a bug, a failing test, or unexpected behaviour and wants it diagnosed before it is fixed. Finds the root cause, tests one hypothesis at a time, and stops to question the design after three failed fixes.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 9 are distinctive, and 1 is 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.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Three failed fixes means the design is in question: Stop, say so, and discuss the architecture with the user before a fourth attempt.

    line 18
  2. Distinctive:

    Read the error completely: message, stack trace, line numbers, codes.

    line 28
  3. Distinctive:

    Check what changed: recent commits, dependencies, configuration, environment.

    line 31
  4. Very specific:

    When the error is deep in a call stack, trace the bad value backwards to where it originates and fix it there.

    line 35
  5. Distinctive:

    If the broken code follows a reference pattern, read the reference fully before judging the deviation.

    line 41
  6. Distinctive:

    Write the hypothesis down: "X is the cause because Y."

    line 48
  7. Distinctive:

    Test it with the smallest possible change.

    line 49
  8. Distinctive:

    Run the reproduction and the surrounding tests.

    line 66
  9. Distinctive:

    Keep the regression test where the project keeps tests for this kind of change.

    line 67
  10. Distinctive:

    If the fix does not hold, count the attempts.

    line 71

≈ “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

Session Debug

Find the cause before changing anything. A change that addresses a symptom is not a fix.

Open with one sentence saying what you are about to do and what it will produce.

Rules

  1. No fix before the cause is known. Finish the investigation before proposing a change, however obvious the change looks. Simple bugs have causes too, and rushing produces rework.
  2. One hypothesis, one change, one result. State the hypothesis, make the smallest change that tests it, and read the result before doing anything else. Do not stack changes.
  3. Three failed fixes means the design is in question. Stop, say so, and discuss the architecture with the user before a fourth attempt.
  4. Say what you do not know. "I do not understand X yet" is a valid state; guessing is not.
  5. No fix before the work item exists. A confirmed cause becomes a captured work item before Phase 4 changes anything. Capture is not permission: the item lands in captured, and the user's report of the bug is what authorizes fixing it — not the record. Investigation itself needs no work item; a change to the codebase does.

Phase 1: Investigate

  • Read the error completely: message, stack trace, line numbers, codes. The answer is often in it.
  • Reproduce it. If it does not reproduce reliably, gather more data before forming a hypothesis.
  • Check what changed: recent commits, dependencies, configuration, environment.
  • In a system with several components, instrument the boundaries before guessing where it breaks: log what enters and leaves each component, run once, and let the evidence point at the failing one. Then investigate that component.
  • When the error is deep in a call stack, trace the bad value backwards to where it originates and fix it there. references/root-cause-tracing.md describes the technique.

Phase 2: Compare

  • Find working code that does something similar in the same codebase.
  • If the broken code follows a reference pattern, read the reference fully before judging the deviation.
  • List every difference between working and broken, however small.
  • Note the dependencies and assumptions the broken path relies on.

Phase 3: Hypothesis

  • Write the hypothesis down: "X is the cause because Y."
  • Test it with the smallest possible change. One variable at a time.
  • Confirmed: go to Phase 4. Not confirmed: form a new hypothesis, and do not leave the failed change in place.

Phase 4: Fix

  • Capture the work item first. Hand /session-add-task the confirmed cause, in Mode A: the reporter's words verbatim as original_request, the root cause you established as the interpreted intent, the corrected behaviour as the scope, and the reproduction as the Test. It allocates the identity and writes the record with the runtime. Report the SEQ-NNN before you change a line, so the fix, its evidence, and its cause share one home. A bug filed as an issue carries its URL into source and annotations; one reported in conversation carries neither, and no URL is invented for it.
  • Reproduce the bug in the smallest form you can: an automated test where the project has a framework, otherwise a one-off script.
  • Make the one change that addresses the cause. No unrelated improvements, no bundled refactoring.
  • Run the reproduction and the surrounding tests. Report what you ran and what it printed.
  • Keep the regression test where the project keeps tests for this kind of change; drop the scratch script.
  • Record the outcome against the captured identity: what the cause was, what the fix was, and what the test printed. The record is where the next session reads this, not the transcript.
  • If the fix does not hold, count the attempts. Fewer than three: return to Phase 1 with what you learned. Three: rule 3 applies.

When there is no root cause

Sometimes a completed investigation shows the issue is environmental, timing-dependent, or external. Then document what was checked in the captured item — the investigation is the outcome even when no cause was found — add the handling that fits (a retry, a timeout, a clearer error) and the logging that would catch the next occurrence. Most "no root cause" conclusions are incomplete investigations; make sure this one is not.

Signals you have left the process

  • "Quick fix now, investigate later."
  • "Let me just try changing X."
  • Several changes before a single test run.
  • Proposing fixes before tracing the data flow.
  • A second fix that reveals a new problem somewhere else.

Any of these means: return to Phase 1.

Derived from the systematic-debugging skill in superpowers by Jesse Vincent (MIT); see THIRD_PARTY_NOTICES.md. Chain context: references/workflow-overview.md.

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.