agentleFS
MorganOnGitHubMorganOnGitHub/tackle/skills/debugging-systematically/SKILL.md

debugging-systematically

Skill0 starsChanged 45 days agoMITView on GitHub

Use when encountering a bug, test failure, build error, or unexpected behavior whose cause is not already certain

7 other projects use 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. 0 are common, 9 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 9

    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:

    Anything else: follow the phases below.

    line 13
  2. Distinctive:

    Read the full error and stack trace: file, line, code.

    line 18
  3. Distinctive:

    Check what changed recently: diffs, dependencies, config, environment.

    line 20
  4. Distinctive:

    If you're following a reference implementation, read all of it.

    line 26
  5. Distinctive:

    Test it with the smallest possible change, one variable at a time.

    line 30
  6. Distinctive:

    If it's wrong, undo the change and form a new hypothesis.

    line 31
  7. Distinctive:

    If you don't understand something, say so and research or ask.

    line 32
  8. Very specific:

    Write a failing test that reproduces the bug (testing-first).

    line 35
  9. Distinctive:

    Verify the test passes, the original symptom is gone, and nothing else broke.

    line 37
  10. Distinctive:

    If the bad value could arrive by other routes, add validation where it enters each layer, not only where it failed.

    line 38

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

Debugging Systematically

Guessed fixes often hide the symptom and leave the cause, and each wrong guess adds changes you then have to untangle. Finding the root cause first is usually faster, even under pressure.

Scale it

  • Cause is certain from the error (a typo, a missing import, a message that names the fix): fix it and verify.
  • Anything else: follow the phases below.

How

1. Investigate

  • Read the full error and stack trace: file, line, code.
  • Reproduce reliably. If you can't, gather more data before theorising.
  • Check what changed recently: diffs, dependencies, config, environment.
  • In multi-component systems, log what enters and leaves each boundary, then run once to see where it breaks.
  • Trace the bad value back to where it came from and fix it there, not where it surfaced.

2. Compare

  • Find similar code that works and list every difference, however small.
  • If you're following a reference implementation, read all of it.

3. Hypothesise and test

  • State one hypothesis: "X causes this because Y."
  • Test it with the smallest possible change, one variable at a time.
  • If it's wrong, undo the change and form a new hypothesis; don't stack fixes.
  • If you don't understand something, say so and research or ask.

4. Fix

  • Write a failing test that reproduces the bug (testing-first).
  • Make one change that addresses the root cause, without bundling in cleanup.
  • Verify the test passes, the original symptom is gone, and nothing else broke.
  • If the bad value could arrive by other routes, add validation where it enters each layer, not only where it failed.
  • For timing-dependent failures, wait on the condition you need rather than a fixed delay.

After three failed fixes, stop. Repeated failures that each reveal a new problem somewhere else usually mean the design is wrong, not that the next fix will work. Summarise what you've learned and discuss the approach with the user.

Skip or shorten when

  • The investigation shows the cause is truly external (timing, environment, a third party). Document what you checked, add sensible handling (retry, timeout, clear error), and add logging for next time.

Done means

You can explain the root cause, a test reproduces it and now passes, and the original symptom is gone.

Next

  • verifying-before-claiming
  • investigating-in-parallel if you uncover several independent problems

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.

Reviews can't be read right now.

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.