agentleFS
kennguyen887kennguyen887/agent-foundation/skills/rules-debugging/SKILL.md

rules-debugging

Skill1 starsChanged 5 months agoMITView on GitHub

Binding personal rules for bugs, errors, incidents and perf regressions — load before diagnosing or fixing any bug/error/failing check, choosing the fix layer, or claiming a root cause or that something is verified.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    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:

    Never run a strict check before a permissive one validating the same constraint.

    line 12
  2. Very specific:

    After every bug/error fix: Root-cause confidence: X/10 + Risk: ….

    line 17
  3. Distinctive:

    Verify every load-bearing assumption with evidence before shipping.

    line 24
  4. Distinctive:

    Before code, scan layers cheapest first: config/env → vendor setting → datastore/engine → data fix → existing mechanism → infra → code.

    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

rules-debugging

These rules are binding (moved verbatim from ~/.claude/CLAUDE.md). Each heading names its full-text file in ~/.claude/rulebook/: Read that file before acting in its area — the one-liners are the trigger, not the whole rule.

Bug Fixes — 07-bug-fix-rules.md

  • Confirm intended behaviour for each branch before adding return/else/flow changes.
  • Never run a strict check before a permissive one validating the same constraint.
  • Fix the whole class: grep every sibling of the pattern and fix all in the same change; prefer one choke-point guard; verify copied patterns actually work; state the sweep in the report. Guard where data crosses a boundary (persist/accept), throw loudly; reuse the existing contract (e.g. schema .pick()), sized to the flow — no new architecture inside a bug fix. A 50+ site sweep is the smell.
  • Event payload null/missing field → first decide boundary, grep all emitters: in-process (same deploy, emitter holds data) → fix the PRODUCER, emit complete payload, delete listener reconstruction, handle multi-producer union deliberately. Cross-service → consumer tolerates by design, producer keeps always sending (gating drops the whole payload); trace the true blast radius; deploy consumer-tolerance first. Pin with a test through the real path.

Solution Confidence Rating — 08-solution-confidence-rating.md

  • After every bug/error fix: Root-cause confidence: X/10 + Risk: …. Symptom masks ≤5/10; say "not verified" if not repro'd+tested. Score = weakest load-bearing link; an unproven causal story is a hypothesis (≤3).

Reasoning Rigor — 09-reasoning-rigor-investigate-fully-before-fixing.md

  • GROUND-TRUTH first: read the real state of the system showing the symptom (API/query/console) before theorizing; access gap = first blocker. Don't flip-flop diagnosis.
  • LOGS FIRST, code second: one targeted log query on the entity/route/time before a code crawl.
  • Establish baseline/history (did it ever work, when did it break, telemetry over time).
  • Find every instance; name the invariant; enumerate what else could be wrong.
  • Verify every load-bearing assumption with evidence before shipping.
  • "Done" = real end-to-end success artifact, not a proxy; otherwise state what's unproven.
  • Answer the whole question (blast radius, adjacent failure modes).
  • Stay anchored to the exact reported symptom + example; re-read the report each turn; "re-read the task" = hard drift signal.

Root-Cause First — 10-root-cause-first-no-fix-arounds.md

  • Trace to the true cause (one level up every time); name guards/try-catch/suppression as symptom patches and rate low.
  • Surface root-fix vs patch trade-offs. Patch-first only as explicit hotfix with root fix tracked.
  • Root cause not proven → deliver a REPORT, not a PR (proven / unproven / the one measurement that settles it). No workaround code litter.
  • Resource/perf incidents: isolate the consuming component by direct per-process measurement before naming a cause; blind spots = "undetermined".

Fix at the Smartest Layer — 11-fix-at-the-smartest-layer-propose-the-layer-choi.md

  • Before code, scan layers cheapest first: config/env → vendor setting → datastore/engine → data fix → existing mechanism → infra → code. Ground-truth the layer. Config cures instance, code kills class — present as a pair, sized to severity. Multiple viable layers → one short block + recommendation BEFORE writing code.
  • Error text from inside a dependency (engine/driver/broker/vendor) → diagnose in THAT system first. Locking bugs: read the lock footprint (performance_schema.data_locks), not EXPLAIN. Never claim "nothing to fix on our side" without running the diagnostic. Retry is survival, not root fix. Propose engine observability first (deadlock logging). Local engine ≠ deployed engine (vendor + version + default param group).
  • A layer needing someone else's hands is blocked, not cheap — prefer the layer you can finish; deliver the whole prepared change, not a question queue.

Reproduce & Verify — 12-reproduce-verify-by-running-not-logs-tests-alone.md

  • Reproduce before declaring root cause; verify by driving the real flow to its real success state.
  • Replacing a live API → capture REAL requests (browser Network tab / access logs), replay against old and new, diff field-by-field, drive the real UI flow. Never invented payloads.
  • Gate in the target branch's own toolchain AND schema: mirror CI's exact install/Node/script; no symlinked node_modules; diff migrations on both branches before porting any query; a throwing query in a shared Promise.all kills every consumer. Clean locally but red in CI on a rule/version you never saw = your gate ran in the wrong environment, not flaky CI.
  • Do not conflate, each is a separate claim needing its own evidence: rc code ≠ master code, rc schema ≠ prod schema, a local DB named after prod ≠ prod, my own script against a live third party ≠ the deployed service doing it. Say which one you verified.
  • HARD GATE before PR/push: boot via the real dev runner, clean logs, health endpoint 200.

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.