systematic-debugging
4-phase debugging process (Observe, Hypothesize, Test, Fix) for complex issues. Use when debugging fails, investigating flaky tests, tracking root causes, or facing mysterious bugs. DO NOT USE FOR: writing new tests (use test-driven-development), React component test patterns (use ui-testing), or E2E test setup (use webapp-testing).
- License 许可
- MIT
- 最近更新
- 2026-08-16
- Stars
- ★ 3
- Forks
- 0
01 前言 Front Matter
- name
- systematic-debugging
- description
- 4-phase debugging process (Observe, Hypothesize, Test, Fix) for complex issues. Use when debugging fails, investigating flaky tests, tracking root causes, or facing mysterious bugs. DO NOT USE FOR: writing new tests (use test-driven-development), React component test patterns (use ui-testing), or E2E test setup (use webapp-testing).
02 资源文件 1
- 参考文档debugging-phases.md5.4 KB
03 SKILL.md 正文
Systematic Debugging
Evidence-based debugging methodology using a structured 4-phase approach.
When to Use
- Initial debugging attempts failed
- Bug is intermittent or hard to reproduce
- Multiple potential root causes
- High-stakes fix (production, security)
- Teaching debugging skills
The 4-Phase Process
┌─────────────┐ ┌──────────────┐ ┌─────────────┐ ┌─────────────┐
│ 1. OBSERVE │ -> │ 2. HYPOTHESIZE│ -> │ 3. TEST │ -> │ 4. FIX │
│ │ │ │ │ │ │ │
│ Gather data │ │ Form theories│ │ Validate │ │ Implement & │
│ Don't assume│ │ Rank by │ │ One at a │ │ Verify │
│ │ │ likelihood │ │ time │ │ │
└─────────────┘ └──────────────┘ └─────────────┘ └─────────────┘
↑ │
└──────────────────────────────────────┘
(if hypothesis fails)
Phase 1: OBSERVE
Goal: Gather facts without assumptions.
Actions
- [ ] Document exact symptoms (error messages, behavior)
- [ ] Identify when it started (commit, deployment, date)
- [ ] Determine reproduction steps (or note if intermittent)
- [ ] Check logs, metrics, and monitoring
- [ ] Note what IS working (bounds the problem)
Questions to Answer
- What exactly is happening vs. expected?
- When did this start? What changed?
- Who/what is affected? (all users, some, specific conditions)
- Can I reproduce it? How reliably?
- What have I already tried?
Observation Log Template
## Bug: [Brief description]
### Symptoms
- [Exact error message or behavior]
### Timeline
- First reported: [date/time]
- Last known working: [date/time]
- Related changes: [commits, deploys]
### Reproduction
- Steps: [1, 2, 3...]
- Reliability: [always/sometimes/rarely]
- Environment: [local/staging/prod]
### What Works
- [Related functionality that IS working]
Phase 2: HYPOTHESIZE
Goal: Generate ranked theories based on evidence.
Generate Hypotheses
Based on observations, list possible causes:
- Most likely (evidence strongly supports)
- Possible (evidence partially supports)
- Unlikely but testable (low probability, easy to rule out)
Ranking Criteria
- Evidence fit: Does it explain ALL symptoms?
- Recency: Recent changes more likely than old code
- Complexity: Simpler explanations first (Occam's Razor)
- Testability: Can we prove/disprove it quickly?
Hypothesis Template
### Hypothesis: [Theory]
Evidence for:
- [Supporting observation]
Evidence against:
- [Contradicting observation]
How to test:
- [Specific test that proves/disproves]
Likelihood: [High/Medium/Low]
See debugging-phases.md for detailed phase guidance.
Phase 3: TEST
Goal: Validate one hypothesis at a time with evidence.
Testing Rules
- One variable at a time: Change only what tests the hypothesis
- Record everything: Document what you tried and results
- Preserve ability to undo: Don't make permanent changes while testing
- Set time limits: Timebox each hypothesis test
Test Log Template
### Testing: [Hypothesis]
Test approach:
- [What I'm changing/checking]
Result:
- [What happened]
Conclusion:
- [ ] Confirmed (proceed to Fix)
- [ ] Disproved (next hypothesis)
- [ ] Inconclusive (need different test)
Phase 4: FIX
Goal: Implement verified fix with confidence.
Fix Checklist
- [ ] Fix addresses confirmed root cause (not just symptoms)
- [ ] Fix is minimal (no unrelated changes)
- [ ] Added test that would catch regression
- [ ] Verified fix in same environment where bug occurred
- [ ] Documented what the bug was and how it was fixed
Post-Fix Verification
- [ ] Original reproduction steps no longer fail
- [ ] Related functionality still works
- [ ] No new errors in logs
- [ ] Performance not degraded
Quick Debugging Toolkit
Information Gathering
[CUSTOMIZE] Add your project's debugging commands:
- Log tailing: [command]
- Database queries: [tool/access]
- Metrics dashboard: [URL]
- Error tracking: [tool/URL]
Common Root Causes Checklist
- [ ] Recent deployment? Check release notes
- [ ] Environment difference? Compare configs
- [ ] Data issue? Check for bad/missing data
- [ ] Dependency update? Check lock files
- [ ] Race condition? Check async code
- [ ] Resource exhaustion? Check memory/connections
- [ ] Permission change? Check access controls
Gotchas
| Trigger | Gotcha | Fix |
|---|---|---|
| Making multiple simultaneous changes to isolate the bug | Root cause becomes impossible to identify — can't know which change fixed it | Revert to baseline; apply one targeted change; verify; then proceed |
| Closing the bug without adding a regression test | Bug recurs under similar conditions undetected | Add a test that reproduces the original failure; confirm it is GREEN after the fix |
| Forming a hypothesis before completing Phase 1 observations | Leads investigation down the wrong path; root cause stays unexamined | Complete Phase 1 (Observe) fully before proposing any hypothesis |
| Applying changes directly in the production environment | Risk of cascading failure or data corruption | Reproduce locally first; use staging environments or feature flags |
| Ending the session without updating the observation log | Investigation must restart from scratch next session | Log dated observations before ending the session; commit the log |
| Making permanent code changes while testing hypotheses | Progressive state contamination — hard to reason about current baseline | Preserve ability to undo each test step; use feature flags or branches |
| Fixing the symptom without root cause analysis | Bug recurs under different conditions | Follow the 4-phase protocol fully; document root cause before applying fix |
04 同仓库更多 Skills
webapp-testing
Playwright end-to-end testing guidance for web apps, with practical patterns and setup steps. Use when creating or improving browser-based E2E coverage, test stability, and CI execution. DO NOT USE FOR: React component tests (use ui-testing), canvas game interaction (use browser-canvas-testing), TDD workflow (use test-driven-development), debugging failures (use systematic-debugging), or randomized property tests (use property-based-testing).
verification-before-completion
Evidence-based verification checklist before marking work complete. Use before PRs, releases, marking tickets done, or any "I'm finished" declaration; also when naming a baseline commit for a differential suite claim, when designing a mutation campaign or red-run evidence, when making an absence claim, a universal claim, or a one-time demonstration offered as a standing guarantee, when attributing a measurement or claiming a sweep or verification loop is complete, and when stating what a check or a CI suite will do about a change. DO NOT USE FOR: post-merge cleanup or archival (use post-pr-review) or processing GitHub review comments (use code-review-intake).
validation-methodology
Reusable validation and review methodology for staged validation, failure triage, and prosecution-depth setup. Use when running validation ladders, triaging failures, or executing adversarial review passes. DO NOT USE FOR: CE Gate orchestration, specialist dispatch ownership, or step execution flow (keep those in Code-Conductor).
upstream-onboarding
Shared opening-phase protocol for upstream agents (Experience-Owner, Solution-Designer, Issue-Planner) and Code-Conductor when invoked on an existing GitHub issue. Renders a scaled context brief and runs a standards check on inherited work at each phase boundary. Use when a user-invocable agent receives a request referencing an existing GitHub issue and must load solution-authoring and upstream-onboarding at the opening phase. DO NOT USE FOR: subagent dispatches (which already operate within an assessed session context); post-merge review (use post-pr-review); research or non-tree subagents.
ui-testing
Resilient React component testing strategies focusing on user behavior. Use when writing or reviewing component-level React tests, fixing flaky component tests, or establishing React testing patterns. DO NOT USE FOR: Playwright E2E tests (use webapp-testing), canvas game interaction (use browser-canvas-testing), TDD workflow (use test-driven-development), debugging failures (use systematic-debugging), UI component design (use frontend-design), or randomized property tests (use property-based-testing).
ui-iteration
Reusable screenshot-driven UI polish workflow for iterative visual refinement. Use when improving layout, hierarchy, spacing, feedback, or Tailwind-based presentation through repeated review-and-adjust passes. DO NOT USE FOR: functional bug fixing, accessibility-only audits, or major redesign strategy work (use Code-Smith or frontend-design).