systematic-debugging
Skill2 starsChanged 2 months agoMITView on GitHub
Use when debugging any bug, test failure, unexpected behavior, or performance issue before proposing fixes. Don't use for feature additions, code generation, or routine refactoring.
191 other projects use a version of this.
Adopted by
Most recently taken up by
- NousResearch/hermes-agenttheir own version, first seen Nov 13, 2026
- andreymudri/fleetmatestheir own version, first seen Oct 5, 2026
- fmind/dottheir own version, first seen Oct 5, 2026
- Integralist/agent-skillstheir own version, first seen Oct 4, 2026
- asta-nguyen/kamehadbtheir own version, first seen Oct 4, 2026
- LayneChai/superpowers-dshtheir own version, first seen Oct 3, 2026
Used with
Projects with it also use diagnosing-superpowers, building-chatgpt-apps 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.
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 6 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
MorningStar0709Skillchinese-git-workflow
Configure Git for domestic platforms and manage branching strategies suitable for Chinese teams. Use when the user asks to configure remotes, set up SSH, or manage Git workflows for Gitee, Coding, Jihu GitLab, or CNB, including requests like "配置国内 Git", "设置 Gitee 远程仓库", "推荐适合小团队的 Git 流程".
Also in 4 projects that use this
- +8 more from mjunaidca
Other versions191 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 191
- obra/superpowers★ 314ksame name
- NousResearch/hermes-agent★ 267ksame name
- open-metadata/OpenMetadata★ 15ksame name
- jnMetaCode/superpowers-zh★ 8.3ksame name
- openai/plugins★ 7.3ksame name
- ChrisWiles/claude-code-showcase★ 6.1ksame name
- microsoft/FluidFramework★ 4.9ksame name
- compozy/compozy★ 2.8ksame name
- GanyuanRan/Aegis★ 1.3ksame name
- SethGammon/Citadel★ 922same name
181 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 repository24 other files it gives its agents.
- brainstormingSkill
- codebase-designSkill
- code-reviewSkill
- conventional-commitSkill
- copy-web-designSkill
- executing-plansSkill
- frontend-designSkill
- i18nSkill
- laravelSkill
- prototypeSkill
- reactSkill
- s13nSkill
- security-auditSkill
- summarizeSkill
- technical-writingSkill
- testing-patternsSkill
- ui-motionSkill
- ui-ux-reviewSkill
- unslopSkill
- upsert-codebase-docsSkill
- verification-before-completionSkill
- workspace-onboardingSkill
- writing-for-agentsSkill
- writing-plansSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. 0 are common, 17 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 173 edited versions we read keep these.
17
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 11
Do not write code, edit files, or propose fixes until Phase 1 investigation is complete.
- Distinctive: line 16
Use this workflow for any technical fault:
- Distinctive: line 17
Test failures and regressions
- Distinctive: line 33
Error inspection: Read stack traces, error messages, and logs in full.
- Distinctive: line 42
Boundary instrumentation: If the fault spans multiple layers or services such as CI workflows, build scripts, API services, or databases, …
- Very specific: line 45
Upstream data flow tracing: If the error originates deep in the call stack, trace bad values backward to their origin.
- Distinctive: line 48
Large-scale scope and context compaction defense: If the investigation requires surveying massive logs, hundreds of database files, or …
- Distinctive: line 69
Test assumptions with isolated probes.
- Distinctive: line 71
Falsifiable hypothesis: Write a single hypothesis specifying the cause and the expected outcome.
- Distinctive: line 83
Failing regression test: Write the simplest reproducible automated test case that exposes the root cause before changing implementation …
- Distinctive: line 88
Never reformat, "improve", or refactor adjacent unbroken code or comments.
- Distinctive: line 89
Do not delete pre-existing dead code unless explicitly requested.
- Very specific: line 93
Verification: Run the reproduction test and the broader test suite to confirm the fix works without regressions.
- Distinctive: line 97
If fix 1 or fix 2 fails, return to Phase 1 to re-evaluate evidence.
- Distinctive: line 98
If 3 fixes fail consecutively, stop immediately.
- Distinctive: line 109
When you reach 3 failed fixes:
- Distinctive: line 112
Document the 3 failed approaches and the architectural conflict they revealed.
- Distinctive: line 113
Stop and ask the human partner to discuss redesigning the module boundary or data model.
- Distinctive: line 117
When debugging multi-component systems, log state at each component boundary before proposing changes:
“Common” is measured: kept by at least 6 in 10 of the 173 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
Find the root cause before attempting fixes. Symptom fixes create new bugs and mask underlying flaws.
<HARD-GATE>
Do not write code, edit files, or propose fixes until Phase 1 investigation is complete. Every technical issue requires an identified root cause before implementation.
</HARD-GATE>When to use
Use this workflow for any technical fault:
- Test failures and regressions
- Production bugs and runtime crashes
- Unexpected behavior or corrupted state
- Performance bottlenecks
- Build failures and configuration faults
Apply this process especially when you feel pressure to apply a fast fix, when a previous fix failed, or when you have already attempted two or more changes.
The four phases
Complete each phase in order before moving to the next.
Phase 1. Root cause investigation
Gather evidence to explain what failed and why before touching production code.
- Error inspection. Read stack traces, error messages, and logs in full. Identify line numbers, file paths, and error codes without skipping warnings.
- Completion criterion. Exact error text, file path, failing line number, and initial call site identified in notes.
- Reproduction. Execute the minimal command, script, or test case that triggers the defect deterministically. Consult
references/reproduction-and-loops.mdfor fast feedback harness patterns, input minimization, and secret redaction rules.- Completion criterion. A single command or test triggers the failure consistently across consecutive runs.
- Change audit. Inspect git history and environment changes. Run
git diffagainst the last known working commit. Check recent dependency updates and configuration changes.- Completion criterion. List of modified files, dependencies, and settings mapped against the failure symptom.
- Boundary instrumentation. If the fault spans multiple layers or services such as CI workflows, build scripts, API services, or databases, add diagnostic logging at each boundary. Log inputs, outputs, and environment variables across each boundary before running again.
- Completion criterion. Diagnostic output isolates the exact boundary where expected state diverges.
- Upstream data flow tracing. If the error originates deep in the call stack, trace bad values backward to their origin. Consult
root-cause-tracing.mdin this directory for backward tracing instructions.- Completion criterion. Code location that produced the initial invalid value identified.
- Large-scale scope and context compaction defense. If the investigation requires surveying massive logs, hundreds of database files, or multi-repository history:
- Dispatch a dedicated
researchorselfsubagent viainvoke_subagentto isolate heavy tool outputs and prevent context window compaction in the primary agent session. - Persist intermediate findings directly to disk artifacts (
<appDataDir>/brain/<conversation-id>/orscratch/) instead of relying solely on chat memory. - Completion criterion. Heavy data collection delegated to a subagent and key synthesis written to a disk artifact.
- Dispatch a dedicated
Phase 1 exit criterion. The exact line of code, bad input, or environmental discrepancy causing the defect is identified.
Phase 2. Pattern analysis
Analyze the mechanism before designing a fix.
- Reference comparison. Locate similar working code in the same repository or official documentation. Read the reference implementation completely.
- Completion criterion. Working reference implementation identified and reviewed.
- Difference inventory. Compare the working reference against the failing code line by line. Note differences in arguments, types, lifecycle timing, environment dependencies, and caller assumptions.
- Completion criterion. Documented list of differences between working and broken components with zero unverified assumptions.
Phase 2 exit criterion. Structural and contextual differences between broken code and working code are documented.
Phase 3. Hypothesis and testing
Test assumptions with isolated probes.
- Falsifiable hypothesis. Write a single hypothesis specifying the cause and the expected outcome. Format as "The failure occurs because [cause], and changing [variable] will [outcome]."
- Completion criterion. Written hypothesis documented in working notes.
- Targeted probe. Make the smallest possible change to confirm or refute the hypothesis. Change one variable at a time. Do not apply a complete fix during this step.
- Completion criterion. Test or probe execution confirms or refutes the hypothesis. If refuted, return to Phase 1 with the new data.
Phase 3 exit criterion. Root cause hypothesis confirmed by probe results.
Phase 4. Implementation and verification
Apply the targeted fix at the source.
- Failing regression test. Write the simplest reproducible automated test case that exposes the root cause before changing implementation code. If testing frameworks are unavailable, create a standalone test script. Follow the
test-driven-developmentskill.- Completion criterion. Automated test fails with the expected error against unfixed code.
- Surgical root cause fix. Modify code strictly at the identified root cause.
- Touch only what must be changed to fix the defect. Match existing indentation and conventions.
- Never reformat, "improve", or refactor adjacent unbroken code or comments.
- Do not delete pre-existing dead code unless explicitly requested.
- Clean up only orphan variables, imports, or functions created by the fix.
- Completion criterion. Code edit confined strictly to the root cause with zero unrelated diff lines.
- Verification. Run the reproduction test and the broader test suite to confirm the fix works without regressions. Follow the
verification-before-completionskill.- Completion criterion. New test passes, all existing tests pass, and diagnostic logs confirm clean execution.
- Failure loop limit.
- If fix 1 or fix 2 fails, return to Phase 1 to re-evaluate evidence.
- If 3 fixes fail consecutively, stop immediately. Do not attempt a fourth fix. Question the architecture.
Phase 4 exit criterion. Automated test passes, full test suite passes, and root cause is resolved at the source.
Escalation for repeated failures
Three consecutive failed fixes signal an architectural flaw rather than a localized bug. Signs of architectural flaws include:
- Each fix introduces a new bug in a different component.
- The fix requires broad refactoring across multiple files.
- The fix requires complex workarounds to bypass existing abstractions.
When you reach 3 failed fixes:
- Halt all code modifications.
- Revert failed attempts to restore a clean state.
- Document the 3 failed approaches and the architectural conflict they revealed.
- Stop and ask the human partner to discuss redesigning the module boundary or data model.
Diagnostic instrumentation
When debugging multi-component systems, log state at each component boundary before proposing changes:
# Boundary 1: Workflow environment
echo "IDENTITY: ${IDENTITY:+SET}${IDENTITY:-UNSET}"
# Boundary 2: Build environment
env | grep IDENTITY || echo "IDENTITY not in environment"
# Boundary 3: Keychain access
security list-keychains
security find-identity -v
# Boundary 4: Signing invocation
codesign --sign "$IDENTITY" --verbose=4 "$APP"This instrumentation identifies the exact layer where data or environment variables fail to propagate.
Disclosed reference
Consult these files in this directory for specialized debugging techniques:
root-cause-tracing.mdfor backward tracing through call stacks.defense-in-depth.mdfor adding multi-layer validation after fixing root causes.condition-based-waiting.mdfor replacing arbitrary sleeps with condition polling.
Related skills to invoke during debugging:
test-driven-developmentfor writing red regression tests before fixing code.verification-before-completionfor verifying fixes before claiming resolution.
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.

