@comfanion/workflow 4.38.1-dev.1 → 4.38.1-dev.12

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.
@@ -101,38 +101,82 @@ For each AC in the story:
101
101
 
102
102
  All criteria met. Code is ready to merge.
103
103
 
104
- ```markdown
105
- ### Review Outcome: Approve
106
-
107
- All acceptance criteria satisfied. Code follows project standards.
108
- Ready for merge.
109
- ```
110
-
111
104
  ### 🔄 Changes Requested
112
105
 
113
106
  Issues found that need addressing.
114
107
 
108
+ ### ❌ Blocked
109
+
110
+ Major issues that prevent approval.
111
+
112
+ ## Write Findings to Story File (MANDATORY)
113
+
114
+ After completing the review, **append** your findings to the story file's `## Review` section.
115
+ Each review round is a separate `### Review #N` block. NEVER overwrite previous reviews — always append.
116
+
117
+ **How to determine review number:**
118
+ 1. Read the story file's `## Review` section
119
+ 2. Count existing `### Review #N` blocks
120
+ 3. Your review is `N + 1` (or `#1` if none exist)
121
+
122
+ **Format to append at the end of the story file:**
123
+
115
124
  ```markdown
116
- ### Review Outcome: Changes Requested
125
+ ### Review #{{N}} {{YYYY-MM-DD}}
126
+
127
+ **Verdict:** {{APPROVE | CHANGES_REQUESTED | BLOCKED}}
128
+ **Reviewer:** @reviewer (Marcus)
129
+
130
+ **Summary:** {{1-2 sentences}}
131
+
132
+ **Tests:** {{PASS | FAIL — details}}
133
+ **Lint:** {{PASS | FAIL — details}}
117
134
 
118
- **Action Items:**
119
- - [ ] [High] Fix missing error handling in X
120
- - [ ] [Med] Add unit test for edge case Y
121
- - [ ] [Low] Improve variable naming in Z
135
+ {{IF issues found:}}
136
+ #### Action Items
137
+ - [ ] [HIGH] `path/file.ts:42` {{issue}} Fix: {{specific fix}}
138
+ - [ ] [MED] `path/file.ts:100` {{issue}} Fix: {{specific fix}}
139
+ - [ ] [LOW] `path/file.ts:15` — {{issue}}
140
+
141
+ {{IF approve:}}
142
+ #### What's Good
143
+ - {{positive feedback}}
122
144
  ```
123
145
 
124
- ### Blocked
146
+ **Example first review with issues:**
125
147
 
126
- Major issues that prevent approval.
148
+ ```markdown
149
+ ### Review #1 — 2026-01-27
150
+
151
+ **Verdict:** CHANGES_REQUESTED
152
+ **Reviewer:** @reviewer (Marcus)
153
+
154
+ **Summary:** Missing error handling in CreateUser handler, no test for duplicate email.
155
+
156
+ **Tests:** PASS (12/12)
157
+ **Lint:** PASS
158
+
159
+ #### Action Items
160
+ - [ ] [HIGH] `internal/user/handler.go:42` — No error handling for DB timeout → Fix: wrap with domain error
161
+ - [ ] [MED] `internal/user/handler_test.go` — Missing duplicate email test → Fix: add TestCreateUser_DuplicateEmail
162
+ ```
163
+
164
+ **Example — second review after fixes:**
127
165
 
128
166
  ```markdown
129
- ### Review Outcome: Blocked
167
+ ### Review #2 — 2026-01-27
130
168
 
131
- **Blocking Issues:**
132
- 1. Security vulnerability in authentication flow
133
- 2. Missing critical test coverage
169
+ **Verdict:** APPROVE
170
+ **Reviewer:** @reviewer (Marcus)
134
171
 
135
- Cannot proceed until blocking issues resolved.
172
+ **Summary:** All issues from Review #1 fixed. Error handling added, test coverage complete.
173
+
174
+ **Tests:** PASS (14/14)
175
+ **Lint:** PASS
176
+
177
+ #### What's Good
178
+ - Clean error wrapping with domain errors
179
+ - Good test coverage for edge cases
136
180
  ```
137
181
 
138
182
  ## Severity Levels
@@ -164,34 +208,9 @@ func foo() error { ... }
164
208
 
165
209
  ## Updating Story File
166
210
 
167
- After review, add to story file:
168
-
169
- ```markdown
170
- ## Senior Developer Review (AI)
171
-
172
- ### Review Date
173
- 2024-01-15
174
-
175
- ### Review Outcome
176
- Changes Requested
177
-
178
- ### Action Items
179
- - [ ] [High] Add error handling to CreateUser handler
180
- - [ ] [Med] Add unit test for duplicate email validation
181
- - [ ] [Low] Rename 'x' to 'userCount'
182
-
183
- ### Detailed Comments
184
- [Include detailed review comments here]
185
- ```
186
-
187
- If changes requested, also add:
188
-
189
- ```markdown
190
- ### Review Follow-ups (AI)
191
-
192
- - [ ] [AI-Review] [High] Add error handling to CreateUser handler
193
- - [ ] [AI-Review] [Med] Add unit test for duplicate email validation
194
- ```
211
+ **MANDATORY:** Use the format from "Write Findings to Story File" section above.
212
+ Append `### Review #N` block to the `## Review` section at the end of the story file.
213
+ NEVER overwrite previous reviews — history must be preserved for analytics.
195
214
 
196
215
  ## Best Practices
197
216
 
@@ -9,64 +9,103 @@ metadata:
9
9
 
10
10
  # Dev Epic Skill
11
11
 
12
+ ## CRITICAL: Context Rules
13
+
14
+ **READ ONLY (max ~70KB):**
15
+ - `CLAUDE.md`
16
+ - `docs/coding-standards/README.md`
17
+ - `docs/coding-standards/patterns.md`
18
+ - Epic file (ONE)
19
+ - Current story file (ONE at a time)
20
+
21
+ **❌ DO NOT READ — WASTES CONTEXT:**
22
+ - ❌ `docs/prd.md` — epic/story already has context
23
+ - ❌ `docs/architecture.md` — too large, coding-standards has patterns
24
+ - ❌ All stories at once — read ONE, execute, then next
25
+
26
+ ---
27
+
12
28
  <workflow name="dev-epic">
13
29
 
14
30
  <phase name="1-context" title="Load Minimal Context">
31
+ <critical>DO NOT read prd.md, architecture.md, or all stories!</critical>
15
32
  <read>
16
33
  <file>CLAUDE.md</file>
17
34
  <file>docs/coding-standards/README.md</file>
18
35
  <file>docs/coding-standards/patterns.md</file>
19
36
  <file>{epic-file}</file>
20
- <file>{current-story-file}</file>
37
+ <file>{current-story-file} — ONE only!</file>
21
38
  </read>
22
- <skip reason="too large, epic/story has context">
23
- <file>docs/prd.md</file>
24
- <file>docs/architecture.md</file>
25
- <file>all stories at once</file>
26
- </skip>
27
- <goal>~70KB per story</goal>
39
+ <goal>~70KB per story, NOT 200KB+</goal>
28
40
  </phase>
29
41
 
30
42
  <phase name="2-init" title="Initialize Epic">
31
- <step n="1">Parse epic file → extract story list</step>
43
+ <step n="1">Parse epic file → "Story Tasks" section has all stories + tasks (no need to read story files yet)</step>
32
44
  <step n="2">Create epic state: docs/sprint-artifacts/sprint-N/.sprint-state/epic-XX-state.yaml</step>
33
- <step n="3">Create TODO list:
45
+ <step n="3">Create TODO list with IDs — stories, their tasks, and reviews:
34
46
  ```
35
- [ ] Story 1: [Title]
36
- [ ] Review Story 1
37
- [ ] Story 2: [Title]
38
- [ ] Review Story 2
47
+ [ ] E{N}-S01: {story title}
48
+ [ ] E{N}-S01-T01: {task title}
49
+ [ ] E{N}-S01-T02: {task title}
50
+ [ ] E{N}-S01-Review: run tests, verify AC
51
+ [ ] E{N}-S02: {story title}
52
+ [ ] E{N}-S02-T01: {task title}
53
+ [ ] E{N}-S02-T02: {task title}
54
+ [ ] E{N}-S02-Review: run tests, verify AC
39
55
  ...
40
- [ ] Epic integration tests
41
- [ ] Verify epic AC
56
+ [ ] E{N}-Integration: run epic integration tests
57
+ [ ] E{N}-AC: verify epic acceptance criteria
42
58
  ```
43
59
  </step>
60
+ <example>
61
+ ```
62
+ [ ] E04-S01: Merge Domain Logic
63
+ [ ] E04-S01-T01: MergeResult value object
64
+ [ ] E04-S01-T02: Merge service — primary selection
65
+ [ ] E04-S01-T03: Unit tests
66
+ [ ] E04-S01-Review: run tests, verify AC
67
+ [ ] E04-S02: Auto Merge on Link
68
+ [ ] E04-S02-T01: Event handler for link
69
+ [ ] E04-S02-T02: Best-effort merge logic
70
+ [ ] E04-S02-T03: Integration tests
71
+ [ ] E04-S02-Review: run tests, verify AC
72
+ [ ] E04-Integration: run epic integration tests
73
+ [ ] E04-AC: verify epic acceptance criteria
74
+ ```
75
+ </example>
44
76
  <step n="4">Set state: status="in-progress", next_action="Execute [first-story.md]"</step>
45
77
  <step n="5">Mark first story as in_progress in TODO</step>
46
78
  </phase>
47
79
 
48
80
  <phase name="3-loop" title="Story Execution Loop">
81
+ <critical>Status flow: in_progress → review → done. NEVER mark done before review!</critical>
49
82
  <for-each item="story" in="pending_stories">
50
83
 
51
84
  <action name="execute-story">
52
85
  Follow /dev-story logic:
53
- - Create nested TODO for tasks
54
- - Implement all tasks (RED/GREEN/REFACTOR)
55
- - Clear task TODO when done
86
+ - Read ONE story file
87
+ - Execute tasks ONE BY ONE (or parallel if independent)
88
+ - NEVER delegate entire story to @coder in one prompt
89
+ - After each task: verify, mark done, next task
56
90
  </action>
57
91
 
58
- <action name="mark-done">
59
- Mark story as completed in epic TODO
92
+ <action name="story-to-review">
93
+ All tasks done set story status: review
94
+ Mark story TODO as "review" (NOT "done" yet!)
60
95
  </action>
61
96
 
62
- <action name="review">
63
- Mark "Review Story" as in_progress
64
- Invoke @reviewer
97
+ <action name="review-story">
98
+ Invoke @reviewer on story code.
99
+ Reviewer does TWO things:
100
+ 1. WRITES findings to story file (## Review → ### Review #N) — for history
101
+ 2. RETURNS summary to you — use THIS, do NOT re-read story file
65
102
  <if condition="CHANGES_REQUESTED">
66
- Add fix tasks re-execute → re-review (max 3 attempts)
103
+ Use reviewer's returned action items directly.
104
+ Create fix tasks from action items → execute → re-review (max 3 attempts).
67
105
  </if>
68
106
  <if condition="APPROVED">
69
- Mark "Review Story" as completed
107
+ Set story status: done
108
+ Mark story TODO as completed
70
109
  </if>
71
110
  </action>
72
111
 
@@ -79,32 +118,72 @@ metadata:
79
118
 
80
119
  <action name="compact">
81
120
  Mark next story as in_progress in TODO
82
- Wait for auto-compaction
83
- Plugin reads TODO + state → resume
121
+ Wait for auto-compaction → resume
84
122
  </action>
85
123
 
86
124
  </for-each>
87
125
  </phase>
88
126
 
89
127
  <phase name="4-finalize" title="Finalize Epic">
90
- <step n="1">Run epic integration tests (mark in TODO)</step>
91
- <step n="2">Verify all AC from epic file (mark in TODO)</step>
92
- <step n="3">Set state: status="done"</step>
93
- <step n="4">Clear epic TODO list</step>
94
- <step n="5">Report completion with summary</step>
128
+ <critical>Epic also goes through review before done!</critical>
129
+ <step n="1">All stories done set epic status: review</step>
130
+ <step n="2">Run epic integration tests (mark in TODO)</step>
131
+ <step n="3">Verify all AC from epic file (mark in TODO)</step>
132
+ <step n="4">If tests fail → fix → re-test</step>
133
+ <step n="5">All passed → set epic status: done</step>
134
+ <step n="6">Clear epic TODO list</step>
135
+ <step n="7">Update .opencode/session-state.yaml (next epic or done)</step>
136
+ <step n="8">Report completion with summary</step>
95
137
  </phase>
96
138
 
97
139
  </workflow>
98
140
 
141
+ ## Session State (MANDATORY)
142
+
143
+ After each story/task completion, update `.opencode/session-state.yaml`:
144
+
145
+ ```yaml
146
+ # .opencode/session-state.yaml — AI writes, compaction plugin reads
147
+ command: /dev-epic
148
+ agent: dev
149
+
150
+ epic:
151
+ id: PROJ-E01
152
+ title: Epic Title
153
+ file: docs/sprint-artifacts/sprint-1/epic-01-desc.md
154
+ progress: "3/5 stories"
155
+
156
+ story:
157
+ id: PROJ-S01-03
158
+ title: Current Story Title
159
+ file: docs/sprint-artifacts/sprint-1/stories/story-01-03-desc.md
160
+ current_task: T2
161
+ completed_tasks: [T1]
162
+ pending_tasks: [T2, T3]
163
+
164
+ next_action: "Continue T2 of story S01-03"
165
+
166
+ key_decisions:
167
+ - "Decision 1"
168
+ ```
169
+
170
+ This file survives compaction and tells the agent where to resume.
171
+
99
172
  <outputs>
100
173
  - Implementation code for all stories
101
174
  - Updated epic-XX-state.yaml
175
+ - Updated .opencode/session-state.yaml
102
176
  - Clean TODO list (all completed)
103
177
  </outputs>
104
178
 
105
179
  <rules>
106
180
  <do>Create clean TODO list for each epic</do>
107
181
  <do>Update epic state file BEFORE compaction</do>
182
+ <do>Execute stories IN ORDER as planned in epic file</do>
183
+ <do>Execute tasks within story ONE BY ONE (or parallel if independent)</do>
108
184
  <dont>Ask user for confirmation between stories — TODO is your guide</dont>
109
185
  <dont>Proceed to next story if review fails — enter fix loop</dont>
186
+ <dont>Reorder, skip, merge, or "optimize" story execution order</dont>
187
+ <dont>Combine tasks from different stories into one batch</dont>
188
+ <dont>Delegate entire story to @coder in one prompt — task by task only</dont>
110
189
  </rules>
@@ -9,46 +9,88 @@ metadata:
9
9
 
10
10
  # Dev Sprint Skill
11
11
 
12
+ ## CRITICAL: Context Rules
13
+
14
+ **READ ONLY (max ~70KB):**
15
+ - `CLAUDE.md`
16
+ - `docs/coding-standards/README.md`
17
+ - `docs/coding-standards/patterns.md`
18
+ - `sprint-status.yaml`
19
+ - Current epic file (ONE)
20
+ - Current story file (ONE at a time)
21
+
22
+ **❌ DO NOT READ — WASTES CONTEXT:**
23
+ - ❌ `docs/prd.md` — epic/story already has context
24
+ - ❌ `docs/architecture.md` — too large, coding-standards has patterns
25
+ - ❌ All epics at once — read ONE, execute, then next
26
+ - ❌ All stories at once — read ONE, execute, then next
27
+
28
+ ---
29
+
12
30
  <workflow name="dev-sprint">
13
31
 
14
32
  <phase name="1-context" title="Load Minimal Context">
33
+ <critical>DO NOT read prd.md, architecture.md, or all epics/stories!</critical>
15
34
  <read>
16
35
  <file>CLAUDE.md</file>
17
36
  <file>docs/coding-standards/README.md</file>
18
37
  <file>docs/coding-standards/patterns.md</file>
19
38
  <file>sprint-status.yaml</file>
20
- <file>{current-epic-file}</file>
21
- <file>{current-story-file}</file>
39
+ <file>{current-epic-file} — ONE only!</file>
40
+ <file>{current-story-file} — ONE only!</file>
22
41
  </read>
23
- <skip reason="too large, epic/story has context">
24
- <file>docs/prd.md</file>
25
- <file>docs/architecture.md</file>
26
- <file>all epics/stories at once</file>
27
- </skip>
28
- <goal>~70KB per story</goal>
42
+ <goal>~70KB per story, NOT 200KB+</goal>
29
43
  </phase>
30
44
 
31
45
  <phase name="2-init" title="Initialize Sprint">
32
46
  <step n="1">Parse sprint-status.yaml → extract epic list for target sprint</step>
33
- <step n="2">Create master TODO list:
47
+ <step n="2">Create master TODO list with IDs — epics, stories, tasks, and reviews:
34
48
  ```
35
- [ ] Epic 1: [Title]
36
- [ ] Story 1-1: [Title]
37
- [ ] Review Story 1-1
38
- [ ] Story 1-2: [Title]
39
- [ ] Review Story 1-2
40
- [ ] Review Epic 1
41
- [ ] Epic 2: [Title]
42
- [ ] Story 2-1: [Title]
43
- ...
44
- [ ] Sprint integration tests
49
+ [ ] E{N1}: {epic title}
50
+ [ ] E{N1}-S01: {story title}
51
+ [ ] E{N1}-S01-T01: {task title}
52
+ [ ] E{N1}-S01-T02: {task title}
53
+ [ ] E{N1}-S01-Review: run tests, verify AC
54
+ [ ] E{N1}-S02: {story title}
55
+ [ ] E{N1}-S02-T01: {task title}
56
+ [ ] E{N1}-S02-Review: run tests, verify AC
57
+ [ ] E{N1}-Integration: epic integration tests
58
+ [ ] E{N2}: {epic title}
59
+ [ ] E{N2}-S01: {story title}
60
+ [ ] E{N2}-S01-T01: {task title}
61
+ [ ] E{N2}-S01-Review: run tests, verify AC
62
+ [ ] E{N2}-Integration: epic integration tests
63
+ [ ] Sprint-Integration: run sprint integration tests
45
64
  ```
46
65
  </step>
66
+ <example>
67
+ ```
68
+ [ ] E04: Identity Merge
69
+ [ ] E04-S01: Merge Domain Logic
70
+ [ ] E04-S01-T01: MergeResult value object
71
+ [ ] E04-S01-T02: Merge service
72
+ [ ] E04-S01-T03: Unit tests
73
+ [ ] E04-S01-Review: run tests, verify AC
74
+ [ ] E04-S02: Auto Merge on Link
75
+ [ ] E04-S02-T01: Event handler
76
+ [ ] E04-S02-T02: Integration tests
77
+ [ ] E04-S02-Review: run tests, verify AC
78
+ [ ] E04-Integration: epic integration tests
79
+ [ ] E06: Team Management
80
+ [ ] E06-S01: Team CRUD
81
+ [ ] E06-S01-T01: Domain model
82
+ [ ] E06-S01-T02: Handler
83
+ [ ] E06-S01-Review: run tests, verify AC
84
+ [ ] E06-Integration: epic integration tests
85
+ [ ] Sprint-Integration: run sprint integration tests
86
+ ```
87
+ </example>
47
88
  <step n="3">Set sprint status="in-progress" in sprint-status.yaml</step>
48
89
  <step n="4">Mark first epic as in_progress in TODO</step>
49
90
  </phase>
50
91
 
51
92
  <phase name="3-loop" title="Epic Execution Loop">
93
+ <critical>Status flow: in_progress → review → done. NEVER mark done before review!</critical>
52
94
  <for-each item="epic" in="pending_epics">
53
95
 
54
96
  <action name="execute-epic">
@@ -58,14 +100,20 @@ metadata:
58
100
  - Clears epic TODO when done
59
101
  </action>
60
102
 
61
- <action name="mark-done">
62
- Mark epic as completed in sprint TODO
103
+ <action name="epic-to-review">
104
+ All stories done set epic status: review
105
+ Mark epic TODO as "review" (NOT "done" yet!)
63
106
  </action>
64
107
 
65
108
  <action name="epic-review">
66
- Mark "Review Epic" as in_progress
67
109
  Run epic integration tests
68
- Mark "Review Epic" as completed
110
+ <if condition="TESTS_FAIL">
111
+ Fix → re-test (max 3 attempts)
112
+ </if>
113
+ <if condition="TESTS_PASS">
114
+ Set epic status: done
115
+ Mark epic TODO as completed
116
+ </if>
69
117
  </action>
70
118
 
71
119
  <action name="update-state">
@@ -76,31 +124,76 @@ metadata:
76
124
 
77
125
  <action name="compact">
78
126
  Mark next epic as in_progress in TODO
79
- Wait for auto-compaction
80
- Plugin reads sprint TODO → resume
127
+ Wait for auto-compaction → resume
81
128
  </action>
82
129
 
83
130
  </for-each>
84
131
  </phase>
85
132
 
86
133
  <phase name="4-finalize" title="Finalize Sprint">
87
- <step n="1">Run sprint integration tests (mark in TODO)</step>
88
- <step n="2">Set sprint status="done" in sprint-status.yaml</step>
89
- <step n="3">Clear sprint TODO list</step>
90
- <step n="4">Report completion with summary + metrics</step>
134
+ <critical>Sprint also goes through review before done!</critical>
135
+ <step n="1">All epics done set sprint status: review</step>
136
+ <step n="2">Run sprint integration tests (mark in TODO)</step>
137
+ <step n="3">If tests fail fix → re-test</step>
138
+ <step n="4">All passed → set sprint status: done in sprint-status.yaml</step>
139
+ <step n="5">Clear sprint TODO list</step>
140
+ <step n="6">Update .opencode/session-state.yaml (done)</step>
141
+ <step n="7">Report completion with summary + metrics</step>
91
142
  </phase>
92
143
 
93
144
  </workflow>
94
145
 
146
+ ## Session State (MANDATORY)
147
+
148
+ After each epic/story/task completion, update `.opencode/session-state.yaml`:
149
+
150
+ ```yaml
151
+ # .opencode/session-state.yaml — AI writes, compaction plugin reads
152
+ command: /dev-sprint
153
+ agent: dev
154
+
155
+ sprint:
156
+ number: 2
157
+ status: in-progress
158
+
159
+ epic:
160
+ id: PROJ-E04
161
+ title: Current Epic Title
162
+ file: docs/sprint-artifacts/sprint-2/epic-04-desc.md
163
+ progress: "3/5 stories"
164
+
165
+ story:
166
+ id: PROJ-S04-03
167
+ title: Current Story Title
168
+ file: docs/sprint-artifacts/sprint-2/stories/story-04-03-desc.md
169
+ current_task: T2
170
+ completed_tasks: [T1]
171
+ pending_tasks: [T2, T3]
172
+
173
+ next_action: "Continue T2 of story S04-03"
174
+
175
+ key_decisions:
176
+ - "Decision 1"
177
+ ```
178
+
179
+ This file survives compaction and tells the agent where to resume.
180
+
95
181
  <outputs>
96
182
  - Implementation code for all stories in sprint
97
183
  - Updated sprint-status.yaml
184
+ - Updated .opencode/session-state.yaml
98
185
  - Clean TODO list (all completed)
99
186
  </outputs>
100
187
 
101
188
  <rules>
102
189
  <do>Create ONE master TODO list for entire sprint at start</do>
103
190
  <do>Let dev-epic skill manage its own nested TODO</do>
191
+ <do>Execute epics IN ORDER as planned in sprint-status.yaml</do>
192
+ <do>Within each epic, execute stories IN ORDER as planned</do>
193
+ <do>Within each story, execute tasks ONE BY ONE (or parallel if independent)</do>
104
194
  <dont>Ask for confirmation between epics — sprint TODO is your guide</dont>
105
195
  <dont>Proceed to next epic if epic review fails — HALT and report</dont>
196
+ <dont>Reorder, skip, merge, or "optimize" epic/story execution order</dont>
197
+ <dont>Work on multiple stories or epics in parallel</dont>
198
+ <dont>Delegate entire story to @coder in one prompt — task by task only</dont>
106
199
  </rules>