14-forensics-and-debugging
Skill1 starsChanged 53 days agoMITView on GitHub
Version: 1.0.0 Compatible: agent_blueprint >= 1.0 Requires: discovery, project-context, testing Outputs: incident-report.md, reproduction-test.md When software breaks or regressions occur, unstructured trial-and-error by AI agents causes context churn, destructive random edits, and secondary bugs. This skill provides a rigorous Forensics & Root-Cause Analysis (RCA) protocol: isolate the failure with empirical reproducers, trace state transitions, and fix the root defect while leaving an automated regression test behind.
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are 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.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
When software breaks or regressions occur, unstructured trial-and-error by AI agents causes context churn, destructive random edits, and …
- Distinctive: line 85
Never rewrite working modules: when debugging a targeted defect.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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.
Files
14 — Forensics & Root-Cause Debugging Skill
Version: 1.0.0
Compatible: agent_blueprint >= 1.0
Requires: discovery, project-context, testing
Outputs: incident-report.md, reproduction-test.md
Purpose
When software breaks or regressions occur, unstructured trial-and-error by AI agents causes context churn, destructive random edits, and secondary bugs.
This skill provides a rigorous Forensics & Root-Cause Analysis (RCA) protocol: isolate the failure with empirical reproducers, trace state transitions, and fix the root defect while leaving an automated regression test behind.
The 4-Stage Forensic Protocol
┌────────────────────────────────────────────────────────┐
│ 1. ISOLATE & REPRODUCE │
│ Capture logs, extract exact inputs, write a minimal │
│ failing reproduction script or unit test. │
└───────────────────────────┬────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ 2. TRACE & AUDIT │
│ Examine state transitions, stack traces, git diffs, │
│ and commit history (`git log -S` / `git bisect`). │
└───────────────────────────┬────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ 3. ROOT-CAUSE VERIFICATION │
│ Prove the failure mechanism scientifically. │
│ Rule out environment, caching, and race conditions. │
└───────────────────────────┬────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ 4. TARGETED FIX & REGRESSION SHIELD │
│ Apply surgical, minimal code fix. │
│ Prove the reproduction test now passes. │
│ Document in Risk/Gap register and CHANGELOG.md. │
└────────────────────────────────────────────────────────┘Forensic Checklist
Step 1: Isolate & Reproduce
- Do not guess the cause.
- Reproduce the failure with a single shell command or test run:
# Example: run the single failing test cargo test test_stripe_webhook_idempotency -- --nocapture - If no test exists, write a minimal reproduction test in
scratch/or in the test suite that reliably fails with the exact bug behavior.
Step 2: Trace & Audit
- Inspect error stack traces and find the exact file and line number.
- Run
git log -S "<function_or_symbol>" -pto see when the behavior last changed. - Inspect recent git commits:
git diff HEAD~1. - Verify environment variables, database connections, and port bindings.
Step 3: Root-Cause Proof
- Formulate a testable hypothesis: "The database transaction is rolled back because the foreign key is null when payload X is received."
- Inspect the relevant code snippet (
view_file). - Verify why other tests didn't catch it (test coverage gap).
Step 4: Targeted Fix & Regression Shield
- Make the smallest necessary code edit (
replace_file_content). - Re-run the reproduction test: verify it now passes.
- Re-run the entire test suite: verify no regressions were introduced.
- Update
CHANGELOG.mdunder### Fixed. - Log the incident and remediation in
docs/15_GAP_AND_RISK_REGISTER.mdif an enterprise controlled doc set is used.
What Never to Do During Debugging
- Never rewrite working modules when debugging a targeted defect.
- Never suppress errors with empty
catchblocks orunwrap()workarounds. - Never restart shared infrastructure (e.g., PostgreSQL, Redis, Cloudflare tunnels) without confirming with the team.
- Never conclude "it works now" without showing passing terminal logs.
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- llms.txtllms.txt
- 00-orchestratorSkill
- 01-discoverySkill
- 02-project-contextSkill
- 03-business-architectureSkill
- 04-architectureSkill
- 05-documentationSkill
- 06-codebase-auditSkill
- 07-securitySkill
- 08-testingSkill
- 09-performanceSkill
- 10-auditSkill
- 11-controlled-source-of-truthSkill
- 12-context-engineeringSkill
- 13-phase-loop-deliverySkill
- 15-autonomous-loop-and-simplificationSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

