AGENT SKILL
systematic-debugging
Structured four-phase debugging protocol with attempt cap and escalation
- License 许可
- MIT
- 最近更新
- 2026-09-25
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- systematic-debugging
- description
- Structured four-phase debugging protocol with attempt cap and escalation
03 SKILL.md 正文
Systematic Debugging Skill
A structured debugging protocol that replaces ad hoc fix attempts. When something breaks, follow this protocol instead of making rapid guesses.
Trigger Conditions
- A test that was passing starts failing
- An implementation fails its acceptance criteria
- Two consecutive failed fix attempts
The Four Phases
Phase 1: Evidence Gathering
Collect all evidence before forming any hypothesis. Do not change code.
- Read the error output carefully. Copy exact error messages and stack traces.
- Reproduce the issue reliably.
- Identify the exact trigger — smallest reproduction case.
- Review recent changes (
git log,git diff). - Record the evidence.
Phase 2: Pattern Analysis
Analyze evidence to understand the failure pattern. Still no code changes.
- Compare working vs. broken states.
- Identify what changed since it last worked.
- Narrow the scope — simplify reproduction case.
- Look for patterns: type error, missing import, state mutation, resource exhaustion, config difference.
Phase 3: Hypothesis Testing
Form and test hypotheses systematically.
- Form a specific hypothesis: "The failure occurs because X, and if I change Y, the test will pass."
- Design a test for the hypothesis before making changes.
- Make the minimal change to test it. Run the failing test.
- Record the result — confirmed or refuted.
- If refuted, form a new hypothesis using the new evidence.
Phase 4: Root Cause Fix
Once a hypothesis is confirmed:
- Fix the root cause, not the symptom.
- Verify the fix — run the originally failing test.
- Check for regressions — run the full test suite.
- Review the fix — is it the right fix or a workaround?
Three-Attempt Cap
After three failed fix attempts, STOP.
- Revert any partial or broken changes.
- Document what was tried (hypothesis, change, expected result, actual result for each attempt).
- Escalate with: original error, evidence, pattern analysis, three hypotheses and results, recommendation.
- Wait for guidance.
Audit Trail
Every debugging session must produce a written record:
- Evidence collected
- Hypotheses formed
- Test results for each hypothesis
- Resolution or escalation
If working within a ticket, add a ## Debug Log section to the ticket
plan file.