cc-dev-template 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/bin/install.js +165 -0
  2. package/package.json +24 -0
  3. package/src/agents/claude-md-agent.md +71 -0
  4. package/src/agents/decomposition-agent.md +103 -0
  5. package/src/agents/execution-agent.md +133 -0
  6. package/src/agents/rca-agent.md +158 -0
  7. package/src/agents/tdd-agent.md +163 -0
  8. package/src/commands/finalize.md +83 -0
  9. package/src/commands/prime.md +5 -0
  10. package/src/scripts/adr-list.js +170 -0
  11. package/src/scripts/adr-tags.js +125 -0
  12. package/src/scripts/merge-settings.js +187 -0
  13. package/src/scripts/statusline-config.json +7 -0
  14. package/src/scripts/statusline.js +365 -0
  15. package/src/scripts/validate-yaml.js +128 -0
  16. package/src/scripts/yaml-validation-hook.json +15 -0
  17. package/src/skills/orchestration/SKILL.md +127 -0
  18. package/src/skills/orchestration/references/debugging/describe.md +122 -0
  19. package/src/skills/orchestration/references/debugging/fix.md +110 -0
  20. package/src/skills/orchestration/references/debugging/learn.md +162 -0
  21. package/src/skills/orchestration/references/debugging/rca.md +84 -0
  22. package/src/skills/orchestration/references/debugging/verify.md +95 -0
  23. package/src/skills/orchestration/references/execution/complete.md +161 -0
  24. package/src/skills/orchestration/references/execution/start.md +66 -0
  25. package/src/skills/orchestration/references/execution/tasks.md +92 -0
  26. package/src/skills/orchestration/references/planning/draft.md +195 -0
  27. package/src/skills/orchestration/references/planning/explore.md +129 -0
  28. package/src/skills/orchestration/references/planning/finalize.md +169 -0
  29. package/src/skills/orchestration/references/planning/start.md +115 -0
  30. package/src/skills/orchestration/scripts/plan-status.js +283 -0
  31. package/src/skills/prompting/SKILL.md +123 -0
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: orchestration
3
+ description: Planning and execution workflows for feature development. Use when starting new features, debugging issues, executing approved plans, or resuming in-progress work.
4
+ ---
5
+
6
+ # Orchestration Skill
7
+
8
+ ## Purpose
9
+
10
+ This skill provides structured workflows for software development. Instead of ad-hoc work that drifts between sessions, orchestration ensures every task follows a repeatable process: requirements are captured, plans are validated, and execution is tracked.
11
+
12
+ **Who this is for**: Developers starting feature work, debugging issues, resuming in-progress plans, or executing approved plans.
13
+
14
+ **Success looks like**: The user knows exactly where they are in the workflow, what options they have, and can move forward with a single choice.
15
+
16
+ ## What To Do Now
17
+
18
+ Complete each step in order before proceeding to the next.
19
+
20
+ <steps>
21
+
22
+ <step name="Discover Project State">
23
+ Run the plan status script to find existing plans:
24
+
25
+ ```bash
26
+ node ~/.claude/scripts/plan-status.js
27
+ ```
28
+
29
+ This returns a list of plans with their current status (draft, approved, in_progress, completed).
30
+ </step>
31
+
32
+ <step name="Present Options to User">
33
+ Based on what you found, use `AskUserQuestion` to ask what the user wants to do.
34
+
35
+ **Build the options dynamically:**
36
+
37
+ - Always include: "Create a new plan"
38
+ - Always include: "Debug an issue"
39
+ - If draft plans exist: "Continue planning: [plan title]" for each
40
+ - If approved plans exist: "Execute: [plan title]" for each
41
+ - If in-progress execution exists: "Resume execution: [plan title]" for each
42
+ - If active debug sessions exist: "Continue debugging: [debug title]" for each
43
+ - Always include: "Something else" (free text option)
44
+
45
+ **Example AskUserQuestion:**
46
+
47
+ ```
48
+ Question: "What would you like to work on?"
49
+
50
+ Options (based on discovered state):
51
+ - "Create a new plan" - Start fresh with a new feature, enhancement, or refactor
52
+ - "Debug an issue" - Investigate and fix a bug using TDD
53
+ - "Execute: User Authentication" - Begin implementing this approved plan
54
+ - "Continue planning: API Refactor" - Resume drafting this incomplete plan
55
+ - "Something else" - Describe what you need
56
+ ```
57
+
58
+ Wait for the user's response before proceeding.
59
+ </step>
60
+
61
+ <step name="Route Based on User's Choice">
62
+ Once the user chooses, read the appropriate workflow file:
63
+
64
+ | User's Choice | Action |
65
+ |---------------|--------|
66
+ | "Create a new plan" | Read `references/planning/start.md` |
67
+ | "Debug an issue" | Read `references/debugging/describe.md` |
68
+ | "Execute: [plan]" | Store the plan slug, then read `references/execution/start.md` |
69
+ | "Continue planning: [plan]" | Store the plan slug, determine which planning phase to resume, then read that phase file |
70
+ | "Resume execution: [plan]" | Store the plan slug, then read `references/execution/tasks.md` |
71
+ | "Continue debugging: [debug]" | Store the debug slug, determine phase using debug resumption logic below |
72
+ | "Something else" | Address the user's custom request, or help them find the right workflow |
73
+
74
+ Reading the workflow file is mandatory—it contains the instructions for the next phase.
75
+ </step>
76
+
77
+ </steps>
78
+
79
+ ## Debug Phase Resumption Logic
80
+
81
+ When resuming a debug session, read `.claude/debug/[slug]/debug.yaml` and determine the phase:
82
+
83
+ | debug.yaml State | Resume Phase |
84
+ |------------------|--------------|
85
+ | `status: investigating`, no hypotheses | `references/debugging/rca.md` |
86
+ | `status: investigating`, hypothesis with `status: investigating` | `references/debugging/rca.md` |
87
+ | `status: investigating`, hypothesis with `status: verified` | `references/debugging/fix.md` |
88
+ | `status: investigating`, hypothesis with `status: disproven` | `references/debugging/rca.md` |
89
+ | `status: investigating`, hypothesis with `status: fixed` | `references/debugging/learn.md` |
90
+ | `status: closed` | Already complete, no action needed |
91
+
92
+ ## Important Notes
93
+
94
+ **Always use AskUserQuestion for choices.** Present options as structured choices, not open-ended questions. Include "Something else" as an escape hatch for cases that don't fit the standard options.
95
+
96
+ **Store context for later phases.** When the user selects a specific plan or debug session, remember the slug so subsequent phases can reference the correct directory at `.claude/plans/[slug]/` or `.claude/debug/[slug]/`.
97
+
98
+ **Keep this routing simple.** The goal is to get the user into the right workflow quickly. Detailed instructions live in the phase files, not here.
99
+
100
+ **Follow the workflow files.** Each phase file contains structured steps. Complete each step before proceeding to the next. The workflows are designed to be followed in order.
101
+
102
+ ## Workflow Overview
103
+
104
+ This skill supports three main workflows:
105
+
106
+ ### Planning Workflow
107
+ Transform a feature request into an approved, validated plan.
108
+
109
+ ```
110
+ start.md → explore.md → draft.md → finalize.md
111
+ ```
112
+
113
+ ### Execution Workflow
114
+ Transform an approved plan into working code.
115
+
116
+ ```
117
+ start.md → tasks.md → complete.md
118
+ ```
119
+
120
+ ### Debugging Workflow
121
+ Investigate and fix bugs using test-driven development.
122
+
123
+ ```
124
+ describe.md → rca.md → verify.md → fix.md → learn.md
125
+ ```
126
+
127
+ All workflows use progressive disclosure—each phase file contains only the instructions needed for that phase. Each phase file uses `<steps>`, `<checkpoint>`, and `<transition>` tags to structure the work.
@@ -0,0 +1,122 @@
1
+ # Debugging Phase 1: Describe
2
+
3
+ ## Purpose
4
+
5
+ Transform a vague bug report into a precise understanding of the symptom and expected behavior, then establish a clean test baseline before investigation begins.
6
+
7
+ **Success looks like**: Clear symptom, clear expected behavior, passing test suite baseline, relevant ADRs identified, and a `debug.yaml` artifact ready for investigation.
8
+
9
+ ## What To Do
10
+
11
+ <steps>
12
+
13
+ <step name="Capture the Symptom">
14
+ Ask the user: **"What's happening that shouldn't be?"**
15
+
16
+ Let them describe in their own words. Listen for:
17
+ - What they observe (the actual behavior)
18
+ - When it happens (trigger, conditions)
19
+ - How consistently it reproduces
20
+ </step>
21
+
22
+ <step name="Probe for Clarity">
23
+ Use `AskUserQuestion` to remove ambiguity. Ask one clarifying question at a time until the symptom is crystal clear.
24
+
25
+ Focus on: exact behavior observed, reproduction conditions, when it started, recent changes.
26
+
27
+ Always include an escape hatch option like "Let me explain" for context that doesn't fit your options.
28
+ </step>
29
+
30
+ <step name="Define Expected Behavior">
31
+ Ask: **"What should happen instead?"**
32
+
33
+ This becomes the acceptance criteria—when the code behaves this way, the bug is resolved.
34
+ </step>
35
+
36
+ <step name="Establish Baseline and Find ADRs">
37
+ Run in parallel:
38
+
39
+ **Run the test suite** to establish a clean starting point. If tests are already failing, address with the user before proceeding.
40
+
41
+ **Spawn adr-agent** to find relevant ADRs:
42
+
43
+ ```
44
+ Spawn adr-agent: "Find ADRs relevant to debugging [symptom summary] in [likely area]."
45
+ ```
46
+ </step>
47
+
48
+ <step name="Create the Debug Artifact">
49
+ Create `.claude/debug/[slug]/debug.yaml` with:
50
+
51
+ ```yaml
52
+ id: debug-[NNN]
53
+ slug: [generated-slug]
54
+ title: "[Short description]"
55
+ status: investigating
56
+ created: [today's date]
57
+
58
+ baseline:
59
+ test_command: "[command]"
60
+ result: pass
61
+ summary: "[X tests passed]"
62
+
63
+ symptom: |
64
+ [What the user described]
65
+
66
+ expected_behavior: |
67
+ [What should happen instead]
68
+
69
+ relevant_adrs:
70
+ - id: ADR-[XXX]
71
+ relevance: [Why it matters]
72
+
73
+ hypotheses: []
74
+ ```
75
+ </step>
76
+
77
+ <step name="Confirm and Proceed">
78
+ Summarize back to the user:
79
+
80
+ ```
81
+ ## Bug Report Captured
82
+
83
+ **Symptom**: [summary]
84
+ **Expected**: [summary]
85
+ **Baseline**: All tests passing
86
+ **Relevant ADRs**: [list or "None found"]
87
+
88
+ Ready to investigate root cause.
89
+ ```
90
+
91
+ ```
92
+ AskUserQuestion:
93
+ Question: "Does this capture the issue correctly?"
94
+ Options:
95
+ - "Yes, investigate" - Proceed to root cause analysis
96
+ - "Let me clarify" - I'll add more detail
97
+ - "Something else" - Different feedback
98
+ ```
99
+ </step>
100
+
101
+ <checkpoint>
102
+ Before proceeding:
103
+ - Symptom is clearly documented
104
+ - Expected behavior is defined
105
+ - Test baseline is established
106
+ - debug.yaml artifact is created
107
+ - User has confirmed the description
108
+ </checkpoint>
109
+
110
+ </steps>
111
+
112
+ ## Key Principles
113
+
114
+ **Invest time in clarity.** A precise symptom makes root cause analysis faster. Ambiguity discovered now is cheap; ambiguity discovered mid-investigation wastes effort.
115
+
116
+ **Establish baseline before investigating.** Running tests first prevents confusion about whether failures are from the bug or pre-existing.
117
+
118
+ **Document everything in debug.yaml.** The artifact is the source of truth for future phases.
119
+
120
+ <transition>
121
+ When the user confirms the description is accurate, read `references/debugging/rca.md` to begin root cause analysis.
122
+ </transition>
@@ -0,0 +1,110 @@
1
+ # Debugging Phase 4: Fix
2
+
3
+ ## Purpose
4
+
5
+ Fix the code to make the failing test pass. The test is the specification—your job is to make the code conform without modifying the test.
6
+
7
+ **Success looks like**: The test passes, full test suite passes (no regressions), and only non-test files were modified.
8
+
9
+ ## What To Do
10
+
11
+ <steps>
12
+
13
+ <step name="Spawn TDD Agent">
14
+ Spawn tdd-agent to fix the code:
15
+
16
+ ```
17
+ Spawn tdd-agent: "Fix the code to pass the failing test in [debug-path]/debug.yaml."
18
+ ```
19
+
20
+ The agent reads the debug context, fixes the code without modifying test files, runs the test, and updates debug.yaml with the result.
21
+ </step>
22
+
23
+ <step name="Verify Result">
24
+ When the agent returns:
25
+
26
+ **If test passes**: Check for regressions by running the full test suite. Compare against baseline from debug.yaml.
27
+
28
+ **If test still fails**:
29
+ ```
30
+ AskUserQuestion:
31
+ Question: "The test still fails. How should we proceed?"
32
+ Options:
33
+ - "Keep fixing" - Spawn the agent again
34
+ - "Review the fix" - Let me see what was changed
35
+ - "Different approach" - Reconsider the hypothesis
36
+ - "Something else" - Different feedback
37
+ ```
38
+
39
+ **If regressions introduced**:
40
+ ```
41
+ AskUserQuestion:
42
+ Question: "The fix introduced [N] test failures. How should we proceed?"
43
+ Options:
44
+ - "Fix regressions" - Address the new failures
45
+ - "Review changes" - Let me see what caused this
46
+ - "Revert" - Try a different approach
47
+ - "Something else" - Different feedback
48
+ ```
49
+ </step>
50
+
51
+ <step name="Update Debug Status">
52
+ Once test passes with no regressions, update debug.yaml:
53
+
54
+ ```yaml
55
+ hypotheses:
56
+ - id: h[N]
57
+ status: fixed
58
+
59
+ resolution:
60
+ description: |
61
+ [What was fixed and why]
62
+ hypothesis_id: h[N]
63
+ files_changed:
64
+ - [list of modified files]
65
+ ```
66
+
67
+ Present to user:
68
+
69
+ ```
70
+ ## Bug Fixed
71
+
72
+ **Hypothesis**: [description]
73
+ **Fix**: [what was changed]
74
+ **Test**: Passes
75
+ **Regressions**: None
76
+
77
+ Ready for the learning phase.
78
+ ```
79
+
80
+ ```
81
+ AskUserQuestion:
82
+ Question: "The bug is fixed. Ready to capture learnings?"
83
+ Options:
84
+ - "Yes, continue" - Proceed to learning phase
85
+ - "Let me verify" - I want to test more
86
+ - "Something else" - Different feedback
87
+ ```
88
+ </step>
89
+
90
+ <checkpoint>
91
+ Before proceeding:
92
+ - tdd-agent fixed the code
93
+ - Test passes
94
+ - Full test suite passes (no regressions)
95
+ - debug.yaml resolution is updated
96
+ </checkpoint>
97
+
98
+ </steps>
99
+
100
+ ## Key Principles
101
+
102
+ **Test is the specification.** Don't modify the test—make the code conform.
103
+
104
+ **Check for regressions.** A fix that breaks other things isn't a fix.
105
+
106
+ **Document the resolution.** debug.yaml captures what was done for future reference.
107
+
108
+ <transition>
109
+ When the fix is complete and verified, read `references/debugging/learn.md` to capture learnings.
110
+ </transition>
@@ -0,0 +1,162 @@
1
+ # Debugging Phase 5: Learn
2
+
3
+ ## Purpose
4
+
5
+ Verify the fix works from the user's perspective, capture learnings, and close the debug session.
6
+
7
+ **Success looks like**: User has verified the fix, learnings are captured, ADR created if applicable, debug session closed.
8
+
9
+ ## What To Do
10
+
11
+ <steps>
12
+
13
+ <step name="Present Summary for Human Review">
14
+ Summarize what was done:
15
+
16
+ ```
17
+ ## Debug Summary: [title]
18
+
19
+ **Symptom**: [what was broken]
20
+ **Root Cause**: [the verified hypothesis]
21
+ **Fix**: [what was changed]
22
+ **Files Changed**: [list]
23
+ **Test Added**: [test file] - verifies [behavior]
24
+
25
+ ### Ready for Verification
26
+
27
+ Please verify the fix works:
28
+ - Does the original symptom still occur?
29
+ - Does the expected behavior now work correctly?
30
+ ```
31
+ </step>
32
+
33
+ <step name="Get User Verification">
34
+ ```
35
+ AskUserQuestion:
36
+ Question: "Please verify the bug is fixed. Does the expected behavior work correctly now?"
37
+ Options:
38
+ - "Yes, verified" - Proceed to capture learnings
39
+ - "Not quite" - There's still an issue
40
+ - "Need to test more" - I want to check more scenarios
41
+ - "Something else" - Different feedback
42
+ ```
43
+
44
+ **If "Not quite"**: Determine if it's the same symptom (back to RCA), a different issue (new debug session), or an edge case (enhance the fix).
45
+ </step>
46
+
47
+ <step name="Evaluate Learnings">
48
+ Once verified, evaluate what we learned for documentation. Apply these criteria yourself and tell the user your assessment.
49
+
50
+ **ADR Evaluation** - Ask: "If we had this ADR before, would we have avoided the bug?"
51
+
52
+ ADR-worthy patterns:
53
+ - Guardrails: "Async handlers must await before updating UI state"
54
+ - Conventions: "All API responses must include timestamp for cache busting"
55
+ - Patterns: "Always invalidate cache after upload operations"
56
+
57
+ Not ADR-worthy:
58
+ - Typos or syntax errors
59
+ - One-off logic errors with no generalizable lesson
60
+ - Bugs in third-party code
61
+ - Implementation details specific to this feature
62
+
63
+ **CLAUDE.md Evaluation** - Ask: "Is this non-obvious knowledge that changes how someone works?"
64
+
65
+ CLAUDE.md-worthy:
66
+ - Gotchas discovered: "Must restart Claude Code after changing hooks"
67
+ - Non-obvious behaviors: "API returns 200 even on validation failure"
68
+ - Workflow patterns: "Always run migration before tests in this project"
69
+
70
+ Not CLAUDE.md-worthy:
71
+ - Standard practices obvious to any developer
72
+ - Information already in README or package.json
73
+ - One-time debugging steps
74
+
75
+ **Present your assessment** - Tell the user what you found:
76
+
77
+ ```
78
+ ## Learnings Assessment
79
+
80
+ **ADR**: [Your assessment - either "I identified a pattern worth documenting: [description]" OR "No ADR needed - this was [reason: typo/one-off/third-party bug/etc]"]
81
+
82
+ **CLAUDE.md**: [Your assessment - either "I identified tribal knowledge worth capturing: [description]" OR "No CLAUDE.md update needed - [reason]"]
83
+ ```
84
+
85
+ If user disagrees with your assessment, adjust accordingly.
86
+ </step>
87
+
88
+ <step name="Capture Learnings">
89
+ Based on your assessment (adjusted for any user feedback):
90
+
91
+ **If ADR identified:**
92
+ ```
93
+ Spawn adr-agent: "Create an ADR for: [pattern]. Context from debugging [title]: Root cause was [hypothesis]. This pattern prevents [class of bugs]."
94
+ ```
95
+
96
+ **If CLAUDE.md learning identified:**
97
+ ```
98
+ Spawn claude-md-agent: "Add to CLAUDE.md: [learning]. Discovered while debugging [title]. This is non-obvious because [reason]."
99
+ ```
100
+
101
+ **If neither identified:** Proceed directly to closing the session.
102
+ </step>
103
+
104
+ <step name="Close Debug Session">
105
+ Update debug.yaml:
106
+
107
+ ```yaml
108
+ status: closed
109
+
110
+ resolution:
111
+ verified_by_user: true
112
+
113
+ learning:
114
+ adr_created: ADR-[NNN] # or null if none identified
115
+ claude_md_updated: true # or false
116
+ summary: |
117
+ [What we learned]
118
+ ```
119
+
120
+ Present closure:
121
+
122
+ ```
123
+ ## Debug Session Complete
124
+
125
+ **Bug**: [title]
126
+ **Status**: Fixed and verified
127
+ **Test**: [test file] - serves as regression test
128
+ **ADR**: [ADR-NNN created / None identified]
129
+ **CLAUDE.md**: [Updated / No update needed]
130
+ ```
131
+
132
+ ```
133
+ AskUserQuestion:
134
+ Question: "Debug session complete. Anything else?"
135
+ Options:
136
+ - "All done" - Close out
137
+ - "Start another debug" - I have another bug
138
+ - "Something else" - Different feedback
139
+ ```
140
+ </step>
141
+
142
+ <checkpoint>
143
+ Before closing:
144
+ - User verified the fix works
145
+ - Learnings assessment was presented (ADR and CLAUDE.md)
146
+ - Any identified learnings were captured
147
+ - debug.yaml status is closed
148
+ </checkpoint>
149
+
150
+ </steps>
151
+
152
+ ## Key Principles
153
+
154
+ **User verification is required.** Tests passing doesn't mean the bug is fixed from the user's perspective.
155
+
156
+ **Autonomous learning capture.** Evaluate learnings yourself using the criteria above. Tell the user what you identified and why - don't ask them to decide. They can override if they disagree.
157
+
158
+ **ADRs prevent recurrence.** Document patterns that prevent classes of bugs. The key question: "If we had this ADR before, would we have avoided the bug?"
159
+
160
+ **CLAUDE.md captures tribal knowledge.** Document gotchas and non-obvious behaviors discovered during debugging. The key question: "Would a future developer stumble on this same issue?"
161
+
162
+ **Tests are regression protection.** Even without an ADR, the test protects against this specific bug recurring.
@@ -0,0 +1,84 @@
1
+ # Debugging Phase 2: Root Cause Analysis
2
+
3
+ ## Purpose
4
+
5
+ Form a hypothesis about WHY the bug is happening. The hypothesis must be specific enough to verify with a test—if you can't write a test for it, it's too vague.
6
+
7
+ **Success looks like**: A testable hypothesis is written to debug.yaml with a clear description, confidence level, and proposed test strategy.
8
+
9
+ ## What To Do
10
+
11
+ <steps>
12
+
13
+ <step name="Spawn RCA Agent">
14
+ Spawn rca-agent to investigate and form a hypothesis:
15
+
16
+ ```
17
+ Spawn rca-agent: "Investigate root cause for the debug at [debug-path]/debug.yaml."
18
+ ```
19
+
20
+ The agent reads the debug context, explores relevant code, forms a hypothesis, writes it to debug.yaml, and returns with findings.
21
+ </step>
22
+
23
+ <step name="Review the Hypothesis">
24
+ When the agent returns, check:
25
+
26
+ - **Is it specific?** Can you imagine a test that would prove or disprove it?
27
+ - **Does the test strategy make sense?** Is it clear what behavior to test?
28
+
29
+ If too vague (e.g., "something is wrong with the cache"), spawn rca-agent again asking for more specificity.
30
+ </step>
31
+
32
+ <step name="Present to User">
33
+ Once you have a testable hypothesis:
34
+
35
+ ```
36
+ ## Root Cause Hypothesis
37
+
38
+ **Hypothesis**: [description]
39
+ **Confidence**: [high/medium/low]
40
+ **Evidence**: [what supports this]
41
+ **Test Strategy**: [how we'll verify]
42
+ ```
43
+
44
+ ```
45
+ AskUserQuestion:
46
+ Question: "Does this hypothesis make sense? Ready to write a test?"
47
+ Options:
48
+ - "Yes, write the test" - Proceed to verification
49
+ - "Investigate more" - Explore a different angle
50
+ - "I have context" - Let me share what I know
51
+ - "Something else" - Different feedback
52
+ ```
53
+ </step>
54
+
55
+ <step name="Handle User Feedback">
56
+ - **"Yes, write the test"**: Proceed to verify phase
57
+ - **"Investigate more"**: Ask what angle to explore, spawn rca-agent with that direction
58
+ - **"I have context"**: Incorporate their knowledge—may confirm, redirect, or reveal the answer
59
+ </step>
60
+
61
+ <checkpoint>
62
+ Before proceeding:
63
+ - rca-agent was spawned and returned a hypothesis
64
+ - Hypothesis is specific enough to test
65
+ - User approved proceeding to verification
66
+ </checkpoint>
67
+
68
+ </steps>
69
+
70
+ ## Handling Previous Hypotheses
71
+
72
+ If this isn't the first RCA iteration (previous hypothesis was disproven), the agent reads previous hypotheses from debug.yaml, understands why they were disproven, and forms a NEW hypothesis that accounts for what we learned.
73
+
74
+ ## Key Principles
75
+
76
+ **Hypotheses must be testable.** If you can't describe a test that would verify it, push for specificity.
77
+
78
+ **Build on evidence.** The hypothesis should come from actual code exploration, not guessing.
79
+
80
+ **Trust the user's context.** They may have debugging context that isn't in the code.
81
+
82
+ <transition>
83
+ When the user approves the hypothesis and is ready to write a test, read `references/debugging/verify.md` to proceed.
84
+ </transition>
@@ -0,0 +1,95 @@
1
+ # Debugging Phase 3: Verify
2
+
3
+ ## Purpose
4
+
5
+ Write a failing test that proves the hypothesis. The test is the TDD gate—we don't fix code until we have a test that demonstrates the bug exists.
6
+
7
+ **Success looks like**: A test exists that fails because of the bug. When the test passes later, we'll know the bug is fixed.
8
+
9
+ ## What To Do
10
+
11
+ <steps>
12
+
13
+ <step name="Spawn TDD Agent">
14
+ Spawn tdd-agent to write a failing test for the hypothesis:
15
+
16
+ ```
17
+ Spawn tdd-agent: "Write a failing test for the hypothesis in [debug-path]/debug.yaml."
18
+ ```
19
+
20
+ The agent reads the debug context, writes an appropriate test, runs it, and updates the debug.yaml with the result.
21
+ </step>
22
+
23
+ <step name="Evaluate Result">
24
+ The agent returns one of three outcomes:
25
+
26
+ **Test FAILS (hypothesis verified)**:
27
+ The bug exists and we can reproduce it. Present to user:
28
+
29
+ ```
30
+ ## Hypothesis Verified
31
+
32
+ The test fails as expected, confirming the hypothesis.
33
+
34
+ **Test**: [test file path]
35
+ **Failure**: [what the test asserts that fails]
36
+
37
+ Ready to fix the code.
38
+ ```
39
+
40
+ ```
41
+ AskUserQuestion:
42
+ Question: "Test fails as expected. Ready to fix the code?"
43
+ Options:
44
+ - "Yes, fix it" - Proceed to fix phase
45
+ - "Let me review" - I want to see the test code first
46
+ - "Something else" - Different feedback
47
+ ```
48
+
49
+ **Test PASSES (hypothesis disproven)**:
50
+ The hypothesis was wrong—the bug has a different cause. Present to user:
51
+
52
+ ```
53
+ ## Hypothesis Disproven
54
+
55
+ The test passed, meaning the expected behavior works in this scenario.
56
+ The hypothesis was incorrect—the bug has a different cause.
57
+
58
+ **What we learned**: [what the passing test tells us]
59
+ ```
60
+
61
+ ```
62
+ AskUserQuestion:
63
+ Question: "The hypothesis was wrong. How should we proceed?"
64
+ Options:
65
+ - "Investigate again" - Back to RCA with new evidence
66
+ - "I have an idea" - Let me share what I think is happening
67
+ - "Something else" - Different approach
68
+ ```
69
+
70
+ **Test ERRORS (test itself is broken)**:
71
+ Work with the user to fix or rewrite the test, then re-run.
72
+ </step>
73
+
74
+ <checkpoint>
75
+ Before proceeding:
76
+ - tdd-agent was spawned and returned a result
77
+ - Result was evaluated and presented to user
78
+ - User has chosen how to proceed
79
+ </checkpoint>
80
+
81
+ </steps>
82
+
83
+ ## Key Principles
84
+
85
+ **Tests check expected behavior, not implementation.** The test asserts what SHOULD happen, not how it happens internally.
86
+
87
+ **Failing test = verified hypothesis.** A test that fails proves the bug exists.
88
+
89
+ **Passing test = wrong hypothesis.** If the test passes, our understanding was incorrect—back to RCA.
90
+
91
+ <transition>
92
+ If hypothesis verified (test fails) and user approves: Read `references/debugging/fix.md`
93
+
94
+ If hypothesis disproven (test passes) and user chooses to investigate: Read `references/debugging/rca.md`
95
+ </transition>