cc-dev-template 0.1.32 → 0.1.33

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 (34) hide show
  1. package/bin/install.js +5 -9
  2. package/package.json +1 -1
  3. package/src/commands/done.md +52 -0
  4. package/src/commands/prime.md +40 -4
  5. package/src/skills/initialize-project/SKILL.md +88 -0
  6. package/src/agents/adr-agent.md +0 -167
  7. package/src/agents/claude-md-agent.md +0 -124
  8. package/src/agents/decomposition-agent.md +0 -170
  9. package/src/agents/execution-agent.md +0 -232
  10. package/src/agents/rca-agent.md +0 -192
  11. package/src/agents/tdd-agent.md +0 -205
  12. package/src/commands/create-agent-skill.md +0 -11
  13. package/src/commands/finalize.md +0 -48
  14. package/src/commands/heal-skill.md +0 -69
  15. package/src/hooks/orchestration-guidance.sh +0 -56
  16. package/src/hooks/orchestration-hook.json +0 -14
  17. package/src/scripts/adr-list.js +0 -298
  18. package/src/scripts/adr-tags.js +0 -242
  19. package/src/scripts/validate-yaml.js +0 -142
  20. package/src/scripts/yaml-validation-hook.json +0 -15
  21. package/src/skills/orchestration/SKILL.md +0 -161
  22. package/src/skills/orchestration/references/debugging/describe.md +0 -144
  23. package/src/skills/orchestration/references/debugging/fix.md +0 -117
  24. package/src/skills/orchestration/references/debugging/learn.md +0 -185
  25. package/src/skills/orchestration/references/debugging/rca.md +0 -92
  26. package/src/skills/orchestration/references/debugging/verify.md +0 -102
  27. package/src/skills/orchestration/references/execution/complete.md +0 -175
  28. package/src/skills/orchestration/references/execution/start.md +0 -77
  29. package/src/skills/orchestration/references/execution/tasks.md +0 -114
  30. package/src/skills/orchestration/references/planning/draft.md +0 -269
  31. package/src/skills/orchestration/references/planning/explore.md +0 -160
  32. package/src/skills/orchestration/references/planning/finalize.md +0 -184
  33. package/src/skills/orchestration/references/planning/start.md +0 -119
  34. package/src/skills/orchestration/scripts/plan-status.js +0 -355
@@ -1,161 +0,0 @@
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/skills/orchestration/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="Detect Submodule Context">
33
- Detect whether you're operating in a git submodule environment. Run these commands:
34
-
35
- ```bash
36
- # Check if we're inside a submodule (returns parent path if yes, empty if no)
37
- git rev-parse --show-superproject-working-tree 2>/dev/null
38
-
39
- # List submodules if this repo has any
40
- git submodule status 2>/dev/null
41
- ```
42
-
43
- Build a SubmoduleContext from the results:
44
-
45
- ```
46
- SubmoduleContext:
47
- isInSubmodule: boolean # true if superproject path is non-empty
48
- hasSubmodules: boolean # true if submodule status returns entries
49
- parentRepoPath: string # absolute path to parent repo (if isInSubmodule)
50
- submodulePaths: string[] # relative paths of submodules (if hasSubmodules)
51
- currentSubmodulePath: string # path of current submodule relative to parent
52
- ```
53
-
54
- Store this context for use by workflow phases. When spawning sub-agents, pass relevant context so they can:
55
- - Use `--include-parent` flag with adr-list.js when in a submodule
56
- - Understand which submodules are available for plan scope
57
- - Filter ADRs by scope when working on submodule-specific plans
58
-
59
- This detection happens once at startup. Individual CLI scripts can also detect submodule context when called standalone, but when orchestrating, pass the context you've already gathered.
60
- </step>
61
-
62
- <step name="Present Options to User">
63
- Based on what you found, use `AskUserQuestion` to ask what the user wants to do.
64
-
65
- **Build the options dynamically:**
66
-
67
- - Always include: "Create a new plan"
68
- - Always include: "Debug an issue"
69
- - If draft plans exist: "Continue planning: [plan title]" for each
70
- - If approved plans exist: "Execute: [plan title]" for each
71
- - If in-progress execution exists: "Resume execution: [plan title]" for each
72
- - If active debug sessions exist: "Continue debugging: [debug title]" for each
73
- - Always include: "Something else" (free text option)
74
-
75
- **Example AskUserQuestion:**
76
-
77
- ```
78
- Question: "What would you like to work on?"
79
-
80
- Options (based on discovered state):
81
- - "Create a new plan" - Start fresh with a new feature, enhancement, or refactor
82
- - "Debug an issue" - Investigate and fix a bug using TDD
83
- - "Execute: User Authentication" - Begin implementing this approved plan
84
- - "Continue planning: API Refactor" - Resume drafting this incomplete plan
85
- - "Something else" - Describe what you need
86
- ```
87
-
88
- Wait for the user's response before proceeding.
89
- </step>
90
-
91
- <step name="Route Based on User's Choice">
92
- Once the user chooses, read the appropriate workflow file:
93
-
94
- | User's Choice | Action |
95
- |---------------|--------|
96
- | "Create a new plan" | Read `references/planning/start.md` |
97
- | "Debug an issue" | Read `references/debugging/describe.md` |
98
- | "Execute: [plan]" | Store the plan slug, then read `references/execution/start.md` |
99
- | "Continue planning: [plan]" | Store the plan slug, determine which planning phase to resume, then read that phase file |
100
- | "Resume execution: [plan]" | Store the plan slug, then read `references/execution/tasks.md` |
101
- | "Continue debugging: [debug]" | Store the debug slug, determine phase using debug resumption logic below |
102
- | "Something else" | Address the user's custom request, or help them find the right workflow |
103
-
104
- Reading the workflow file is mandatory—it contains the instructions for the next phase.
105
- </step>
106
-
107
- </steps>
108
-
109
- ## Debug Phase Resumption Logic
110
-
111
- When resuming a debug session, read `.claude/debug/[slug]/debug.yaml` and determine the phase:
112
-
113
- | debug.yaml State | Resume Phase |
114
- |------------------|--------------|
115
- | `status: investigating`, no hypotheses | `references/debugging/rca.md` |
116
- | `status: investigating`, hypothesis with `status: investigating` | `references/debugging/rca.md` |
117
- | `status: investigating`, hypothesis with `status: verified` | `references/debugging/fix.md` |
118
- | `status: investigating`, hypothesis with `status: disproven` | `references/debugging/rca.md` |
119
- | `status: investigating`, hypothesis with `status: fixed` | `references/debugging/learn.md` |
120
- | `status: closed` | Already complete, no action needed |
121
-
122
- ## Important Notes
123
-
124
- **Use this skill's planning workflow, not built-in plan mode.** This skill provides its own structured planning phases (start → explore → draft → finalize). Use these workflow files for all planning work. The built-in `EnterPlanMode` tool is for ad-hoc work outside this framework.
125
-
126
- **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.
127
-
128
- **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]/`. Also pass SubmoduleContext to workflow phases when relevant.
129
-
130
- **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.
131
-
132
- **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.
133
-
134
- **Explore facts, ask preferences.** Discover codebase state (what exists, how things work) through exploration. Ask users only what they alone can answer: goals, preferences, decisions, and success criteria.
135
-
136
- ## Workflow Overview
137
-
138
- This skill supports three main workflows:
139
-
140
- ### Planning Workflow
141
- Transform a feature request into an approved, validated plan.
142
-
143
- ```
144
- start.md → explore.md → draft.md → finalize.md
145
- ```
146
-
147
- ### Execution Workflow
148
- Transform an approved plan into working code.
149
-
150
- ```
151
- start.md → tasks.md → complete.md
152
- ```
153
-
154
- ### Debugging Workflow
155
- Investigate and fix bugs using test-driven development.
156
-
157
- ```
158
- describe.md → rca.md → verify.md → fix.md → learn.md
159
- ```
160
-
161
- 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.
@@ -1,144 +0,0 @@
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.md` 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
- Submodule context: [pass SubmoduleContext from SKILL.md]
47
-
48
- Use --include-parent with adr-list.js to discover both local and
49
- inherited ADRs. Bugs may relate to patterns established at the
50
- parent repo level."
51
- ```
52
- </step>
53
-
54
- <step name="Create the Debug Artifact">
55
- Create `.claude/debug/[slug]/debug.md` with YAML frontmatter and Markdown body:
56
-
57
- ```markdown
58
- ---
59
- status: investigating
60
- title: "[Short description]"
61
- created: [today's date]
62
- ---
63
-
64
- # Debug: [Short description]
65
-
66
- ## Symptom
67
-
68
- [What the user described]
69
-
70
- ## Expected Behavior
71
-
72
- [What should happen instead]
73
-
74
- ## Baseline
75
-
76
- - **Test command**: [command]
77
- - **Result**: pass
78
- - **Summary**: [X tests passed]
79
-
80
- ## Relevant ADRs
81
-
82
- - **ADR-[XXX]**: [Why it matters] (source: local or inherited)
83
-
84
- ## Submodule Context
85
-
86
- *Include if SubmoduleContext is relevant*
87
-
88
- - **Is in submodule**: [boolean]
89
- - **Current submodule path**: [path if applicable]
90
-
91
- ## Hypotheses
92
-
93
- *None yet - will be added during RCA phase*
94
- ```
95
-
96
- **Note**: For backward compatibility, if you encounter an existing `debug.yaml` file, continue working with that format. New debug sessions should use the `debug.md` format.
97
- </step>
98
-
99
- <step name="Confirm and Proceed">
100
- Summarize back to the user:
101
-
102
- ```
103
- ## Bug Report Captured
104
-
105
- **Symptom**: [summary]
106
- **Expected**: [summary]
107
- **Baseline**: All tests passing
108
- **Relevant ADRs**: [list or "None found"]
109
-
110
- Ready to investigate root cause.
111
- ```
112
-
113
- ```
114
- AskUserQuestion:
115
- Question: "Does this capture the issue correctly?"
116
- Options:
117
- - "Yes, investigate" - Proceed to root cause analysis
118
- - "Let me clarify" - I'll add more detail
119
- - "Something else" - Different feedback
120
- ```
121
- </step>
122
-
123
- <checkpoint>
124
- Before proceeding:
125
- - Symptom is clearly documented
126
- - Expected behavior is defined
127
- - Test baseline is established
128
- - debug.md artifact is created
129
- - User has confirmed the description
130
- </checkpoint>
131
-
132
- </steps>
133
-
134
- ## Key Principles
135
-
136
- **Invest time in clarity.** A precise symptom makes root cause analysis faster. Ambiguity discovered now is cheap; ambiguity discovered mid-investigation wastes effort.
137
-
138
- **Establish baseline before investigating.** Running tests first prevents confusion about whether failures are from the bug or pre-existing.
139
-
140
- **Document everything in debug.md.** The artifact is the source of truth for future phases.
141
-
142
- <transition>
143
- When the user confirms the description is accurate, read `references/debugging/rca.md` to begin root cause analysis.
144
- </transition>
@@ -1,117 +0,0 @@
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.md.
18
-
19
- Submodule context: [pass SubmoduleContext from SKILL.md or from debug.md]
20
-
21
- If the fix is in a submodule, work within that submodule's directory.
22
- The fix should be scoped to the appropriate submodule."
23
- ```
24
-
25
- The agent reads the debug context, fixes the code without modifying test files, runs the test, and updates the debug.md artifact with the result.
26
-
27
- **Note**: For backward compatibility, if the debug artifact is `debug.yaml` instead of `debug.md`, continue working with that format.
28
- </step>
29
-
30
- <step name="Verify Result">
31
- When the agent returns:
32
-
33
- **If test passes**: Check for regressions by running the full test suite. Compare against baseline from the debug artifact.
34
-
35
- **If test still fails**:
36
- ```
37
- AskUserQuestion:
38
- Question: "The test still fails. How should we proceed?"
39
- Options:
40
- - "Keep fixing" - Spawn the agent again
41
- - "Review the fix" - Let me see what was changed
42
- - "Different approach" - Reconsider the hypothesis
43
- - "Something else" - Different feedback
44
- ```
45
-
46
- **If regressions introduced**:
47
- ```
48
- AskUserQuestion:
49
- Question: "The fix introduced [N] test failures. How should we proceed?"
50
- Options:
51
- - "Fix regressions" - Address the new failures
52
- - "Review changes" - Let me see what caused this
53
- - "Revert" - Try a different approach
54
- - "Something else" - Different feedback
55
- ```
56
- </step>
57
-
58
- <step name="Update Debug Status">
59
- Once test passes with no regressions, update the debug.md artifact by adding a Resolution section:
60
-
61
- ```markdown
62
- ## Resolution
63
-
64
- **Hypothesis fixed**: h[N]
65
-
66
- **Description**: [What was fixed and why]
67
-
68
- **Files changed**:
69
- - [list of modified files]
70
- ```
71
-
72
- Also update the hypothesis status in the Hypotheses section to mark it as fixed.
73
-
74
- Present to user:
75
-
76
- ```
77
- ## Bug Fixed
78
-
79
- **Hypothesis**: [description]
80
- **Fix**: [what was changed]
81
- **Test**: Passes
82
- **Regressions**: None
83
-
84
- Ready for the learning phase.
85
- ```
86
-
87
- ```
88
- AskUserQuestion:
89
- Question: "The bug is fixed. Ready to capture learnings?"
90
- Options:
91
- - "Yes, continue" - Proceed to learning phase
92
- - "Let me verify" - I want to test more
93
- - "Something else" - Different feedback
94
- ```
95
- </step>
96
-
97
- <checkpoint>
98
- Before proceeding:
99
- - tdd-agent fixed the code
100
- - Test passes
101
- - Full test suite passes (no regressions)
102
- - debug.md resolution is updated
103
- </checkpoint>
104
-
105
- </steps>
106
-
107
- ## Key Principles
108
-
109
- **Test is the specification.** Don't modify the test—make the code conform.
110
-
111
- **Check for regressions.** A fix that breaks other things isn't a fix.
112
-
113
- **Document the resolution.** The debug artifact captures what was done for future reference.
114
-
115
- <transition>
116
- When the fix is complete and verified, read `references/debugging/learn.md` to capture learnings.
117
- </transition>
@@ -1,185 +0,0 @@
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
- Submodule context: [pass SubmoduleContext from SKILL.md or from debug.md]
96
-
97
- If this ADR applies only to specific submodules, set the scope field.
98
- If the bug was discovered while working in a submodule, consider whether
99
- the pattern applies globally or only to that submodule."
100
- ```
101
-
102
- **If CLAUDE.md learning identified:**
103
- ```
104
- Spawn claude-md-agent: "Add to CLAUDE.md: [learning]. Discovered while debugging [title]. This is non-obvious because [reason].
105
-
106
- If this learning is specific to a submodule, consider whether it
107
- belongs in the submodule's CLAUDE.md or the root CLAUDE.md."
108
- ```
109
-
110
- **If neither identified:** Proceed directly to closing the session.
111
- </step>
112
-
113
- <step name="Close Debug Session">
114
- Update the debug.md artifact. Change the status in the frontmatter to `closed` and add a Learning section:
115
-
116
- ```markdown
117
- ---
118
- status: closed
119
- title: "[Short description]"
120
- created: [original date]
121
- ---
122
-
123
- ...existing content...
124
-
125
- ## Learning
126
-
127
- - **ADR created**: ADR-[NNN] (or "None identified")
128
- - **ADR scope**: [submodule paths if scoped, or "global"]
129
- - **CLAUDE.md updated**: Yes/No
130
- - **CLAUDE.md location**: root (or submodule path)
131
-
132
- **Summary**: [What we learned]
133
-
134
- ## Resolution
135
-
136
- ...existing resolution content...
137
-
138
- - **Verified by user**: Yes
139
- ```
140
-
141
- **Note**: For backward compatibility, if the debug artifact is `debug.yaml` instead of `debug.md`, continue working with that format.
142
-
143
- Present closure:
144
-
145
- ```
146
- ## Debug Session Complete
147
-
148
- **Bug**: [title]
149
- **Status**: Fixed and verified
150
- **Test**: [test file] - serves as regression test
151
- **ADR**: [ADR-NNN created / None identified]
152
- **CLAUDE.md**: [Updated / No update needed]
153
- ```
154
-
155
- ```
156
- AskUserQuestion:
157
- Question: "Debug session complete. Anything else?"
158
- Options:
159
- - "All done" - Close out
160
- - "Start another debug" - I have another bug
161
- - "Something else" - Different feedback
162
- ```
163
- </step>
164
-
165
- <checkpoint>
166
- Before closing:
167
- - User verified the fix works
168
- - Learnings assessment was presented (ADR and CLAUDE.md)
169
- - Any identified learnings were captured
170
- - debug.md status is closed
171
- </checkpoint>
172
-
173
- </steps>
174
-
175
- ## Key Principles
176
-
177
- **User verification is required.** Tests passing doesn't mean the bug is fixed from the user's perspective.
178
-
179
- **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.
180
-
181
- **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?"
182
-
183
- **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?"
184
-
185
- **Tests are regression protection.** Even without an ADR, the test protects against this specific bug recurring.
@@ -1,92 +0,0 @@
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 the debug.md artifact 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.md.
18
-
19
- Submodule context: [pass SubmoduleContext from SKILL.md or from debug.md]
20
-
21
- If debugging in a submodule, the bug may relate to inherited ADRs
22
- or patterns from the parent repo. Check debug.md for submodule_context
23
- to understand the scope of investigation."
24
- ```
25
-
26
- The agent reads the debug context, explores relevant code, forms a hypothesis, writes it to the debug.md artifact, and returns with findings.
27
- </step>
28
-
29
- <step name="Review the Hypothesis">
30
- When the agent returns, check:
31
-
32
- - **Is it specific?** Can you imagine a test that would prove or disprove it?
33
- - **Does the test strategy make sense?** Is it clear what behavior to test?
34
-
35
- If too vague (e.g., "something is wrong with the cache"), spawn rca-agent again asking for more specificity.
36
- </step>
37
-
38
- <step name="Present to User">
39
- Once you have a testable hypothesis:
40
-
41
- ```
42
- ## Root Cause Hypothesis
43
-
44
- **Hypothesis**: [description]
45
- **Confidence**: [high/medium/low]
46
- **Evidence**: [what supports this]
47
- **Test Strategy**: [how we'll verify]
48
- ```
49
-
50
- ```
51
- AskUserQuestion:
52
- Question: "Does this hypothesis make sense? Ready to write a test?"
53
- Options:
54
- - "Yes, write the test" - Proceed to verification
55
- - "Investigate more" - Explore a different angle
56
- - "I have context" - Let me share what I know
57
- - "Something else" - Different feedback
58
- ```
59
- </step>
60
-
61
- <step name="Handle User Feedback">
62
- - **"Yes, write the test"**: Proceed to verify phase
63
- - **"Investigate more"**: Ask what angle to explore, spawn rca-agent with that direction
64
- - **"I have context"**: Incorporate their knowledge—may confirm, redirect, or reveal the answer
65
- </step>
66
-
67
- <checkpoint>
68
- Before proceeding:
69
- - rca-agent was spawned and returned a hypothesis
70
- - Hypothesis is specific enough to test
71
- - User approved proceeding to verification
72
- </checkpoint>
73
-
74
- </steps>
75
-
76
- ## Handling Previous Hypotheses
77
-
78
- If this isn't the first RCA iteration (previous hypothesis was disproven), the agent reads previous hypotheses from the debug.md artifact, understands why they were disproven, and forms a NEW hypothesis that accounts for what we learned.
79
-
80
- **Note**: For backward compatibility, if the debug artifact is `debug.yaml` instead of `debug.md`, continue working with that format.
81
-
82
- ## Key Principles
83
-
84
- **Hypotheses must be testable.** If you can't describe a test that would verify it, push for specificity.
85
-
86
- **Build on evidence.** The hypothesis should come from actual code exploration, not guessing.
87
-
88
- **Trust the user's context.** They may have debugging context that isn't in the code.
89
-
90
- <transition>
91
- When the user approves the hypothesis and is ready to write a test, read `references/debugging/verify.md` to proceed.
92
- </transition>