Best for
- Test failures
- Bugs in production
- Unexpected behavior
johnqtcg/awesome-skills/skills/systematic-debugging/SKILL.md
Use when debugging, diagnosing, or investigating any bug, test failure, flaky test, race condition, unexpected behavior, build failure, production incident, third-party breakage, root cause analysis, or performance regression before proposing fixes
Decision brief
Use when debugging, diagnosing, or investigating any bug, test failure, flaky test, race condition, unexpected behavior, build failure, production incident, third-party breakage, root cause analysis, or performance regression before proposing fixes
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/johnqtcg/awesome-skills --skill "skills/systematic-debugging"Inspect the Agent Skill "systematic-debugging" from https://github.com/johnqtcg/awesome-skills/blob/d63cf368c1b106871b56454bd73c293701bef500/skills/systematic-debugging/SKILL.md at commit d63cf368c1b106871b56454bd73c293701bef500. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
BEFORE attempting ANY fix:
Find the pattern before fixing:
1. Form Single Hypothesis - State clearly: "I think X is the root cause because Y" - Write it down - Be specific, not vague
1. Create Failing Test Case - Simplest possible reproduction - Automated test if possible - One-off test script if no framework - MUST have before fixing - Use the tdd-workflow skill for writing proper failing tests
If you catch yourself thinking: - "Quick fix for now, investigate later" - "Just try changing X and see if it works" - "Add multiple changes, run tests" - "Skip the test, I'll manually verify" - "It's probably X, let me fix that" - "I don't fully understand but this might work"…
Permission review
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 97/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 30 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Random fixes waste time and create new bugs. Quick patches mask underlying issues and usually force a second debugging cycle.
Core principle: ALWAYS find root cause before attempting a permanent fix. Symptom fixes are failure.
Debugging report quality is part of the job. A report that lists guesses without evidence is not a passing debugging result.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
If you haven't completed Phase 1, you cannot propose fixes.
Adding temporary code to collect evidence is NOT a fix. The following are explicitly permitted during Phase 1 investigation:
fmt.Println, console.log, print(), logging.debug())df -h, lsof, strace, tcpdump) to observe runtime stateRules:
// DEBUG-INVESTIGATION or # DIAG)Use for ANY technical issue:
Use this ESPECIALLY when:
Before entering the four phases, classify the issue. Different severity levels get different treatment:
+----------+---------------------+-----------------------------+------------------+
| Severity | Characteristics | Strategy | Time Budget |
+----------+---------------------+-----------------------------+------------------+
| P0 | Production down, | 1. MITIGATE first (rollback | Mitigate: <15min |
| Critical | data loss, revenue | feature flag, fallback) | Root cause: async|
| | impact, security | 2. Root cause AFTER stable | |
+----------+---------------------+-----------------------------+------------------+
| P1 | Feature broken, | Full 4-phase process | 30-60min |
| High | blocking users, | No shortcuts | |
| | test suite failing | | |
+----------+---------------------+-----------------------------+------------------+
| P2 | Minor bug, cosmetic | Simplified: Phase 1 + 4 | 15-30min |
| Medium | edge case, non- | (skip Pattern Analysis if | |
| | blocking | cause is obvious) | |
+----------+---------------------+-----------------------------+------------------+
For production emergencies, the priority is stopping the bleeding:
Mitigate immediately (pick the fastest safe option):
Verify mitigation works - confirm service is restored
THEN launch full root cause investigation (Phases 1-4)
Why this isn't "skipping the process": Mitigation and root cause fixing are separate concerns. Stopping revenue loss is an operational decision, not a debugging decision. The debugging process applies to the permanent fix.
Different bug types need different investigation strategies:
| Bug Type | Primary Investigation | Key Tools/Techniques |
|---|---|---|
| Logic error / wrong output | Trace data flow backward | Debugger, print statements, references/root-cause-tracing.md |
| Race condition / flaky test | Identify shared mutable state | -race flag (Go), thread sanitizer, references/condition-based-waiting.md |
| Memory leak / perf regression | Profile before hypothesizing | pprof (Go), Chrome DevTools, time/perf |
| Environment / "works on my machine" | Diff environments systematically; run environment health check (Phase 1 step 4) | df -h, free -h, lsof, dmesg, env, Docker, dependency versions |
| Third-party dependency change | Check changelogs and version diffs | git log, go mod graph, npm ls |
| Build / compilation error | Read error message literally | Usually Phase 1 step 1 is sufficient |
| Configuration error | Validate config propagation layer by layer | Phase 1 step 4 (multi-component evidence) |
See references/bug-type-strategies.md for detailed per-type guidance.
Do not propose a permanent fix until you can state:
If the issue spans multiple components or boundaries, gather evidence at each boundary before selecting a fix.
Required evidence types:
One hypothesis at a time. One minimal test per hypothesis. No bundled changes.
If 3 hypotheses or 3 fixes have failed, stop and question the architecture or mental model. Do not push to Fix #4 without escalation.
Never claim a command, profile, race run, trace, or verification was executed unless it actually ran.
If not run, say:
Not run in this environmentYou MUST complete each phase before proceeding to the next.
BEFORE attempting ANY fix:
Read Error Messages Carefully
Reproduce Consistently
Check Recent Changes
Check Environment Health
WHEN symptoms include: intermittent failures, timeouts, "works on my machine", silent process death, or no obvious code cause:
Rule out infrastructure and OS-level issues BEFORE diving into code. Minimum checklist:
df -hfree -h && dmesg | grep -i oom (Linux) or top -l 1 | head -20 (macOS)lsof -i :<port>nslookup <hostname> and curl -v <endpoint>ulimit -admesg | tail -50 or log show --last 10mIf environment is unhealthy, fix that first. A broken machine is not a code bug.
Gather Evidence in Multi-Component Systems
WHEN system has multiple components (CI → build → signing, API → service → database):
Before proposing fixes, instrument each boundary. For EACH component boundary:
Run once, identify the exact failing boundary, then narrow the investigation to that layer.
Trace Data Flow
WHEN error is deep in call stack:
See references/root-cause-tracing.md for the complete backward tracing technique.
Quick version:
Use Parallel Investigation for Complex Systems
WHEN system has 3+ components or investigation is slow:
Launch independent tracks in parallel when possible:
Use the Agent tool for parallel tracks, then synthesize the results before choosing a fix.
Find the pattern before fixing:
Find Working Examples
Compare Against References
Identify Differences
Understand Dependencies
Scientific method:
Form Single Hypothesis
Test Minimally
Verify Before Continuing
When You Don't Know
Maintain a Hypothesis Log
Track what you've tried to avoid circular investigation:
| # | Hypothesis | Evidence For | Evidence Against | Result | Time |
|---|-------------------------|-----------------|------------------------|----------|------|
| 1 | Empty config path | Error at line 42| Config file exists | Rejected | 8min |
| 2 | Race in goroutine pool | Flaky under load| Passes with -race | Rejected | 12min|
| 3 | Stale cache after deploy | Cache TTL=1h | Deploy was 2h ago | CONFIRMED| 5min |
Time-box each hypothesis: Max 15-20 minutes per hypothesis. If you can't confirm or reject within the time-box, note what's blocking and move to the next hypothesis. Return later with more information.
After 3 rejected hypotheses: STOP. You likely have a wrong mental model of the system. Re-read Phase 1 evidence. Consider asking someone who knows the codebase.
Create Failing Test Case
tdd-workflow skill for writing proper failing testsImplement Single Fix
Verify Fix
If Fix Doesn't Work
If 3+ Fixes Failed: Question Architecture
Pattern indicating architectural problem:
STOP and question fundamentals:
Discuss with your human partner before attempting more fixes
This is NOT a failed hypothesis - this is a wrong architecture.
Every debugging report MUST include a scorecard verdict. Use references/debugging-report-scorecard.md and include the result in the final report.
Any FAIL in this tier means the whole debugging result is FAIL.
| ID | Requirement |
|---|---|
| C1 | No permanent fix proposed before Phases 1-3 evidence exists |
| C2 | Root cause is stated as a cause, not a symptom |
| C3 | Root cause is backed by concrete evidence from reproduction, trace, profile, or boundary instrumentation |
| C4 | Hypothesis log exists and matches the investigation path taken |
Pass at least 4 of 6.
| ID | Requirement |
|---|---|
| S1 | Reproduction includes exact commands or steps |
| S2 | Evidence covers all relevant component boundaries |
| S3 | Fix scope is minimal and justified |
| S4 | Verification uses explicit commands and expected result |
| S5 | Residual risks and follow-ups are honest and specific |
| S6 | If 3+ fixes failed, the report explicitly questions architecture |
Pass at least 3 of 4.
| ID | Requirement |
|---|---|
| H1 | Report follows the output contract order |
| H2 | Severity and bug type are classified |
| H3 | Owners / ETA are included when follow-ups exist |
| H4 | Wording is concise and avoids filler or hand-waving |
Always report:
{
"scorecard": {
"critical": "PASS|FAIL",
"standard": "x/6",
"hygiene": "y/4",
"overall": "PASS|FAIL"
}
}
Interpretation:
If you catch yourself thinking:
ALL of these mean: STOP. Return to Phase 1.
If 3+ fixes failed: Question the architecture (see Phase 4.5)
Watch for these redirections:
When you see these: STOP. Return to Phase 1.
These are behavioral constraints, not cosmetic writing advice. The full BAD/GOOD library lives in references/bad-good-debugging-reports.md.
Required anti-example coverage:
P0 shortcut: Triage -> Mitigate -> Verify mitigation -> THEN Phases 1-4 for permanent fix.
When the bug appears deep in the stack, the bad value origin is unclear, or you need to trace caller-to-source:
→ Load references/root-cause-tracing.md for backward tracing technique — call chain mapping, value-origin tracking templates, and structured evidence collection from callers to root source.
When the root cause is invalid data, unsafe state transition, or a missing guard at one of several layers:
→ Load references/defense-in-depth.md for multi-layer guard patterns, layer responsibility matrix, and fix templates that address defense at the correct layer rather than patching symptoms.
When flaky tests, retries, sleeps, polling loops, or async timing issues appear:
→ Load references/condition-based-waiting.md for condition-based wait patterns, polling/retry templates, race condition detection strategies, and Go -race / thread sanitizer usage.
When the bug type is unclear, symptoms overlap multiple categories, or you need a per-class strategy:
→ Load references/bug-type-strategies.md for the 8-type bug classification matrix (logic error, race condition, data corruption, resource leak, config error, integration failure, performance regression, flaky test) with tailored investigation strategies.
When writing the final debugging report or verifying report completeness against the required sections:
→ Load references/output-contract-template.md for the 9-section output contract template (Triage, Reproduction, Evidence, Hypothesis log, Root cause, Fix plan, Verification, Residual risk, Scorecard).
When grading the quality of a debugging report or deciding PASS vs FAIL on report completeness:
→ Load references/debugging-report-scorecard.md for the scorecard rubric with per-section PASS/FAIL criteria and total score thresholds.
When the report quality is weak, overly hand-wavy, or you need concrete improvement patterns:
→ Load references/bad-good-debugging-reports.md for the BAD/GOOD library of report anti-patterns — vague diagnosis, missing reproduction steps, unverified fixes, and hand-wavy root cause claims with corrected alternatives.
When a test suite introduces filesystem or state pollution and you need to isolate the polluting test:
→ Run scripts/find-polluter.sh for automated binary-search isolation of the test that causes pollution, with before/after state diffs.
Related skills:
tdd-workflow - For creating failing test case (Phase 4, Step 1)unit-test - Add/extend regression tests after root-cause fixgo-code-reviewer - Validate risk and regression impact of fixReturn debugging outputs using references/output-contract-template.md.
Minimum required order:
Minimum quality requirements:
Run all regression checks when editing this skill:
./scripts/run_regression.sh
That wrapper must execute:
python3 -m unittest discover -s scripts/tests -p 'test_*.py' -v./scripts/find-polluter.sh --helpFrequently asked questions
Use when debugging, diagnosing, or investigating any bug, test failure, flaky test, race condition, unexpected behavior, build failure, production incident, third-party breakage, root cause analysis, or performance regression before proposing fixes
The source record exposes this install command: npx skills add https://github.com/johnqtcg/awesome-skills --skill "skills/systematic-debugging". Inspect the command and pinned source before running it.
Alternatives
magnus919/agent-skills
4-phase root cause debugging protocol: understand bugs before fixing. Use for ANY technical issue — test failures, production bugs, unexpected behavior, performance problems, build failures, or integration issues. ESPECIALLY when under time pressure, when "one quick fix" seems obvious, or when previous fix attempts have failed.
moltis-org/moltis
Use when encountering any bug, test failure, or unexpected behavior. 4-phase root cause investigation — NO fixes without understanding the problem first.
jamditis/claude-skills-journalism
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
mateaix/mateclaw
4-phase root cause debugging: understand bugs before fixing.