agentleFS
itsaspacestationitsaspacestation/natural-intelligence/skills/debug/SKILL.md

debug

Skill1 starsChanged 2 months agoApache-2.0View on GitHub

Use when a test fails, a build breaks, a bug is reported, behaviour is unexpected, performance drops, or an integration misbehaves, before proposing or applying any fix. Also use when a previous fix did not work, when the cause is unknown, or when the user says stop guessing.

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

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 127 edited versions we read keep these.

  • 7

    Distinctive

    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:

    No fix before the root cause is known.

    line 16
  2. Distinctive:

    Read the whole error: message, stack trace, line numbers, exit code.

    line 36
  3. Distinctive:

    Check what changed: git diff, recent commits, new dependencies, config, environment.

    line 38
  4. Distinctive:

    When following a reference implementation, read it completely.

    line 46
  5. Distinctive:

    Test it with the smallest change that can confirm or refute it.

    line 53
  6. Distinctive:

    Not understood: say so. Ask, or gather more evidence.

    line 55
  7. Very specific:

    Write the failing test that reproduces the bug (tdd).

    line 59
  8. Distinctive:

    Run the whole test suite. Confirm the original symptom is gone, not only the new test.

    line 61
  9. Very specific:

    Commit with the git-conventions skill.

    line 63

“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

Debug

When to use

  • A test, build, pipeline, or deployment fails
  • A bug report, crash, wrong output, or unexpected behaviour
  • A performance regression or intermittent failure
  • A fix was applied and the problem is still there
  • User says "stop guessing", "is that not happening?", "we're stuck?"

Overview

No fix before the root cause is known. A fix for a symptom is a failure, even when the test goes green. Systematic debugging is faster than guess and check, under pressure most of all.

REQUIRED BACKGROUND: the evidence-based-analysis skill sets the standard of proof. Every claim about the cause cites file:line, a log line, or a command output. Inference is labelled as inference.

The fix itself follows the tdd skill: a failing test that reproduces the bug comes first. Reference: root-cause-tracing.md. Read it when the error appears deep in a call chain and the bad value's origin is unclear.

Adapted from the MIT-licensed superpowers systematic-debugging skill by Jesse Vincent.

Workflow

Four phases, in order. No phase is skipped because the bug looks simple.

1. Evidence

  1. Read the whole error: message, stack trace, line numbers, exit code. It often names the fix.
  2. Reproduce on demand. Not reproducible: gather more data, do not guess.
  3. Check what changed: git diff, recent commits, new dependencies, config, environment.
  4. Locate the code. Delegate to ni:investigator for "where is X", "what calls Y". It returns path:line rows only.
  5. Multi-component systems (CI, build, service, database): log what enters and leaves each boundary, run once, read where it breaks. Then investigate that component only.
  6. Bad value deep in the stack: trace it back to its origin with root-cause-tracing.md.

2. Pattern

  1. Find working code that does the same thing in this codebase.
  2. When following a reference implementation, read it completely. No skimming.
  3. List every difference between working and broken. None is too small to matter.
  4. List the dependencies, settings, and assumptions the broken path relies on.

3. Hypothesis

  1. State one hypothesis: "X is the root cause because Y", with the evidence cited.
  2. Test it with the smallest change that can confirm or refute it. One variable at a time.
  3. Refuted: form a new hypothesis. Never stack a second change on top of the first.
  4. Not understood: say so. Ask, or gather more evidence. Never pretend.

4. Fix

  1. Write the failing test that reproduces the bug (tdd). No test framework: a one-off script. The test exists before the fix.
  2. One fix, at the source found in phase 1, not at the symptom. No "while I'm here" changes.
  3. Run the whole test suite. Confirm the original symptom is gone, not only the new test.
  4. Fix failed: count attempts. Under 3, return to phase 1 with the new information. At 3, stop and question the design (below).
  5. Commit with the git-conventions skill.

Evidence block

The final summary closes with three lines, whatever the terse level — they carry the proof that the process happened, for a reviewer who sees only the summary:

reproduced: <command → one line of failing output>
root cause before fix: <file:line — mechanism in one clause>
tests: red <N failed: test names> → green <N passed>

A correct fix with an absent process trace reads as a guess to any reviewer.

Three strikes

Three failed fixes is not a fourth hypothesis. It is a design problem. Signs: each fix exposes new coupling somewhere else, each fix needs a large refactor, each fix creates a new symptom. Stop. Write the evidence and the options down. Discuss with the user before any further change. In a plan workspace this is an outside-constitution gap: draft the ADR.

Red flags

Any of these thoughts means: stop, return to phase 1.

ThoughtReality
"Quick fix now, investigate later"The first fix sets the pattern. Investigate first.
"Just try changing X"A guess. Form the hypothesis and cite the evidence.
"Change several things, run the tests"Nothing isolates what worked. One variable.
"Skip the test, I'll check by hand"Untested fixes regress. Failing test first.
"It's probably X"Seeing a symptom is not knowing the cause.
"The reference is long, I'll adapt the pattern"Partial reading guarantees a bug. Read it all.
"One more attempt" after two failuresThird failure means design. Stop and discuss.

Boundaries

This skill finds the cause and frames the fix. Writing the test is the tdd skill. Locating code is the ni:investigator agent. Never apply a fix without a reproduced failure and a cited cause. Never bundle a refactor with a fix. Security findings and destructive steps are written in plain prose, whatever the terse level.

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.