debugging-methodology
Skill69 starsChanged 7 months agoMITView on GitHub
Systematic root cause analysis for production and development bugs. Hypothesis-driven debugging — never guess-and-check.
In this repository32 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ai-output-validationSkill
- api-designSkill
- ci-cd-pipelinesSkill
- code-explanationSkill
- code-reviewSkill
- context-loadingSkill
- documentationSkill
- error-handlingSkill
- frontend-engineeringSkill
- git-workflowSkill
- goal-driven-executionSkill
- hallucination-preventionSkill
- idea-to-specSkill
- incremental-codingSkill
- integration-testingSkill
- meeting-notes-to-tasksSkill
- multi-agent-orchestrationSkill
- observabilitySkill
- performance-optimizationSkill
- production-deploymentSkill
- prompt-injection-defenseSkill
- rag-and-memorySkill
- refactoringSkill
- research-and-summarizeSkill
- security-hardeningSkill
- simplicity-firstSkill
- surgical-changesSkill
- task-decompositionSkill
- test-driven-developmentSkill
- think-before-codingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 16 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈16
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 19
When behavior differs between environments
- Distinctive: line 20
When performance degrades unexpectedly
- Distinctive: line 26
Before doing anything else: reproduce the bug reliably.
- Distinctive: line 27
Write a failing test that captures the bug — this becomes your regression test.
- Distinctive: line 34
Read the full error message — not just the first line.
- Distinctive: line 35
Read the stack trace from bottom to top — the root cause is usually near the bottom.
- Distinctive: line 44
Do not start making code changes until you have a hypothesis.
- Distinctive: line 50
Add targeted logging or a targeted test that confirms or refutes the hypothesis.
- Distinctive: line 51
Run it. Read the output carefully.
- Distinctive: line 52
If the hypothesis is wrong: update your understanding, form a new hypothesis, repeat.
- Distinctive: line 53
If the hypothesis is right: you've found the root cause.
- Distinctive: line 61
Run the failing test you wrote in Step 1 — it should now pass.
- Distinctive: line 62
Run the full test suite — no regressions.
- Distinctive: line 68
If the bug wasn't caught by existing tests: add a test that would have caught it.
- Distinctive: line 69
If the bug was caused by a bad assumption: document the assumption or add a guard.
- Distinctive: line 70
Consider: does this class of bug exist elsewhere in the codebase?
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
Overview
Random code changes in response to errors are not debugging — they're noise generation. This skill enforces a systematic, hypothesis-driven approach: understand the problem, form a hypothesis, test it, confirm the root cause, then fix.
AI agents often cycle through random fixes until something "works." This skill prevents that.
When to Use
- Any time a test fails unexpectedly
- Any time you encounter an error or exception
- When behavior differs between environments
- When performance degrades unexpectedly
Process
Step 1: Reproduce Reliably
- Before doing anything else: reproduce the bug reliably. If you can't reproduce it, you can't fix it.
- Write a failing test that captures the bug — this becomes your regression test.
- Note the exact conditions that trigger the bug: inputs, environment, sequence of actions.
Verify: You can trigger the bug on demand.
Step 2: Understand Before Diagnosing
- Read the full error message — not just the first line.
- Read the stack trace from bottom to top — the root cause is usually near the bottom.
- Identify: What was the program trying to do? What happened instead?
Verify: You can explain the bug in one sentence without using the word "error."
Step 3: Form a Hypothesis
- Based on what you know, form a specific hypothesis: "I think the bug is X because Y."
- The hypothesis must be falsifiable — you can design a test that proves or disproves it.
- Do not start making code changes until you have a hypothesis.
Verify: Your hypothesis is specific enough to design a test for.
Step 4: Test the Hypothesis
- Add targeted logging or a targeted test that confirms or refutes the hypothesis.
- Run it. Read the output carefully.
- If the hypothesis is wrong: update your understanding, form a new hypothesis, repeat.
- If the hypothesis is right: you've found the root cause.
Verify: Root cause is confirmed by evidence, not assumed.
Step 5: Fix the Root Cause (Not the Symptom)
- Fix the root cause — not the symptom. Suppressing an error message is not a fix.
- Make the minimum change that fixes the root cause.
- Run the failing test you wrote in Step 1 — it should now pass.
- Run the full test suite — no regressions.
Verify: The specific failing test now passes. Full suite still passes.
Step 6: Prevent Recurrence
- If the bug wasn't caught by existing tests: add a test that would have caught it.
- If the bug was caused by a bad assumption: document the assumption or add a guard.
- Consider: does this class of bug exist elsewhere in the codebase?
Common Rationalizations (and Rebuttals)
| Excuse | Rebuttal |
| "Let me just try this and see" | Random changes produce random results. Form a hypothesis first. |
| "It must be a framework bug" | It's almost never the framework. Prove it before blaming it. |
| "Works on my machine" | Environment differences are root causes. Find them. Don't dismiss them. |
| "I'll add a try/catch" | That hides the bug. Find and fix the root cause. |
Red Flags
- Making code changes before understanding the bug
- Adding try/catch to silence errors without investigating root cause
- "I'll try this and see if it helps"
- Assuming the bug is in a dependency before proving it
- Fixing the symptom (error message) rather than the cause
Verification
- Bug reproducible on demand
- Root cause identified (not just symptom)
- Fix targets root cause, not symptom
- Reproduction test written and now passes
- Full test suite passes with no regressions
- Regression test added to prevent future occurrence
References
- test-driven-development skill
- observability skill
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
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.

