agentleFS
sreejithramansreejithraman/SreeStack/skills/diagnosing-bugs/SKILL.md

diagnosing-bugs

Skill1 starsChanged 16 days agoMITView on GitHub

Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.

193 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use setup-ts-deep-modules, loop-me 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.
  • liufeng1976Skill

    setup-ts-deep-modules

    Wire dependency-cruiser into a TypeScript repo so each package is a deep module — implementation hidden in subfolders, reachable only through its entry-point files. User-invoked.

    Also in 43 projects that use this

  • RoentekSkill

    loop-me

    Grill me about specs for the workflows I want to build, within this workspace.

    Also in 55 projects that use this

  • LesaniSkill

    writing-beats

    Shape an article as a journey of beats, choose-your-own-adventure style. The user picks a starting beat from the raw material, you write only that beat, then offer options for where to pivot next, beat by beat, until the article reaches a natural end. Use when the user has raw material and wants to assemble it as a narrative rather than an argument.

    Also in 58 projects that use this

  • AWSSkill

    to-questionnaire

    Turn a decision you can't fully answer into a questionnaire for someone else to fill in.

    Also in 88 projects that use this

  • LesaniSkill

    writing-shape

    Take a markdown file of raw material and shape it into an article through a conversational session — drafting candidate openings, growing the piece paragraph by paragraph, arguing about format (lists, tables, callouts, quotes) at each step. Use when the user has a pile of notes, fragments, or a rough draft and wants help turning it into something publishable.

    Also in 56 projects that use this

  • AWSSkill

    wizard

    Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.

    Also in 122 projects that use this

  • +1 more from Lesani
  • +2 more from aws

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 180 edited versions we read keep these.

  • 9

    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:

    Use Fix Root Causes for repair ownership and root-cause decisions, and Attack the Premise when successive fixes fail the same check.

    line 15
  2. Very specific:

    Read potentially sensitive artifacts through a redacting filter so secrets become <REDACTED> before tool output enters the conversation.

    line 22
  3. Distinctive:

    Follow host browser routing.

    line 41
  4. Distinctive:

    provisional diagnosis: when it cannot be replayed.

    line 98
  5. Distinctive:

    Run the loop repeatedly. Confirm it goes red on the user's failure rather than a nearby bug, and retain the exact error, output, or timing …

    line 107
  6. Very specific:

    Prefer debugger or REPL inspection.

    line 129
  7. Distinctive:

    If no correct seam exists, record the architectural limitation for the cleanup report.

    line 143
  8. Distinctive:

    Search for the unique debug prefix to confirm removal.

    line 158
  9. Distinctive:

    When evidence establishes a recurring failure class, pass examples and the verified cause to correct.

    line 161
  10. Distinctive:

    If the decisive fact required deep investigation, propose the cheapest persistent signal that would have exposed it earlier: a health …

    line 166
  11. Distinctive:

    Keep persistent signals distinct from temporary probes.

    line 170

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

Diagnosing Bugs

Build a tight signal for the user's exact symptom, reproduce and minimise it, then test causes and repair. Skip a phase only with an explicit reason; the artifact-only path below supports diagnosis, not a verified fix.

Resolve glossary paths with glossary paths before reading or writing domain vocabulary. Read an existing glossary and relevant ADRs when exploring the affected modules. Use Fix Root Causes for repair ownership and root-cause decisions, and Attack the Premise when successive fixes fail the same check. This skill owns the runnable loop.

Protect evidence

Read potentially sensitive artifacts through a redacting filter so secrets become <REDACTED> before tool output enters the conversation. This applies to inspection reads as well as final reports. Build commands against environment variables so credentials stay in the environment. Captures may contain auth headers; quote only the lines needed for the signal. If redacted evidence is insufficient, explain what is missing and ask the user.

Phase 1: Build a feedback loop

Spend the effort needed to make one command catch this bug. For performance work, read measurement validity before building or using a baseline, choosing a fix, or reporting comparisons.

Try these loop forms in roughly this order:

  1. A failing unit, integration, or end-to-end test at a seam that reaches the bug.
  2. Curl or an HTTP script against a running dev server.
  3. A CLI with fixture input and a known-good output comparison.
  4. A browser reproduction asserting visible state, DOM, console, or network. Follow host browser routing; in T3 Code use the collaborative preview and recovery rules before a standalone driver's allowed fallback or explicit request.
  5. Replay of a captured request, payload, or event log through the affected path.
  6. A throwaway harness with the minimal system and mocked dependencies.
  7. A property or fuzz loop for intermittent wrong output.
  8. A bisection harness checking known commit, dataset, or version states.
  9. A differential loop comparing versions or configurations on the same input.
  10. As a last resort, a human-assisted script based on scripts/hitl-loop.template.sh, with captured observations returned to you.

Apple targets

Load the reference matching the evidence needed:

  • Runtime behavior, crashes, or suspected hangs: Apple runtime.
  • Slow launch, hitches, excess CPU, or other measured regressions: Apple performance. For a hang, classify and reproduce it with the runtime reference first; profile when delay needs measurement.
  • Growing memory, abandoned objects, retain cycles, or memory-pressure termination: Apple memory.

These refine this loop. After establishing cause and repair, use verify for the final Apple user workflow check.

Make the signal tight

Narrow setup and scope, assert the specific symptom, and pin time, random seeds, filesystem, and network where relevant. Aim for seconds rather than minutes. For nondeterministic failures, increase and pin the reproduction rate with repetition, concurrency, stress, or controlled timing; record the observed rate.

For timing and lifecycle failures, capture starting state, event order, and active operation identity, including relevant cancellation, replacement, and completion timing. Use Model the Domain when repairing invalid states or transitions.

Phase 1 is complete when you have run one named command and shown its redacted invocation and output. The command must be:

  • Red-capable: drive the actual bug path and assert the user's exact symptom, with a verdict that can turn red on this bug and green after repair.
  • Deterministic: the same verdict on repeat, or a pinned, high reproduction rate suitable for debugging a flaky bug.
  • Fast: seconds, not minutes.
  • Agent-runnable: unattended, with human participation only through the HITL template.

Establish this signal before forming a theory. Without it or the matching artifact below, stop before hypothesising.

When a runnable loop is unavailable

State what you tried and what prevents reproduction. Ask for access to the affected environment, a redacted captured artifact (HAR, logs, core dump, or timestamped recording), or permission for temporary production instrumentation.

An artifact capturing the exact symptom in the affected build supports a provisional diagnosis when it cannot be replayed. Skip Phases 2 and 4; use Phase 3's ranked falsifiable hypotheses and compare predictions with the artifact, code, or independent observations. Distinguish supported conclusions from untested ones. Stay on this diagnosis-only path until a runnable reproduction exists: Phase 5 and a verified-fix claim require that loop. Without a matching artifact, stop before hypotheses.

Phase 2: Reproduce and minimise

Run the loop repeatedly. Confirm it goes red on the user's failure rather than a nearby bug, and retain the exact error, output, or timing as repair evidence. For a flaky failure, confirm the reproduction rate is high enough to debug.

Shrink the scenario one input, caller, configuration, datum, or step at a time; rerun after each removal. Keep the original scenario for final verification. Finish when the failure is reproduced and every remaining element is load-bearing: removing it makes the loop green. Proceed only after both reproduction and minimisation; the provisional path skips this phase.

Phase 3: Rank falsifiable hypotheses

Generate 3–5 ranked hypotheses before testing any. For each, name a prediction: “If X causes this, changing Y will remove the failure or changing Z will worsen it.” Sharpen or discard a hypothesis without a testable prediction.

Show the ranking to the user before testing so they can supply domain knowledge or prior exclusions. Continue with that ranking while they are unavailable.

Phase 4: Probe predictions

Map each probe to a Phase 3 prediction and change one variable at a time. Prefer debugger or REPL inspection; otherwise place targeted logs at boundaries that distinguish hypotheses. Tag every temporary log with a unique prefix such as [DEBUG-a4f2] so cleanup can find it. Avoid broad logging.

For performance regressions, establish the baseline with a timing harness, profiler, or query plan, then bisect. Measure before fixing; apply the shared measurement-validity requirements.

Phase 5: Fix and add a regression test

Choose a correct seam: the test must exercise the real bug pattern at its call site, including multiple callers or a triggering chain when required. A shallow test that misses the pattern cannot lock down the repair.

If no correct seam exists, record the architectural limitation for the cleanup report. If one exists:

  1. Turn the minimised repro into a regression test before editing the fix.
  2. Watch the test fail.
  3. Apply the repair.
  4. Watch the test pass.

In either case, rerun the Phase 1 loop against the original, unminimised scenario.

Phase 6: Clean up and report

Finish only when the original repro is green, the regression test passes (or its missing seam is documented), and temporary logs and throwaway prototypes are removed or the prototypes moved to a clearly marked debug location. Search for the unique debug prefix to confirm removal. State the supported cause in the result and any commit or PR message.

When evidence establishes a recurring failure class, pass examples and the verified cause to correct. Historical mining and broader prevention require that scope from the user; keep active diagnosis focused on this failure. An isolated incident supports a regression repair, not recurrence.

If the decisive fact required deep investigation, propose the cheapest persistent signal that would have exposed it earlier: a health check, counter, or structured log. Name the fact and the signal's runtime and privacy costs. Implement only within the authorized fix; otherwise report it as a follow-up. Keep persistent signals distinct from temporary probes.

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.