systematic-debugging
Skill1 starsChanged 4 months agoMITView on GitHub
Use when the user asks to debug a failing test, runtime error, crash, flaky behavior, regression, misconfiguration, build failure, deployment failure, performance anomaly, or wrong output. Use when the task says "debug this", "why does this fail", "find root cause", "fix this bug", or "this used to work".
- Reads credentials
190 other projects use a version of this.
Adopted by
Most recently taken up by
- DemonDamon/AgenticXtheir own version, first seen Nov 9, 2026
- chrysogonus/power-agentstheir own version, first seen Nov 8, 2026
- willy92wins/DayZ-Modding-Knowledge-Packtheir own version, first seen Nov 8, 2026
- roundpilot/superpowers-antigravitytheir own version, first seen Nov 8, 2026
- REPOZY/superpowers-optimizedtheir own version, first seen Nov 8, 2026
- lingyired/status-triotheir own version, first seen Nov 8, 2026
Used with
Projects with it also use chinese-code-review, chinese-commit-conventions 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.
Leodorareluctant259Skillchinese-code-review
中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈
Also in 8 projects that use this
Leodorareluctant259Skillchinese-commit-conventions
中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化
Also in 8 projects that use this
obraSkilldiagnosing-superpowers
Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.
Also in 20 projects that use this
mjunaidcaSkillbuilding-chatgpt-apps
Guides creation of ChatGPT Apps with interactive widgets using OpenAI Apps SDK and MCP servers. Use when building ChatGPT custom apps with visual UI components, embedded widgets, or rich interactive experiences. Covers widget architecture, MCP server setup with FastMCP, response metadata, and Developer Mode configuration. NOT when building standard MCP servers without widgets (use building-mcp-servers skill instead).
Also in 4 projects that use this
mjunaidcaSkillbuilding-chat-interfaces
Build AI chat interfaces with custom backends, authentication, and context injection. Use when integrating chat UI with AI agents, adding auth to chat, injecting user/page context, or implementing httpOnly cookie proxies. Covers ChatKitServer, useChatKit, and MCP auth patterns. NOT when building simple chatbots without persistence or custom agent integration.
Also in 4 projects that use this
- +2 more from Leodorareluctant259
- +5 more from mjunaidca
Other versions190 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 190
- obra/superpowers★ 314ksame name
- NousResearch/hermes-agent★ 262ksame name
- open-metadata/OpenMetadata★ 16ksame name
- jnMetaCode/superpowers-zh★ 8.4ksame name
- vudovn/ag-kit★ 8.2ksame name
- vudovn/antigravity-kit★ 8.2ksame name
- openai/plugins★ 7.8ksame name
- ChrisWiles/claude-code-showcase★ 6.1ksame name
- farm-fe/farm★ 5.6ksame name
- microsoft/FluidFramework★ 4.9ksame name
180 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-config-referenceSkill
- agent-security-guardSkill
- code-review-workflowSkill
- cross-model-verificationSkill
- git-workflow-for-agentsSkill
- incident-retro-workflowSkill
- observability-workflowSkill
- planning-workflowSkill
- requirements-clarifierSkill
- skill-authoring-workflowSkill
- skill-pipeline-orchestratorSkill
- skill-review-workflowSkill
- test-design-workflowSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 0 are common, 11 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 177 edited versions we read keep these.
11
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
- Distinctive: line 53
Start with the exact failure, not a theory:
- Very specific: line 73
No repo or artifact -> ask for the failing command, log, or affected file and mark the state blocked: missing symptom.
- Distinctive: line 81
Run the smallest known reproduction.
- Distinctive: line 117
Read both sides of the boundary: request/response, validation/defaults, transaction/query, fixture cleanup, working directory, env …
- Distinctive: line 121
Search is noisy -> search sibling enum values, route names, JSON keys, table columns, and old error text.
- Distinctive: line 181
No working example -> use docs, tests, schema, or old commit as the reference.
- Distinctive: line 189
Use the scientific loop: state one hypothesis, pick one observation that can disprove it, run the narrow reproduction, then mark the result …
- Distinctive: line 214
Before editing, create or identify the failing check:
- Distinctive: line 225
Keep the diff small; no unrelated cleanup.
- Distinctive: line 226
Add validation at each layer bad data crosses when the bug is caused by invalid input or unsafe state.
- Distinctive: line 228
Add or update a regression test when the codebase has a test surface.
- Distinctive: line 242
Run the original failure path plus relevant regressions:
- Very specific: line 266
Do not say "fixed" if the original reproduction was not rerun.
“Common” is measured: kept by at least 6 in 10 of the 177 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.
Files
Systematic Debugging
Overview
Debugging is evidence work: reproduce, trace root cause, change one variable, and verify the original failure path before claiming success.
When to Use
| Use When | Don't Use When |
| The user says "debug this", "why does this fail", "find root cause", "fix this bug", or "this used to work" | The user asks only for a broad code review with no concrete symptom; use code-review-workflow |
| A test, build, command, service, UI path, job, or integration fails with an error, crash, timeout, bad output, or flaky result | The cause is already proven and the user only asks for implementation |
| A regression appears after recent code, config, dependency, data, environment, or deployment changes | The task is only to design tests from scratch; use test-design-workflow |
| A previous fix failed, made the symptom move, or revealed a different failure | The user wants an incident narrative after service is restored; use incident-retro-workflow |
| The failure crosses API, database, CI, model-tool, or browser-backend boundaries | No artifact, symptom, log, reproduction step, or affected behavior is available |
Phase 0 Benchmark Decision
Type: Technique. Adopt the Superpowers/Hermes pattern: no fix before root cause, trace bad values backward, replace timing guesses with condition waits, add defense-in-depth after proof, and stop after repeated failed fixes to reassess architecture.
Root-Cause Gate
No root-cause evidence -> no final fix claim.
No reproduction or bounded limitation -> no root-cause claim.
Three failed fix attempts -> stop changing code and reassess the model.Mitigation is allowed only when the user needs containment. Label it mitigation, keep investigating, and do not present it as the fix.
The Process
symptom -> reproduce -> localize -> trace -> hypothesize -> patch -> verify -> report
| | | | | | | |
v v v v v v v v
signal command boundary source falsifier minimal original residualStep 1: Capture the Failure Contract
Expected Output: symptom=<observable failure>, expected=<behavior>, actual=<behavior>, artifact=<command|log|screenshot|trace>, environment=<known|unknown>
Start with the exact failure, not a theory:
git status --short
git branch --show-current
git rev-parse --show-toplevelCollect the command, log, stack trace, input, state, environment, commit, and expected behavior.
Useful capture commands:
git log --oneline -n 10
git diff --stat
git diff --name-status
rg -n "error message|exception class|failing symbol|route name" .If fails:
- No repo or artifact -> ask for the failing command, log, or affected file and mark the state
blocked: missing symptom. - Log is huge -> extract the first failure, stack top, stack bottom, and any repeated causal line.
- Failure is production-only -> collect safe logs and config facts first; do not invent local certainty.
Step 2: Reproduce or Bound the Failure
Expected Output: repro=<always|intermittent|not reproduced>, command=<exact command>, runs=<N>, failing signal=<line|assertion|status>
Run the smallest known reproduction. Prefer one test, one request, one build target, or one job step.
Common commands:
python -m pytest tests/path/test_file.py::test_name -q
npm test -- path/to/test.spec.ts
pnpm test path/to/test.spec.ts
go test ./path/to/package -run TestName -count=1
cargo test test_name -- --nocaptureFor flaky behavior, measure before editing:
for i in {1..20}; do python -m pytest tests/path/test_file.py::test_name -q || break; done
for i in {1..20}; do npm test -- path/to/test.spec.ts || break; doneIf fails:
- Cannot reproduce locally -> compare environment, dependencies, feature flags, data, time, timezone, locale, credentials, and network access.
- Reproduction takes too long -> make a narrower harness or log the limitation before proceeding.
- Failure disappears -> preserve the last known failing signal; do not claim fixed.
Step 3: Localize the Suspect Boundary
Expected Output: boundary=<component A -> component B>, narrowed=<file|function|config|data>, rejected=<hypotheses>
Identify where expected state turns into bad state. Change one variable at a time.
rg -n "failingFunction|errorCode|configKey|envVar|routeName|tableName" .
rg -n "timeout|retry|cache|lock|transaction|feature flag|migration|schema" .
rg -n "process\\.env|os\\.environ|dotenv|config\\.|settings\\." .Read both sides of the boundary: request/response, validation/defaults, transaction/query, fixture cleanup, working directory, env propagation, parsed model output, and allowlists.
If fails:
- Multiple boundaries look plausible -> add diagnostic logging at each boundary and run once.
- Search is noisy -> search sibling enum values, route names, JSON keys, table columns, and old error text.
- Boundary contains secrets or destructive operations -> load
agent-security-guardbefore probing.
Step 4: Trace Back to the Root Cause
Expected Output: root_cause=<source condition>, evidence=<trace>, falsifier=<what would disprove it>
Trace from the symptom to the source:
Where did the bad value appear?
|
+-- What code directly produced or accepted it?
|
+-- What called that code?
|
+-- What input, state, config, migration, dependency, or timing changed?
|
+-- Is this the earliest source that explains every symptom?Instrumentation example:
console.error("DEBUG boundary", {
value,
cwd: process.cwd(),
env: process.env.NODE_ENV,
stack: new Error().stack,
});git log --oneline -- path/to/suspect_file
git blame -L 40,90 path/to/suspect_file
git show --stat HEADRoot-cause statement format:
Root cause: <source condition> causes <bad intermediate state>, which reaches <failure point>.
Evidence: <command/log/test/code path>.
Falsifier: <specific observation that would make this hypothesis false>.Step 5: Compare Against Working Patterns
Expected Output: working_example=<file|none>, differences=<list>, chosen_delta=<minimal change>
Find nearby code that already succeeds. Do not patch until differences are explained.
rg -n "similarFunction|sameEndpoint|sameStatus|sameEvent|sameConfig" .
rg -n "success case|happy path|known good|fixture|factory" tests src app lib .Compare input shape, validation, state setup, dependency version, cleanup/order, and error handling. Record only differences that explain the observed failure.
If fails:
- No working example -> use docs, tests, schema, or old commit as the reference.
- Working example differs in many ways -> test one difference at a time.
- Reference contradicts current design -> pause and state the design mismatch before editing.
Step 6: Test the Hypothesis with One Variable
Expected Output: hypothesis=<one sentence>, test=<minimal observation>, result=<confirmed|rejected|inconclusive>
Use the scientific loop: state one hypothesis, pick one observation that can disprove it, run the narrow reproduction, then mark the result confirmed, rejected, or inconclusive.
Bad experiment:
# Changes timeout, mock, fixture, and assertion at once.
npm test -- path/to/test.spec.tsGood experiment:
# Only disables cache to test whether stale cache explains the failure.
DISABLE_CACHE=1 npm test -- path/to/test.spec.tsIf fails:
- Two attempts rejected -> revisit Step 3 and Step 4 instead of piling on guesses.
- Three attempted fixes failed -> stop and ask whether the architecture, test model, or requirement is wrong.
- The quickest action is a mitigation -> label it mitigation and continue root-cause work.
Step 7: Patch the Root Cause, Not the Symptom
Expected Output: fix=<minimal diff>, regression=<test|harness|manual path>, scope=<files changed>
Before editing, create or identify the failing check:
python -m pytest tests/path/test_file.py::test_name -q
npm test -- path/to/test.spec.ts
go test ./path/to/package -run TestName -count=1Patch rules:
- Change the earliest source that explains the failure.
- Keep the diff small; no unrelated cleanup.
- Add validation at each layer bad data crosses when the bug is caused by invalid input or unsafe state.
- Replace arbitrary sleeps with condition-based waits when the bug is timing-related.
- Add or update a regression test when the codebase has a test surface.
Condition wait pattern:
await waitFor(() => state.ready === true, "state.ready");Defense-in-depth layers: entry validation, domain invariant, environment guard, and safe forensic logging.
Step 8: Verify and Report
Expected Output: verified=<yes|no>, original_repro=<pass|fail|not available>, regressions=<pass|fail|not run>, residual=<list>
Run the original failure path plus relevant regressions:
python -m pytest tests/path/test_file.py::test_name -q
npm test -- path/to/test.spec.ts
npm test
go test ./...For flaky fixes, repeat the narrow check:
for i in {1..20}; do python -m pytest tests/path/test_file.py::test_name -q || break; doneFinal report format:
Root cause: <one sentence>.
Fix: <minimal change>.
Verification: <commands and results>.
Residual risk: <unrun tests, unavailable env, external dependency, or none identified>.Do not say "fixed" if the original reproduction was not rerun. Say best effort or not reproduced locally with the evidence gathered.
Bad/Good Debugging Patterns
Pattern 1: Patch Before Reproduction
Bad:
It is probably a timeout, so I increased the timeout and pushed the fix.Good:
Reproduced with `npm test -- checkout.spec.ts` 6/20 runs. The failure occurs before the payment mock emits `ready`. Replaced the fixed 100 ms sleep with a wait for the `ready` event and verified 20/20 runs.Pattern 2: Fixing Where the Error Appears
Bad:
`user.id` is undefined in `renderProfile`, so I added `user?.id`.Good:
`user.id` becomes undefined when `loadSession()` accepts an expired token and returns `{ user: {} }`. The fix rejects expired sessions at `loadSession()` and adds a regression for the expired-token path.Rationalization Table
| Rationalization | Why it fails |
| "The fix is obvious" | Obvious fixes often target the symptom; root cause proves where the change belongs. |
| "The test passed once" | A single pass does not prove a flaky failure is gone. Repeat the narrow check. |
| "No time to reproduce" | Skipping reproduction loses the only signal that proves success. Use mitigation language if containment is urgent. |
| "I changed several things to be safe" | Multiple changes destroy causality and can introduce hidden regressions. |
Red Flags
- You are editing before running or bounding the failing path.
- You are using "probably", "likely", "maybe", or "should fix it" as evidence.
- You are changing two variables before rerunning the reproduction.
- You are adding sleeps, retries, null checks, or optional chaining without explaining the source condition.
- You are fixing the stack-frame where the error surfaced without tracing who supplied the bad value.
- You are ignoring the first error and debugging later cascading errors.
- You have tried two fixes already and are preparing a third without a sharper hypothesis.
- You have tried three fixes and still have no root cause.
Common Pitfalls
| Symptom | Root cause | Fix |
| Bug returns after a "small" patch | The patch masked the symptom instead of changing the source condition | Trace backward to the first bad value or state transition and patch there |
| Test passes locally but fails in CI | Environment, order, time, cache, path, dependency, or resource limit differs | Capture CI facts, reproduce the difference, and remove the hidden assumption |
| Flaky test gets slower but not stable | Arbitrary sleep guesses at timing | Wait for the actual condition with timeout and clear failure message |
| New fix breaks another path | Multiple variables changed or invariant was not understood | Revert experiments, isolate one hypothesis, and add a regression for both paths |
| Third fix attempt starts | Architecture or mental model may be wrong | Stop editing; summarize attempts, evidence, and the model that needs reassessment |
Verification Checklist
- Failure contract records expected behavior, actual behavior, artifact, and environment.
- Original failure is reproduced, measured as flaky, or explicitly bounded as not reproducible.
- Suspect boundary is named and at least one alternative hypothesis is rejected.
- Root-cause statement explains source condition, bad intermediate state, and failure point.
- Any experiment changes one variable and has a result of confirmed, rejected, or inconclusive.
- Fix targets the root cause rather than only the visible symptom.
- Regression test, harness, or manual reproduction covers the original failure path.
- Verification reruns the original failure path and relevant wider tests when available.
- Residual risk states unrun tests, unavailable environments, external dependencies, or none identified.
Interaction with Other Skills
| Related Skill | Trigger | Handoff |
| test-design-workflow | Need regression, boundary, or flaky-test coverage | Convert root cause into tests |
| code-review-workflow | Fix needs risk review before merge | Review the verified diff |
| observability-workflow | Logs, metrics, or traces are insufficient | Design durable signals |
| incident-retro-workflow | Production issue is restored | Build timeline and action items |
| agent-security-guard | Debugging touches secrets, auth, shell, production data, or LLM-tool boundaries | Gate the risky operation |
| cross-model-verification | Root cause remains uncertain or blast radius is high | Request adversarial pass |
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.

