agentleFS
eeshsaxenaeeshsaxena/agent-skills/skills/debug-scientifically/SKILL.md

debug-scientifically

Skill2 starsChanged 3 months agoMITView on GitHub

Fix bugs by forming and testing hypotheses instead of guessing. Use when a test fails, a stack trace appears, or behavior is wrong and the cause is unknown.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If you cannot reproduce it on demand, you cannot know when it is fixed.

    line 14
  2. Distinctive:

    Test that hypothesis cheaply: Add a log, a breakpoint, or an assertion that would prove it true or false.

    line 20
  3. Distinctive:

    Confirm or discard, then repeat: If the evidence kills your hypothesis, form a new one.

    line 22
  4. Distinctive:

    Change one thing at a time: If you edit five things and it works, you have learned nothing and probably introduced two new bugs.

    line 29
  5. Distinctive:

    Remove debug logs and temporary code.

    line 41
  6. Distinctive:

    Add a regression test so this exact bug cannot return silently.

    line 42

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

Debug Scientifically

Random edits until the error disappears is not debugging, it is gambling. Treat every bug as a hypothesis to be confirmed or killed with evidence.

The loop

  1. Reproduce first. Find the smallest, most reliable way to trigger the bug. If you cannot reproduce it on demand, you cannot know when it is fixed. Write a failing test or a one-line repro command before touching anything.
  2. Read the actual error. The full stack trace, the exact message, the line number. Do not skim. The answer is often literally printed.
  3. State one hypothesis. "The value is null because the API returns 204 with no body." Make it specific and falsifiable.
  4. Test that hypothesis cheaply. Add a log, a breakpoint, or an assertion that would prove it true or false. Change one variable at a time.
  5. Confirm or discard, then repeat. If the evidence kills your hypothesis, form a new one. Do not keep a theory the data contradicts.
  6. Fix the cause, not the symptom. A null check that hides a bad upstream value is a symptom patch. Trace to the origin.

Guardrails

  • Change one thing at a time. If you edit five things and it works, you have learned nothing and probably introduced two new bugs.
  • Question your assumptions. The bug is usually in the code you are sure is correct. Verify inputs, versions, config, and environment, not just logic.
  • Bisect when lost. Comment out half the suspect code, or use git bisect, to cut the search space in half each step.
  • Keep a scratch trail. Note what you tried and what it proved, so you do not test the same dead hypothesis twice.

Before declaring victory

  • Reproduce the original failure one more time to confirm it is gone.
  • Remove debug logs and temporary code.
  • Add a regression test so this exact bug cannot return silently.

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.