agentleFS
tmussertmusser/ai-engineering-skills/skills/diagnose-loop/SKILL.md

diagnose-loop

Skill6 starsChanged 3 months agoMITView on GitHub

Diagnose reproducible failures with hypothesis-driven fixes and bounded retries.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    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:

    Use when a command fails, behavior is wrong, a test regresses, or output does not match the spec.

    line 14
  2. Distinctive:

    Add a regression check if possible.

    line 31
  3. Very specific:

    Stop at acceptance, either budget limit, an unresolved interruption, or a scope/permission/evaluator change.

    line 36

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

Diagnose Loop

Purpose

Debug failures systematically.

When to use

Use when a command fails, behavior is wrong, a test regresses, or output does not match the spec.

Inputs

  • Failure report
  • Exact command or reproduction case
  • Recent changes
  • Logs, traces, or output

Workflow

  1. Freeze feature work.
  2. Reproduce the failure.
  3. Identify the exact failing command or case.
  4. List hypotheses.
  5. Instrument minimally.
  6. Name one active hypothesis and the observation that would falsify it; apply the smallest fix that tests it.
  7. Add a regression check if possible.
  8. Rerun the original failing command.
  9. Rerun relevant verification. An improved signal is not completion; the original failure and compatibility checks must pass.
  10. Before a second repair attempt, count the initial attempt and define the retry contract: fixed input/evaluator identities, acceptance threshold, total attempt limit, consecutive no-progress limit, revert rule, ledger location, and review trigger. If incomplete, stop with REVIEW_REQUIRED; the initial bounded diagnosis does not require a separate loop artifact.
  11. Record each started attempt, including failed commands and interrupted attempts: hypothesis, artifact state, evidence, outcome, and consumed budget. Change the next hypothesis only when the evidence supports it. Unchanged or worse results and tool errors consume the no-progress budget; improvement does not reset the total budget.
  12. Stop at acceptance, either budget limit, an unresolved interruption, or a scope/permission/evaluator change. Preserve the best known state and the failed attempt's evidence; revert only edits owned by this attempt, never unrelated user work. Reconcile uncertain external effects before retrying.
  13. On resume, carry forward the same loop identity, ledger, input/evaluator identities, consumed budget, and stop reason. A fresh session or subtask does not grant new attempts. Renew a spent budget or change the evaluator only through an explicit contract revision; preserve the prior ledger.

Outputs

  • Root-cause note
  • Smallest fix
  • Regression check when possible
  • Rerun results
  • For repeated repairs: compact attempt ledger, remaining budget, and stop reason

Stop conditions

  • The original failure is fixed and verified.
  • The failure cannot be reproduced.
  • The next step requires a product or data decision.
  • Retry limits are reached, evidence is stale, or an interrupted attempt has unresolved effects.

Anti-patterns

  • Repeating the same failed fix without a new falsifiable hypothesis.
  • Weakening tests, changing the evaluator, or resetting counters to make progress appear green.
  • Randomly editing files before reproducing the bug.
  • Fixing symptoms without naming the failing case.
  • Adding noisy instrumentation and leaving it behind.

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.