@gordon.gan/specflow 1.0.0

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 (178) hide show
  1. package/LICENSE +31 -0
  2. package/README.md +442 -0
  3. package/bin/specflow.js +2 -0
  4. package/dist/cli/commands/change-archive.d.ts +26 -0
  5. package/dist/cli/commands/change-archive.js +50 -0
  6. package/dist/cli/commands/change-new.d.ts +18 -0
  7. package/dist/cli/commands/change-new.js +53 -0
  8. package/dist/cli/commands/change-phase.d.ts +33 -0
  9. package/dist/cli/commands/change-phase.js +66 -0
  10. package/dist/cli/commands/change-status.d.ts +35 -0
  11. package/dist/cli/commands/change-status.js +95 -0
  12. package/dist/cli/commands/doctor.d.ts +9 -0
  13. package/dist/cli/commands/doctor.js +48 -0
  14. package/dist/cli/commands/init.d.ts +16 -0
  15. package/dist/cli/commands/init.js +122 -0
  16. package/dist/cli/commands/instructions.d.ts +21 -0
  17. package/dist/cli/commands/instructions.js +75 -0
  18. package/dist/cli/commands/parity-report.d.ts +10 -0
  19. package/dist/cli/commands/parity-report.js +67 -0
  20. package/dist/cli/commands/sync.d.ts +4 -0
  21. package/dist/cli/commands/sync.js +40 -0
  22. package/dist/cli/commands/validate.d.ts +21 -0
  23. package/dist/cli/commands/validate.js +46 -0
  24. package/dist/cli/index.d.ts +1 -0
  25. package/dist/cli/index.js +52 -0
  26. package/dist/core/archive.d.ts +39 -0
  27. package/dist/core/archive.js +154 -0
  28. package/dist/core/artifact-graph/graph.d.ts +60 -0
  29. package/dist/core/artifact-graph/graph.js +141 -0
  30. package/dist/core/artifact-graph/index.d.ts +10 -0
  31. package/dist/core/artifact-graph/index.js +7 -0
  32. package/dist/core/artifact-graph/instruction-loader.d.ts +45 -0
  33. package/dist/core/artifact-graph/instruction-loader.js +37 -0
  34. package/dist/core/artifact-graph/outputs.d.ts +35 -0
  35. package/dist/core/artifact-graph/outputs.js +48 -0
  36. package/dist/core/artifact-graph/resolver.d.ts +54 -0
  37. package/dist/core/artifact-graph/resolver.js +139 -0
  38. package/dist/core/artifact-graph/schema.d.ts +23 -0
  39. package/dist/core/artifact-graph/schema.js +115 -0
  40. package/dist/core/artifact-graph/state.d.ts +9 -0
  41. package/dist/core/artifact-graph/state.js +93 -0
  42. package/dist/core/artifact-graph/types.d.ts +123 -0
  43. package/dist/core/artifact-graph/types.js +29 -0
  44. package/dist/core/parsers/change-parser.d.ts +20 -0
  45. package/dist/core/parsers/change-parser.js +22 -0
  46. package/dist/core/parsers/index.d.ts +7 -0
  47. package/dist/core/parsers/index.js +4 -0
  48. package/dist/core/parsers/markdown-parser.d.ts +35 -0
  49. package/dist/core/parsers/markdown-parser.js +193 -0
  50. package/dist/core/parsers/requirement-blocks.d.ts +21 -0
  51. package/dist/core/parsers/requirement-blocks.js +57 -0
  52. package/dist/core/parsers/spec-structure.d.ts +22 -0
  53. package/dist/core/parsers/spec-structure.js +105 -0
  54. package/dist/core/specs-apply.d.ts +22 -0
  55. package/dist/core/specs-apply.js +165 -0
  56. package/dist/core/templates/index.d.ts +31 -0
  57. package/dist/core/templates/index.js +80 -0
  58. package/dist/core/templates/types.d.ts +4 -0
  59. package/dist/core/templates/types.js +1 -0
  60. package/dist/core/validation/constants.d.ts +14 -0
  61. package/dist/core/validation/constants.js +14 -0
  62. package/dist/core/validation/types.d.ts +13 -0
  63. package/dist/core/validation/types.js +6 -0
  64. package/dist/core/validation/validator.d.ts +24 -0
  65. package/dist/core/validation/validator.js +250 -0
  66. package/dist/integrations/claude/adapter.d.ts +2 -0
  67. package/dist/integrations/claude/adapter.js +106 -0
  68. package/dist/integrations/codex/adapter.d.ts +2 -0
  69. package/dist/integrations/codex/adapter.js +141 -0
  70. package/dist/integrations/cursor/adapter.d.ts +2 -0
  71. package/dist/integrations/cursor/adapter.js +126 -0
  72. package/dist/integrations/shared/adapter-registry.d.ts +4 -0
  73. package/dist/integrations/shared/adapter-registry.js +27 -0
  74. package/dist/integrations/shared/asset-copy.d.ts +2 -0
  75. package/dist/integrations/shared/asset-copy.js +44 -0
  76. package/dist/integrations/shared/asset-hash.d.ts +4 -0
  77. package/dist/integrations/shared/asset-hash.js +54 -0
  78. package/dist/integrations/shared/capability-evidence.d.ts +1 -0
  79. package/dist/integrations/shared/capability-evidence.js +42 -0
  80. package/dist/integrations/shared/command-catalog.d.ts +6 -0
  81. package/dist/integrations/shared/command-catalog.js +13 -0
  82. package/dist/integrations/shared/managed-assets.d.ts +2 -0
  83. package/dist/integrations/shared/managed-assets.js +21 -0
  84. package/dist/integrations/shared/marker-write.d.ts +3 -0
  85. package/dist/integrations/shared/marker-write.js +48 -0
  86. package/dist/integrations/shared/migration-state.d.ts +2 -0
  87. package/dist/integrations/shared/migration-state.js +67 -0
  88. package/dist/integrations/shared/parity-comparator.d.ts +6 -0
  89. package/dist/integrations/shared/parity-comparator.js +97 -0
  90. package/dist/integrations/shared/parity-manifest.d.ts +13 -0
  91. package/dist/integrations/shared/parity-manifest.js +58 -0
  92. package/dist/integrations/shared/runtime-assets.d.ts +2 -0
  93. package/dist/integrations/shared/runtime-assets.js +21 -0
  94. package/dist/integrations/shared/skill-renderer.d.ts +5 -0
  95. package/dist/integrations/shared/skill-renderer.js +77 -0
  96. package/dist/integrations/shared/types.d.ts +35 -0
  97. package/dist/integrations/shared/types.js +1 -0
  98. package/dist/utils/change-metadata.d.ts +38 -0
  99. package/dist/utils/change-metadata.js +82 -0
  100. package/dist/utils/change-utils.d.ts +53 -0
  101. package/dist/utils/change-utils.js +97 -0
  102. package/dist/utils/file-system.d.ts +35 -0
  103. package/dist/utils/file-system.js +67 -0
  104. package/dist/utils/index.d.ts +7 -0
  105. package/dist/utils/index.js +5 -0
  106. package/dist/utils/project-root.d.ts +22 -0
  107. package/dist/utils/project-root.js +44 -0
  108. package/dist/utils/task-progress.d.ts +39 -0
  109. package/dist/utils/task-progress.js +62 -0
  110. package/package.json +72 -0
  111. package/prompts/build/ecc-go-reviewer.md +80 -0
  112. package/prompts/build/ecc-java-reviewer.md +185 -0
  113. package/prompts/build/ecc-kotlin-reviewer.md +163 -0
  114. package/prompts/build/ecc-python-reviewer.md +102 -0
  115. package/prompts/build/ecc-rust-reviewer.md +98 -0
  116. package/prompts/build/ecc-typescript-reviewer.md +116 -0
  117. package/prompts/build/language-router.md +22 -0
  118. package/prompts/build/phase-a-plan.md +288 -0
  119. package/prompts/build/phase-b-execute.md +276 -0
  120. package/prompts/build/phase-b-review.md +119 -0
  121. package/prompts/build/phase-b-worktree.md +215 -0
  122. package/prompts/build/plan-document-reviewer.md +51 -0
  123. package/prompts/build/tdd.md +184 -0
  124. package/prompts/done/branch-finish.md +204 -0
  125. package/prompts/fix/debug.md +249 -0
  126. package/prompts/plan/design-draft.md +123 -0
  127. package/prompts/plan/proposal.md +85 -0
  128. package/prompts/plan/specs.md +114 -0
  129. package/prompts/plan/tasks-draft.md +123 -0
  130. package/prompts/reference/openspec/apply-instruction.md +2 -0
  131. package/prompts/reference/openspec/design-instruction.md +20 -0
  132. package/prompts/reference/openspec/proposal-instruction.md +18 -0
  133. package/prompts/reference/openspec/specs-instruction.md +47 -0
  134. package/prompts/reference/openspec/tasks-instruction.md +26 -0
  135. package/prompts/reference/specflow/example-design.md +284 -0
  136. package/prompts/reference/superpowers/anthropic-best-practices.md +1150 -0
  137. package/prompts/reference/superpowers/codex-tools.md +29 -0
  138. package/prompts/reference/superpowers/condition-based-waiting-example.ts +158 -0
  139. package/prompts/reference/superpowers/condition-based-waiting.md +115 -0
  140. package/prompts/reference/superpowers/defense-in-depth.md +122 -0
  141. package/prompts/reference/superpowers/find-polluter.sh +63 -0
  142. package/prompts/reference/superpowers/graphviz-conventions.dot +172 -0
  143. package/prompts/reference/superpowers/persuasion-principles.md +187 -0
  144. package/prompts/reference/superpowers/root-cause-tracing.md +169 -0
  145. package/prompts/reference/superpowers/testing-anti-patterns.md +299 -0
  146. package/prompts/reference/superpowers/testing-skills-with-subagents.md +384 -0
  147. package/prompts/reference/superpowers/using-superpowers.md +117 -0
  148. package/prompts/reference/superpowers/writing-skills.md +655 -0
  149. package/prompts/refine/brainstorm.md +241 -0
  150. package/prompts/refine/design-output.md +126 -0
  151. package/prompts/refine/spec-document-reviewer.md +51 -0
  152. package/prompts/refine/update-artifacts.md +185 -0
  153. package/prompts/review/code-review.md +223 -0
  154. package/prompts/shared/code-reviewer-prompt.md +98 -0
  155. package/prompts/shared/dispatching-parallel-agents.md +143 -0
  156. package/prompts/shared/executing-plans.md +67 -0
  157. package/prompts/shared/implementer-prompt.md +115 -0
  158. package/prompts/shared/receiving-code-review.md +174 -0
  159. package/prompts/shared/spec-reviewer-prompt.md +63 -0
  160. package/prompts/test/tdd.md +236 -0
  161. package/prompts/test/verification.md +129 -0
  162. package/prompts/verify/ecc-security-reviewer.md +112 -0
  163. package/prompts/verify/verification.md +196 -0
  164. package/schemas/specflow/schema.yaml +48 -0
  165. package/skills/specflow-build/SKILL.md +129 -0
  166. package/skills/specflow-done/SKILL.md +68 -0
  167. package/skills/specflow-fix/SKILL.md +74 -0
  168. package/skills/specflow-plan/SKILL.md +82 -0
  169. package/skills/specflow-refine/SKILL.md +128 -0
  170. package/skills/specflow-review/SKILL.md +40 -0
  171. package/skills/specflow-scan/SKILL.md +48 -0
  172. package/skills/specflow-snap/SKILL.md +46 -0
  173. package/skills/specflow-test/SKILL.md +48 -0
  174. package/skills/specflow-verify/SKILL.md +77 -0
  175. package/templates/design.md +19 -0
  176. package/templates/proposal.md +23 -0
  177. package/templates/spec.md +42 -0
  178. package/templates/tasks.md +9 -0
@@ -0,0 +1,241 @@
1
+ > **HARD GATE**: No implementation or scaffolding until user confirms refined artifacts.
2
+
3
+ <!-- SOURCE: Superpowers brainstorming (skills/brainstorming/SKILL.md) + SpecFlow refine-phase adaptation -->
4
+
5
+ # Refine-Phase Brainstorming: Attacking Deep Review
6
+
7
+ > This prompt is for **ATTACKING DEEP REVIEW** of plan-phase artifacts.
8
+ > NOT from-scratch brainstorming. The 4 artifacts (proposal, specs, design, tasks)
9
+ > already exist and must be challenged, deepened, and possibly updated.
10
+
11
+ Plan already produced first-iteration drafts. Your job in refine is to **attack those drafts**:
12
+ surface glossed-over assumptions, propose unconsidered alternatives, explore omitted boundaries,
13
+ and question scope — then update whichever artifacts the discussion shows are out of sync.
14
+
15
+ ## Entry Context
16
+
17
+ Before running this brainstorming flow, you MUST have read:
18
+
19
+ - `specflow/changes/<name>/proposal.md`
20
+ - `specflow/changes/<name>/specs/**/*.md`
21
+ - `specflow/changes/<name>/design.md`
22
+ - `specflow/changes/<name>/tasks.md`
23
+ - `specflow/specs/` baseline (main specs) for reference
24
+ - `.claude/specflow/prompts/refine/update-artifacts.md` (the delegated artifact-update methodology)
25
+
26
+ If any of the four change artifacts is missing, stop and tell the user to run `/specflow:plan` first.
27
+
28
+ ## Iteration Rules
29
+
30
+ - **Minimum 2 rounds** is unconditional. Round 1 is unconditional. Round 2 is unconditional.
31
+ Do not ask the user "should we keep going?" before round 2 finishes — minimum 2 rounds means
32
+ at least 2 rounds, every time.
33
+ - After round 2, AI performs **semantic judgment of convergence** (see Step 8). If
34
+ meaningful unaddressed challenges, scope concerns, or stale artifact states remain,
35
+ run another round. If nothing substantive remains, proceed to the final next-step
36
+ announcement.
37
+ - **No upper limit.** Refine continues as long as each round produces substantive new challenges.
38
+ - The AI MUST explicitly announce `Round N start` when a round begins and `Round N end` when
39
+ the round's updates and diff summary are complete, so the user always knows which round they
40
+ are in.
41
+ - The user may request additional rounds at any time (even after AI judges convergence); user
42
+ request overrides AI convergence judgment.
43
+
44
+ ## The 9-Step Process (per round)
45
+
46
+ Each round runs all 9 steps in order. Steps 1–2 are where the 4 challenge behaviors are
47
+ injected; steps 3–5 carry the discussion into artifacts; steps 6–8 close the round.
48
+
49
+ ### Step 1 — Examine existing artifacts (inject Challenge Behavior #1)
50
+
51
+ Re-read all 4 plan-phase artifacts with fresh eyes. This is not a summary exercise — look for
52
+ what the plan *did not* say. Explicitly INJECT **Challenge Behavior #1 (challenge plan's
53
+ assumptions)** here: list assumptions the plan glossed over and explain why each matters. Each
54
+ round MUST produce this list of challenged assumptions, even if shorter than the previous round.
55
+
56
+ ### Step 2 — Ask clarifying questions (inject Challenge Behaviors #3 and #4)
57
+
58
+ Ask the user clarifying questions one at a time, prefering multiple-choice where the options
59
+ are reasonably enumerable. This is where you INJECT **Challenge Behavior #3 (explore omitted
60
+ boundaries)** — survey edge cases, permissions, error modes, non-functional concerns absent
61
+ from specs — and **Challenge Behavior #4 (question scope)** — ask whether the change is too
62
+ broad, too narrow, or should be split. Clarifying questions are how you explore boundaries
63
+ the plan omitted and how you question scope with the user directly.
64
+
65
+ Keep per-message questions small (1 question per message). Batch the mental exploration but
66
+ serialize the user-facing dialogue.
67
+
68
+ ### Step 3 — Propose 2-3 approaches with trade-offs (inject Challenge Behavior #2)
69
+
70
+ For every non-trivial design decision surfaced by Steps 1–2 (both the ones in the existing
71
+ `design.md` and new ones revealed by this round's challenges), INJECT **Challenge Behavior #2
72
+ (propose new options)**: for each existing decision, propose alternative approaches not
73
+ considered in the plan — at least 2 such alternatives per decision, each with pros/cons and
74
+ a recommendation.
75
+
76
+ The 2-3 approaches MUST include the currently-chosen option from `design.md` PLUS genuinely
77
+ different alternatives — not cosmetic variants. If the existing choice still wins, say so
78
+ explicitly with a rationale that references the alternatives considered.
79
+
80
+ ### Step 4 — Present design sections (show proposed updates)
81
+
82
+ Present the design sections being proposed for update. Scale each section to its complexity:
83
+ a few sentences for straightforward points, up to 200–300 words when a decision is nuanced.
84
+ Show the user what would change in `design.md`, which `specs/**/*.md` files would be touched,
85
+ and whether `proposal.md` or `tasks.md` are affected. Ask after each significant section
86
+ whether the direction looks right.
87
+
88
+ ### Step 5 — Write/update artifacts (DELEGATE)
89
+
90
+ DELEGATE to `.claude/specflow/prompts/refine/update-artifacts.md` for impact analysis, user
91
+ scope choice (A/B/C), format preservation rules, per-artifact routing, and post-update
92
+ validation.
93
+
94
+ Do not re-invent the artifact update rules here — the delegated prompt owns them. Return here
95
+ only after the delegated update-artifacts prompt reports back that files are written and
96
+ validated.
97
+
98
+ ### Step 6 — Self-review (format + consistency)
99
+
100
+ With fresh eyes on the just-updated artifacts:
101
+
102
+ 1. **Placeholder scan** — no "TBD", "TODO", or vague requirements; fix inline.
103
+ 2. **Internal consistency** — sections do not contradict each other; architecture matches
104
+ feature descriptions; spec scenarios match design decisions.
105
+ 3. **Format compliance** — run `specflow validate` on any updated spec file. See
106
+ `update-artifacts.md` "Post-update Validation" section for the expected behavior on
107
+ validation failure (revert + report).
108
+ 4. **Round-traceable discussion trail** — any newly resolved decision must appear in
109
+ `design.md` under `## Design Decisions` as a `### Decision N: <name>` block with
110
+ `**Options considered:**`, `**Chosen:**`, and `**Rationale:**`.
111
+
112
+ Fix issues inline. Do not re-enter Step 5 unless a revert happens.
113
+
114
+ ### Step 7 — Request user approval for this round
115
+
116
+ Present the round's diff summary (see `update-artifacts.md` "Diff Summary Format") and ask:
117
+
118
+ > "Round N produced these updates. Does the direction look correct, or do you want to revisit
119
+ > anything before I continue to Step 8 (convergence judgment)?"
120
+
121
+ Wait for user acknowledgement. If the user requests revisions, loop back to Step 3 or Step 5
122
+ as appropriate within this round.
123
+
124
+ ### Step 8 — Judge convergence
125
+
126
+ Apply the convergence rules (see also "Convergence Criteria" section below):
127
+
128
+ - **If this was Round 1**: unconditionally continue. Announce `Round 1 end` and immediately
129
+ start Round 2 from Step 1. The minimum-2-rounds rule is non-negotiable.
130
+ - **If this was Round 2 or later**: perform AI semantic convergence judgment. Ask
131
+ yourself:
132
+ - "Are there still meaningful unaddressed challenges from the 4 challenge behaviors?"
133
+ - "Are there still open clarifying questions from Step 2?"
134
+ - "Are there scope concerns that have not been resolved or explicitly parked?"
135
+ - "Is any artifact still in a state that doesn't reflect the full discussion?"
136
+ - "Has the user introduced a new consideration in the latest round that has not yet
137
+ propagated into the artifacts?"
138
+ - **If ANY of the above yields yes**: convergence NOT reached. Loop back to Step 1 for the
139
+ next round.
140
+ - **If ALL yield no**: convergence reached. Proceed to Step 9.
141
+
142
+ Remember: the user may override convergence. If after AI announces convergence the user says
143
+ "actually, let's dig into X," that is treated as a new round — do not skip to Step 9.
144
+
145
+ ### Step 9 — Next-step indication (only at final convergence)
146
+
147
+ Only reached when Step 8 produced "converged" AND the user did not override it.
148
+
149
+ Announce clearly:
150
+
151
+ > "Refine converged after N rounds. All artifacts have been updated and validated. Please
152
+ > review the final state of proposal.md, specs/, design.md, tasks.md. Confirm that this
153
+ > refined state is what you want — on confirmation I will mark phase as `refined` and you
154
+ > can run `/specflow:build` next."
155
+
156
+ Do NOT invoke phase transition directly from this prompt — the calling SKILL.md owns that
157
+ handoff, which happens only after explicit user confirmation of the final refined state.
158
+
159
+ ## The 4 Challenge Behaviors
160
+
161
+ The 4 behaviors are injected into the 9-step process above, but each round MUST produce
162
+ explicit, substantive output for each. Do not let them be implicit. The user should be able
163
+ to see each behavior fired in the round's output.
164
+
165
+ ### Behavior 1 — challenge plan's assumptions
166
+
167
+ - **Rationale**: plan was a first-iteration pass; assumptions were made under incomplete
168
+ information and some were glossed over. Refine's job is to challenge those assumptions
169
+ before they harden into implementation.
170
+ - **AI self-prompt**: "What did the plan treat as given that actually deserves interrogation?
171
+ What 'of course'-flavored premises are hiding in `proposal.md` or `design.md`?"
172
+ - **Sample user-facing question**: "The plan implies that [X]. Is that actually true for this
173
+ user/context, or is it a plan-time shortcut?"
174
+ - **Expected output per round**: a bulleted list titled "Plan assumptions under scrutiny"
175
+ with at least 1 item (generally 2-5 early rounds, trailing toward 0 as convergence nears).
176
+
177
+ ### Behavior 2 — propose new options
178
+
179
+ - **Rationale**: plan usually picked the first-plausible option per decision. For each
180
+ existing design decision you should propose alternatives — alternatives are where better-fit
181
+ designs emerge.
182
+ - **AI self-prompt**: "For each design decision already in `design.md`, what are the
183
+ alternatives the plan did not consider? For each new decision surfaced by this round's
184
+ challenges, what are the 2-3 approaches?"
185
+ - **Sample user-facing question**: "The plan chose [current approach] for decision D3. I
186
+ also see two alternatives worth considering: [alt A] and [alt B]. Shall I walk through
187
+ trade-offs?"
188
+ - **Expected output per round**: for at least one existing decision, a block showing
189
+ `currently chosen` + `alternative A` + `alternative B` with pros/cons for each.
190
+
191
+ ### Behavior 3 — explore omitted boundaries
192
+
193
+ - **Rationale**: plan specs are drafted under time pressure and tend to cover happy paths
194
+ first. You must explore omitted boundaries — edge cases, permissions, errors,
195
+ non-functional concerns — because those are the most common omissions.
196
+ - **AI self-prompt**: "What scenarios belong in the specs but are missing? What permission,
197
+ auth, or concurrency case isn't covered? What error/failure mode has no `#### Scenario:`?"
198
+ - **Sample user-facing question**: "I don't see a scenario for [failure mode / concurrent
199
+ user / permission-denied path]. Should it be added, explicitly excluded, or deferred?"
200
+ - **Expected output per round**: a checklist of boundary scenarios examined, each marked
201
+ `covered` / `missing → propose adding` / `explicitly out of scope`.
202
+
203
+ ### Behavior 4 — question scope
204
+
205
+ - **Rationale**: plan sets scope early with incomplete information. Refine is the right
206
+ place to question scope — whether the change is too broad (decompose), too narrow
207
+ (expand), or mis-cut (split capability A from B).
208
+ - **AI self-prompt**: "Does the change try to do too much? Too little? Are any capabilities
209
+ being bundled that should live in separate changes?"
210
+ - **Sample user-facing question**: "Capability [X] and capability [Y] are being changed
211
+ together in this proposal. They seem to have independent rollout schedules. Should they
212
+ split into two changes?"
213
+ - **Expected output per round**: a short paragraph titled "Scope check this round" with a
214
+ stance (scope is fine / too broad / too narrow / should split) and supporting reasoning.
215
+
216
+ ## Format Compliance
217
+
218
+ Format compliance is fully delegated to `.claude/specflow/prompts/refine/update-artifacts.md`.
219
+ Do not duplicate the format rules here — read that prompt during Step 5. In summary, it
220
+ owns: per-artifact format preservation, `specflow validate` gating, revert-on-failure, and
221
+ diff summary format.
222
+
223
+ ## Convergence Criteria
224
+
225
+ - **At least 2 rounds** is unconditional (minimum 2 rounds). Do not short-circuit.
226
+ - After round 2, convergence is decided by AI **semantic judgment** using the questions in
227
+ Step 8.
228
+ - Convergence is a product of: no remaining unaddressed challenges across the 4 behaviors,
229
+ no open clarifying questions, no stale artifacts.
230
+ - The user can extend past AI-declared convergence at any time.
231
+ - Each round's convergence decision and its reasoning MUST be visible to the user (part of
232
+ the round-end announcement in Step 8).
233
+
234
+ ## Next Step
235
+
236
+ After Step 9 announces final convergence AND the user confirms the refined state:
237
+ the calling SKILL.md will invoke `specflow change phase <name> --set refined`, then suggest
238
+ `/specflow:build` as the next slash command to run.
239
+
240
+ This prompt itself never writes the phase transition — that is the SKILL orchestrator's job,
241
+ and it happens only after explicit user confirmation of the refined state.
@@ -0,0 +1,126 @@
1
+ # Design Output Generation
2
+
3
+ Orchestration prompt for generating `design.md` from an approved proposal and delta specs.
4
+
5
+ ## Overview
6
+
7
+ The design document captures architectural decisions, technical approach, and risk assessment for a change. It bridges the gap between "what" (specs) and "how" (implementation plan).
8
+
9
+ ## Prerequisites
10
+
11
+ - Approved proposal at `specflow/changes/<change-name>/proposal.md`
12
+ - Delta specs at `specflow/changes/<change-name>/specs/`
13
+
14
+ ## Process
15
+
16
+ ### Step 1: Conflict Check Against Main Specs
17
+
18
+ If `specflow/specs/` exists:
19
+
20
+ 1. Read all spec files in `specflow/specs/`
21
+ 2. Read all delta specs in `specflow/changes/<change-name>/specs/`
22
+ 3. Check for conflicts:
23
+ - Do any delta spec scenarios contradict existing main spec scenarios?
24
+ - Do any REMOVED items break dependencies in other specs?
25
+ - Do any RENAMED items have references elsewhere that need updating?
26
+ 4. Report findings:
27
+ - **No conflicts:** Proceed to design
28
+ - **Conflicts found:** List each conflict with the affected spec files and ask the user how to resolve before proceeding
29
+
30
+ ### Step 2: Gather Design Context
31
+
32
+ Review:
33
+ - The codebase structure (files, architecture, patterns)
34
+ - The proposal's affected areas
35
+ - The delta spec scenarios that need to be supported
36
+ - Existing technical constraints
37
+
38
+ ### Step 3: Generate Design Document
39
+
40
+ **Design document sections:**
41
+
42
+ ```markdown
43
+ # Design: [Change Name]
44
+
45
+ **Date:** YYYY-MM-DD
46
+ **Proposal:** specflow/changes/<change-name>/proposal.md
47
+ **Delta Specs:** specflow/changes/<change-name>/specs/
48
+
49
+ ## Context
50
+
51
+ [What exists today, why it needs to change, relevant technical background]
52
+
53
+ ## Goals
54
+
55
+ - [Goal 1 -- tied to a success criterion from the proposal]
56
+ - [Goal 2]
57
+
58
+ ## Non-Goals
59
+
60
+ - [Explicitly out of scope item 1]
61
+ - [Explicitly out of scope item 2]
62
+
63
+ ## Design Decisions
64
+
65
+ ### [Decision 1: e.g., "Data Storage Approach"]
66
+
67
+ **Options considered:**
68
+ 1. [Option A] -- [trade-offs]
69
+ 2. [Option B] -- [trade-offs]
70
+ 3. [Option C] -- [trade-offs]
71
+
72
+ **Chosen:** [Option X]
73
+ **Rationale:** [Why this option best serves the goals]
74
+
75
+ ### [Decision 2]
76
+ ...
77
+
78
+ ## Architecture
79
+
80
+ [High-level architecture description]
81
+
82
+ ### Component Overview
83
+ - [Component 1]: [responsibility]
84
+ - [Component 2]: [responsibility]
85
+
86
+ ### Data Flow
87
+ [How data moves through the system for key scenarios]
88
+
89
+ ### Interfaces
90
+ [Key interfaces between components]
91
+
92
+ ## Risks
93
+
94
+ | Risk | Likelihood | Impact | Mitigation |
95
+ |------|-----------|--------|------------|
96
+ | [Risk 1] | Low/Med/High | Low/Med/High | [How to address] |
97
+ | [Risk 2] | ... | ... | ... |
98
+
99
+ ## Spec Conflict Resolution
100
+ [If conflicts were found in Step 1, document how each was resolved]
101
+
102
+ ## Open Questions
103
+ [Any remaining questions that need answers before implementation]
104
+ ```
105
+
106
+ ### Step 4: Save Design Document
107
+
108
+ Save to: `specflow/changes/<change-name>/design.md`
109
+
110
+ Commit the design document to git.
111
+
112
+ ### Step 5: Present for Review
113
+
114
+ > "Design document saved to `specflow/changes/<change-name>/design.md`. Please review the decisions and architecture before we proceed to implementation planning."
115
+
116
+ ## Principles
117
+
118
+ - **Decisions must have rationale** -- "we chose X" is not a decision; "we chose X because Y" is
119
+ - **Non-goals are as important as goals** -- explicitly state what you are NOT building
120
+ - **Risks are not optional** -- every design has risks; listing none means you haven't thought about it
121
+ - **Conflict resolution is mandatory** -- don't skip spec conflicts hoping they'll resolve themselves
122
+ - **Keep it proportional** -- a simple change gets a short design; a complex change gets a thorough one
123
+
124
+ ## Next Step
125
+
126
+ Once the design is approved, invoke specflow:build Phase A to create the implementation plan.
@@ -0,0 +1,51 @@
1
+ <!-- SOURCE: skills/brainstorming/spec-document-reviewer-prompt.md -->
2
+
3
+ # Spec Document Reviewer Prompt Template
4
+
5
+ Use this template when dispatching a spec document reviewer subagent.
6
+
7
+ **Purpose:** Verify the spec is complete, consistent, and ready for implementation planning.
8
+
9
+ **Dispatch after:** Spec document is written to `specflow/changes/<change-name>/`
10
+
11
+ ```
12
+ Task tool (general-purpose):
13
+ description: "Review spec document"
14
+ prompt: |
15
+ You are a spec document reviewer. Verify this spec is complete and ready for planning.
16
+
17
+ **Spec to review:** [SPEC_FILE_PATH]
18
+
19
+ ## What to Check
20
+
21
+ | Category | What to Look For |
22
+ |----------|------------------|
23
+ | Completeness | TODOs, placeholders, "TBD", incomplete sections |
24
+ | Consistency | Internal contradictions, conflicting requirements |
25
+ | Clarity | Requirements ambiguous enough to cause someone to build the wrong thing |
26
+ | Scope | Focused enough for a single plan -- not covering multiple independent subsystems |
27
+ | YAGNI | Unrequested features, over-engineering |
28
+
29
+ ## Calibration
30
+
31
+ **Only flag issues that would cause real problems during implementation planning.**
32
+ A missing section, a contradiction, or a requirement so ambiguous it could be
33
+ interpreted two different ways -- those are issues. Minor wording improvements,
34
+ stylistic preferences, and "sections less detailed than others" are not.
35
+
36
+ Approve unless there are serious gaps that would lead to a flawed plan.
37
+
38
+ ## Output Format
39
+
40
+ ## Spec Review
41
+
42
+ **Status:** Approved | Issues Found
43
+
44
+ **Issues (if any):**
45
+ - [Section X]: [specific issue] - [why it matters for planning]
46
+
47
+ **Recommendations (advisory, do not block approval):**
48
+ - [suggestions for improvement]
49
+ ```
50
+
51
+ **Reviewer returns:** Status, Issues (if any), Recommendations
@@ -0,0 +1,185 @@
1
+ # Refine-Phase Artifact Update Methodology
2
+
3
+ > **HARD GATE**: Every update must preserve format compatibility with `specflow validate`
4
+ > and `specflow change archive`. A round that cannot produce a validated file set must
5
+ > revert rather than ship half-valid artifacts.
6
+
7
+ This prompt is invoked by `.claude/specflow/prompts/refine/brainstorm.md` during Step 5
8
+ (Write/update artifacts) of each refine round. It owns impact analysis, user scope choice,
9
+ per-artifact routing, format preservation, and post-update validation.
10
+
11
+ ## When to use this prompt
12
+
13
+ - A refine round has surfaced a concrete update needed in one or more artifacts
14
+ (proposal.md, delta specs, design.md, or tasks.md).
15
+ - brainstorm.md has completed Steps 1-4 and has a discussion trail ready to be committed
16
+ to files.
17
+ - You have NOT yet written any file content in this round — update-artifacts.md owns the
18
+ writing phase.
19
+
20
+ Do not invoke this prompt for read-only discussion. If the round's conclusion is "keep
21
+ talking, no writes yet," skip straight to brainstorm.md Step 7 (user approval).
22
+
23
+ ## Routing Rules
24
+
25
+ Before writing, route each piece of discussion output to the correct artifact. Use the
26
+ table below as the default; if a topic genuinely belongs in more than one file, list all
27
+ of them in the impact analysis.
28
+
29
+ | Discussion topic | Update file |
30
+ |---------------------------------------------------------------|-------------------------------|
31
+ | Scope / motivation changed (why or what-changes shifted) | `proposal.md` |
32
+ | Capability added or removed | `proposal.md` + spec files |
33
+ | New scenario / missed edge case / error mode | `specs/**/*.md` |
34
+ | Requirement phrasing or WHEN/THEN bullet refinement | `specs/**/*.md` |
35
+ | Implementation constraint / design decision emerged | `design.md` |
36
+ | Alternative option chosen over the plan's original pick | `design.md` |
37
+ | Open question that cannot be resolved in this round | `design.md` (`## Open Questions`) |
38
+ | Task structure implications (add/remove/reorganize groups) | `tasks.md` |
39
+ | Task ordering / dependency change | `tasks.md` |
40
+ | Change splits into multiple changes | Stop; raise with user before writing anything |
41
+
42
+ If the discussion implies a cascade (e.g., new capability → new spec file → new task
43
+ group), list every affected file in the impact analysis and let the user choose scope.
44
+
45
+ ## Impact Analysis Template
46
+
47
+ Before touching any file, present this block to the user and wait for choice:
48
+
49
+ ```
50
+ Proposed update affects:
51
+ - <file1>: <what changes>
52
+ - <file2>: <what changes>
53
+ - <file3>: <what changes> (if applicable)
54
+
55
+ This round can:
56
+ A) Apply all updates together
57
+ B) Update only primary file (<file1>), defer others to next round
58
+ C) Defer entirely, continue discussing
59
+
60
+ Choice? [A/B/C]
61
+ ```
62
+
63
+ Interpretation:
64
+
65
+ - **A**: apply every listed update in this round. The diff summary at round end will show
66
+ all files changed.
67
+ - **B**: apply only the primary file; the deferred files are carried into the NEXT round's
68
+ discussion queue (brainstorm.md's multi-round loop is what picks them up — that is the
69
+ entire point of having a loop).
70
+ - **C**: write nothing this round. The discussion continues; the round still counts toward
71
+ the minimum-2-rounds threshold and the round-end diff summary reports "no changes this
72
+ round" honestly.
73
+
74
+ Never proceed to writing without an explicit A/B/C choice from the user.
75
+
76
+ ## Format Preservation Rules
77
+
78
+ Each artifact type has format contracts that `specflow validate` and `specflow change
79
+ archive` rely on. Violating them breaks downstream automation.
80
+
81
+ ### `proposal.md`
82
+
83
+ Must retain these top-level section headers in this order:
84
+
85
+ - `## Why` — motivation paragraph(s)
86
+ - `## What Changes` — bulleted list of changes
87
+ - `## Capabilities` — enumeration of capabilities added/modified/removed
88
+ - `## Impact` — affected files, specs, risks
89
+
90
+ If your update adds new content, put it under the correct section; do not introduce new
91
+ top-level sections without first asking the user.
92
+
93
+ ### `specs/**/*.md`
94
+
95
+ Must retain:
96
+
97
+ - `### Requirement:` (three hashes + "Requirement:" + colon) for every requirement header
98
+ - `#### Scenario:` (EXACTLY four hashes + "Scenario:" + colon) for every scenario header —
99
+ three hashes will make `specflow validate` fail
100
+ - `- **WHEN**` and `- **THEN**` bullet format for every scenario body (one WHEN and one
101
+ THEN minimum; AND bullets are allowed between them)
102
+ - Delta marker headers `## ADDED Requirements` / `## MODIFIED Requirements` /
103
+ `## REMOVED Requirements` / `## RENAMED Requirements` when editing delta specs
104
+
105
+ Do not rename existing requirements unless putting them under `## RENAMED Requirements`
106
+ with explicit `FROM:` / `TO:` marker per spec format.
107
+
108
+ ### `design.md`
109
+
110
+ Follow the archived `create-specflow-plugin` design.md style:
111
+
112
+ - `## Decisions` section with each decision as `### Decision N: <name>` (or `### DN: <name>`),
113
+ containing:
114
+ - `**Options considered:**` list — at least 2 options, each with pros/cons
115
+ - `**Chosen:**` line identifying the selection
116
+ - `**Rationale:**` paragraph explaining why
117
+ - Inline-documented, not a separate change log. The file IS the decision log.
118
+ - `## Open Questions` section for deferred decisions (new in refine).
119
+ - Existing `## Context`, `## Goals / Non-Goals`, `## Risks / Trade-offs` sections remain
120
+ in their original spots.
121
+
122
+ ### `tasks.md`
123
+
124
+ Must stay **coarse-grained**:
125
+
126
+ - Group-level headings (`## Group N: <name>`) with a short description and 3-6 tasks per
127
+ group are the target granularity.
128
+ - Do NOT write 2-5 minute atomic tasks here — that precision comes from build Phase A.
129
+ - Preserve existing ordering cues (e.g., dependency chains between groups) unless the
130
+ discussion explicitly reordered them.
131
+ - Checkbox bullets (`- [ ] ...`) are fine; do not replace them with numbered lists.
132
+
133
+ Coarse granularity is deliberate: refine is about direction, build Phase A is about
134
+ execution precision.
135
+
136
+ ## Post-update Validation
137
+
138
+ After modifying any spec file, automatically run:
139
+
140
+ ```bash
141
+ specflow validate <path-to-spec>
142
+ ```
143
+
144
+ Failure behavior:
145
+
146
+ 1. If `specflow validate` returns non-zero, **revert** the affected file to its
147
+ pre-edit state. Do not attempt multiple repair passes silently.
148
+ 2. Report to the user: "Format issue in `<file>`: `<validator output>`. Reverted to
149
+ pre-edit state. Shall we diagnose together?"
150
+ 3. Do not proceed to the next artifact write until the user decides how to fix.
151
+
152
+ For non-spec artifact writes (`proposal.md`, `design.md`, `tasks.md`), validation is
153
+ structural — confirm the required sections from "Format Preservation Rules" above are
154
+ still present. If they are not, apply the same revert-and-report pattern.
155
+
156
+ ## Diff Summary Format
157
+
158
+ At round end (brainstorm.md Step 7), the AI MUST emit this block so the user sees
159
+ concretely what moved:
160
+
161
+ ```
162
+ Round <N> changes:
163
+ - proposal.md: <summary>
164
+ - specs/<cap>/spec.md: <summary>
165
+ - design.md: added Decision <N> (<name>)
166
+ - tasks.md: <summary>
167
+ ```
168
+
169
+ Rules for the diff summary:
170
+
171
+ - Omit lines for files that were NOT modified in this round (don't write
172
+ "proposal.md: no change"). If nothing was modified, the block reads
173
+ "Round N changes: (none this round — choice C was selected)".
174
+ - For `design.md`, name the specific Decision or Open Question added/modified.
175
+ - For `specs/`, name the capability and whether ADDED/MODIFIED/REMOVED delta was applied.
176
+ - Keep each summary line under 100 characters; detailed prose lives in the files.
177
+
178
+ ## Handoff
179
+
180
+ Return control to brainstorm.md Step 6 (self-review) only after:
181
+
182
+ - The user chose A/B/C.
183
+ - Chosen files were written.
184
+ - `specflow validate` passed (or no spec files were touched).
185
+ - Diff summary is prepared for Step 7.