@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,284 @@
1
+ <!--
2
+ Reference example from the archived create-specflow-plugin change.
3
+ Use this as a structural and depth reference; do NOT copy content blindly.
4
+ Adapt the structure (Context / Goals / Non-Goals / Design Decisions with options+rationale / Risks / Migration / Open Questions)
5
+ to your specific change.
6
+ -->
7
+
8
+ ## Context
9
+
10
+ Two open-source Claude Code frameworks exist today:
11
+
12
+ - **OpenSpec** (Fission-AI): Spec-driven development CLI with artifact dependency graph, change tracking, delta specs, and archiving. TypeScript/Node.js, ~22K lines. Core runtime handles complex operations (Markdown parsing, delta merge, validation).
13
+ - **Superpowers** (obra): Skills-based engineering methodology plugin with brainstorming, TDD, systematic debugging, subagent orchestration, code review, and verification. 14 SKILL.md files (~3K lines) + 3 subagent prompts + supporting reference materials (~45KB+).
14
+
15
+ Both are MIT-licensed. Using them together requires two separate plugin installations and manual coordination, creating skill hijacking risks.
16
+
17
+ The project root is `<project-root>/specflow/` — this IS the SpecFlow framework.
18
+
19
+ ## Goals / Non-Goals
20
+
21
+ **Goals:**
22
+ - Single npm package (`specflow`) with CLI + plugin capabilities
23
+ - Full self-containment: zero dependency on OpenSpec CLI or Superpowers plugin at runtime
24
+ - Port OpenSpec's 6 core TypeScript modules for artifact management, delta merge, and validation
25
+ - Embed and rewrite all 14 Superpowers skills + all supporting materials for SpecFlow style
26
+ - Progressive prompt loading (SKILL.md as orchestrator, Read-loads detailed prompts per stage)
27
+ - Redesigned CLI command structure (not just OpenSpec rename)
28
+ - `specflow init` generates `.claude/skills/` and `.claude/commands/` in target projects
29
+ - Strict user confirmation mode: every task gets review + user approval
30
+ - Brownfield scanning via code-review-graph integration
31
+
32
+ **Non-Goals:**
33
+ - Supporting non-Claude-Code AI tools in V1 (single-platform focus)
34
+ - Visual companion / browser mockup server (Superpowers brainstorming feature — V1 skip)
35
+ - Full OpenSpec CLI feature parity (skip telemetry, shell completions, interactive dashboard, 25+ tool adapters)
36
+ - Building from scratch — port and adapt, don't reinvent
37
+
38
+ ## Decisions
39
+
40
+ ### D1: Unified npm package with CLI + plugin
41
+
42
+ **Choice**: `specflow` is an npm package that provides both a CLI binary (`specflow` command) and a plugin generator (`specflow init` writes `.claude/skills/` and `.claude/commands/` into the target project).
43
+
44
+ **Why**: Users need the CLI for complex operations (delta merge, artifact graph, validation) that can't be reliably done via natural language instructions. The plugin/skills provide the Claude Code slash command interface. Both ship in one package for zero-friction installation.
45
+
46
+ **Installation flow**:
47
+ ```bash
48
+ npm install -g specflow # Install CLI globally
49
+ cd my-project
50
+ specflow init # Generate .claude/skills/, .claude/commands/, openspec/
51
+ ```
52
+
53
+ **Alternative considered**: Pure Markdown plugin (no TypeScript, no CLI) — rejected because delta spec merging and artifact graph require deterministic code, not AI interpretation of Markdown.
54
+
55
+ ### D2: Port OpenSpec core TypeScript modules
56
+
57
+ **Choice**: Port 6 modules from OpenSpec source into SpecFlow's TypeScript codebase:
58
+
59
+ | Module | Purpose | Approx size |
60
+ |--------|---------|-------------|
61
+ | `artifact-graph/` | Dependency resolution, build order, state tracking | ~800 lines |
62
+ | `specs-apply.ts` + `archive.ts` | Delta spec merge to main specs | ~600 lines |
63
+ | `validation/` | Spec format validation (WHEN/THEN, requirement structure) | ~400 lines |
64
+ | `change-utils.ts` + `change-metadata.ts` | Change management utilities | ~300 lines |
65
+ | `parsers/` | Markdown parsing for delta specs | ~400 lines |
66
+ | `templates/` + `instruction-loader.ts` | Template loading and instruction enrichment | ~300 lines |
67
+
68
+ **Total**: ~2800 lines of TypeScript to port.
69
+
70
+ **Why over CLI wrapping**: Self-contained. No `npm install -g openspec` required. We own the code and can evolve it.
71
+
72
+ **Why over pure prompt instructions**: Delta merge is a deterministic text operation (find section, match requirement name, apply ADDED/MODIFIED/REMOVED). Asking Claude to do this via natural language is unreliable and non-reproducible.
73
+
74
+ ### D3: Redesigned CLI command structure
75
+
76
+ **Choice**: Design SpecFlow's CLI commands from scratch rather than copying OpenSpec's structure. Aligned with SpecFlow's 10-command workflow.
77
+
78
+ **Rationale**: OpenSpec's CLI was designed for a broader audience (25+ tools). SpecFlow targets Claude Code specifically and has a different workflow (scan → plan → refine → build → ...). Commands should reflect this workflow.
79
+
80
+ CLI design is a separate task — will be defined during implementation based on the workflows that SKILL.md files need to invoke.
81
+
82
+ ### D4: Progressive prompt loading architecture
83
+
84
+ **Choice**: SKILL.md files are lightweight orchestrators (~50-100 lines) that route execution through stages. Each stage loads its detailed prompt via Claude Code's Read tool from the `prompts/` directory.
85
+
86
+ **Structure example** (`specflow-build/SKILL.md`):
87
+ ```
88
+ SKILL.md (orchestrator, ~80 lines)
89
+ ├── Stage A: Read prompts/build/phase-a-plan.md → generate task plan
90
+ ├── User confirmation gate
91
+ ├── Stage B: Read prompts/build/phase-b-worktree.md → setup isolation
92
+ ├── Stage C: Read prompts/build/phase-b-execute.md → per-task TDD
93
+ │ └── Each subagent: Read prompts/shared/implementer-prompt.md
94
+ ├── Stage D: Read prompts/build/phase-b-review.md → two-phase review
95
+ │ ├── Read prompts/shared/spec-reviewer-prompt.md
96
+ │ └── Read prompts/shared/code-reviewer-prompt.md
97
+ └── User confirmation per task
98
+ ```
99
+
100
+ **Why**: A single specflow-build SKILL.md with all content inline would be ~1300 lines. Claude Code follows smaller, focused prompts more reliably than monolithic ones. Progressive loading keeps each execution stage in a clean context.
101
+
102
+ **Target location in user projects**: `.claude/specflow/prompts/` (avoids conflicts with user's own directories). SKILL.md orchestrators use CWD-relative paths like `.claude/specflow/prompts/build/phase-a-plan.md`.
103
+
104
+ **Prompts directory organization** (hybrid):
105
+ ```
106
+ .claude/specflow/
107
+ ├── prompts/
108
+ │ ├── build/ # Execution-layer: organized by command
109
+ │ │ ├── phase-a-plan.md
110
+ │ │ ├── phase-b-worktree.md
111
+ │ │ ├── phase-b-execute.md
112
+ │ │ ├── phase-b-review.md
113
+ │ │ ├── plan-document-reviewer.md
114
+ │ │ └── tdd.md # TDD copy customized for per-task build context
115
+ │ ├── refine/
116
+ │ │ ├── brainstorm.md
117
+ │ │ ├── design-output.md
118
+ │ │ └── spec-document-reviewer.md
119
+ │ ├── test/
120
+ │ │ ├── tdd.md # TDD copy customized for full-suite test context
121
+ │ │ └── verification.md # Verification copy for test command
122
+ │ ├── verify/
123
+ │ │ └── verification.md # Verification copy for verify command
124
+ │ ├── fix/
125
+ │ │ └── debug.md
126
+ │ ├── plan/
127
+ │ │ ├── proposal.md
128
+ │ │ └── specs.md
129
+ │ ├── review/
130
+ │ │ └── code-review.md
131
+ │ ├── done/
132
+ │ │ └── branch-finish.md
133
+ │ ├── scan/ # (prompts for scan if needed)
134
+ │ ├── snap/ # (prompts for snap if needed)
135
+ │ ├── shared/ # Cross-command prompts
136
+ │ │ ├── implementer-prompt.md
137
+ │ │ ├── spec-reviewer-prompt.md
138
+ │ │ ├── code-reviewer-prompt.md
139
+ │ │ ├── dispatching-parallel-agents.md
140
+ │ │ ├── executing-plans.md
141
+ │ │ └── receiving-code-review.md
142
+ │ └── reference/ # Source-layer: organized by origin
143
+ │ ├── openspec/
144
+ │ │ ├── proposal-instruction.md
145
+ │ │ ├── specs-instruction.md
146
+ │ │ ├── design-instruction.md
147
+ │ │ └── tasks-instruction.md
148
+ │ └── superpowers/
149
+ │ ├── brainstorming-original.md
150
+ │ ├── writing-plans-original.md
151
+ │ ├── tdd-original.md
152
+ │ ├── systematic-debugging-original.md
153
+ │ ├── anthropic-best-practices.md
154
+ │ ├── testing-anti-patterns.md
155
+ │ └── ... (all supporting materials)
156
+ ├── schemas/
157
+ │ └── specflow/schema.yaml # Artifact dependency definitions
158
+ └── templates/
159
+ ├── proposal.md
160
+ ├── spec.md
161
+ ├── design.md
162
+ └── tasks.md
163
+ ```
164
+
165
+ **Cross-command prompts policy**: Prompts used by multiple commands (TDD, verification) are maintained as independent copies per command directory, each customized for its execution context. No symlinks or shared files — each copy can evolve independently.
166
+
167
+ ### D5: User project directory named `specflow/`
168
+
169
+ **Choice**: When SpecFlow is initialized in a user project, the specs/changes directory is `specflow/` (not `openspec/`). Change metadata files are `.specflow.yaml`.
170
+
171
+ **Why**: Brand consistency. Users installed SpecFlow, not OpenSpec. Seeing `openspec/` in their project would be confusing.
172
+
173
+ **Structure in user projects**:
174
+ ```
175
+ my-project/
176
+ ├── specflow/
177
+ │ ├── changes/ # Active changes
178
+ │ ├── specs/ # Main specs (Source of Truth)
179
+ │ ├── config.yaml # Project context, rules
180
+ │ └── archive/ # Archived changes
181
+ └── .claude/
182
+ ├── skills/specflow-*/SKILL.md
183
+ ├── commands/specflow/
184
+ └── specflow/ # prompts, schemas, templates
185
+ ```
186
+
187
+ ### D6: Superpowers full integration — rewrite, not copy
188
+
189
+ **Choice**: All 14 Superpowers SKILL.md files + 3 subagent prompts + all supporting reference materials are included in SpecFlow. Content is **rewritten** to SpecFlow style (naming, paths, next-step references) while preserving original logic exactly.
190
+
191
+ **Integration map**:
192
+
193
+ | Superpowers skill | SpecFlow destination | Type |
194
+ |---|---|---|
195
+ | brainstorming | prompts/refine/brainstorm.md | Command prompt |
196
+ | writing-plans | prompts/build/phase-a-plan.md | Command prompt |
197
+ | subagent-driven-development | prompts/build/phase-b-execute.md | Command prompt |
198
+ | using-git-worktrees | prompts/build/phase-b-worktree.md | Command prompt |
199
+ | test-driven-development | prompts/build/ + prompts/test/ | Shared |
200
+ | requesting-code-review + code-reviewer | prompts/review/ | Command prompt |
201
+ | systematic-debugging | prompts/fix/debug.md | Command prompt |
202
+ | verification-before-completion | prompts/test/ + prompts/verify/ | Shared |
203
+ | finishing-a-development-branch | prompts/done/branch-finish.md | Command prompt |
204
+ | dispatching-parallel-agents | prompts/shared/ | Shared utility |
205
+ | executing-plans | prompts/shared/ | Shared utility |
206
+ | receiving-code-review | prompts/shared/ | Shared utility |
207
+ | using-superpowers | prompts/reference/superpowers/ | Reference only |
208
+ | writing-skills | prompts/reference/superpowers/ | Reference only |
209
+
210
+ **Rewrite rules**:
211
+ - Skill name references: `brainstorming` → `specflow:refine`
212
+ - Path references: `docs/superpowers/specs/` → `openspec/changes/<name>/`
213
+ - Next-step invocations: "Invoke writing-plans skill" → "Proceed to specflow:build"
214
+ - All internal cross-references updated to SpecFlow equivalents
215
+ - Logic, hard gates, fail-stops, verification requirements preserved exactly
216
+
217
+ ### D7: Scan via code-review-graph
218
+
219
+ **Choice**: `/specflow:scan` uses code-review-graph (npm dependency) to analyze codebase structure, then converts the analysis output into OpenSpec specs format.
220
+
221
+ **Why**: Code analysis is a hard problem. Rather than building a custom AST parser for every language, leverage an existing tool that generates structured project knowledge. SpecFlow's value-add is converting that knowledge into actionable specs.
222
+
223
+ **Install**: code-review-graph included as a dependency in SpecFlow's package.json.
224
+
225
+ ### D8: Dual delivery — plugin + .claude/ embed
226
+
227
+ **Choice**: SpecFlow supports two usage modes:
228
+ 1. **As installed CLI + generated skills**: `npm install -g specflow && specflow init` (recommended)
229
+ 2. **As direct .claude/ embed**: Copy skills and commands directly into a project's `.claude/` directory (for users who can't or don't want to install globally)
230
+
231
+ **Why**: Plugin marketplace installation is convenient but introduces a loading layer. Direct `.claude/` embed is maximally deterministic. Supporting both gives users choice.
232
+
233
+ ### D9: Strict user confirmation mode
234
+
235
+ **Choice**: Every task in `specflow:build` completes with a review summary and waits for user confirmation before proceeding to the next task.
236
+
237
+ **Confirmation points across workflow**:
238
+ 1. `scan` → scan results confirmation
239
+ 2. `plan` → proposal direction confirmation
240
+ 3. `refine` → approach selection (2-3 options) + final design confirmation
241
+ 4. `build` Phase A → task plan confirmation
242
+ 5. `build` Phase B → per-task review result + user confirmation
243
+ 6. `review` → critical issues require confirmation
244
+ 7. `done` → 4 options (merge/PR/keep/discard)
245
+
246
+ ### D10: Responsibility boundaries
247
+
248
+ **Choice**: Clear three-layer separation:
249
+ - **CLI** (`specflow` binary) = deterministic state machine: change CRUD, artifact status, delta merge, validation, scan. No AI involvement.
250
+ - **SKILL.md orchestrators** = interaction choreography: stage routing via Read instructions, user confirmation gates, hard gates. ~50-100 lines each.
251
+ - **Prompt files** (`.claude/specflow/prompts/`) = execution instructions: what AI should do at each stage. Loaded on-demand via Read.
252
+ - **AI** (Claude Code) = content generation: writes proposals, specs, designs, tasks, code, tests. Guided by prompts.
253
+
254
+ ### D11: Hard gates — dual enforcement
255
+
256
+ **Choice**: Hard gates (e.g., "no code before design approval", "no completion claims without verification") are enforced at **both** layers:
257
+ 1. **Orchestrator SKILL.md**: Controls flow — will not issue Read for next stage until gate condition met (e.g., user confirmation received)
258
+ 2. **Prompt files**: Each prompt opens with its gate rules repeated, providing defense-in-depth if context drifts
259
+
260
+ **Why both**: Orchestrator is the primary barrier (structural). Prompt repetition is the backup (if Claude's context gets polluted or instructions blur across stages). Belt and suspenders.
261
+
262
+ ### D12: CLI resource location — project-local
263
+
264
+ **Choice**: `specflow init` copies schemas and templates to `.claude/specflow/schemas/` and `.claude/specflow/templates/` in the user project. CLI reads from these local paths at runtime.
265
+
266
+ **Why over global-install path**: Project-local copies allow users to customize schemas or templates per project. No dependency on global install path resolution.
267
+
268
+ ## Risks / Trade-offs
269
+
270
+ **[Port maintenance burden]** → 2800 lines of TypeScript ported from OpenSpec will diverge from upstream. Mitigation: This is intentional — SpecFlow owns its runtime. Version-pinned extraction with clear attribution.
271
+
272
+ **[Progressive loading reliability]** → Claude Code must successfully Read and follow multi-file prompts across stages. Mitigation: Each stage is self-contained with clear entry/exit criteria. If a Read fails, the orchestrator SKILL.md has fallback instructions.
273
+
274
+ **[Large reference files]** → `anthropic-best-practices.md` is 45KB. Loading it consumes significant context. Mitigation: Only loaded on-demand when the writing-skills reference is needed, not during normal user workflows.
275
+
276
+ **[code-review-graph dependency]** → Adds a runtime dependency. Mitigation: Only needed for scan command. Other commands work without it.
277
+
278
+ **[CLI + plugin coherence]** → Must keep CLI behavior and SKILL.md instructions in sync. Mitigation: SKILL.md files call CLI commands for complex operations, so they're always aligned.
279
+
280
+ ## Open Questions
281
+
282
+ - **CLI command naming**: Exact command structure for specflow CLI (to be designed during implementation)
283
+ - **code-review-graph output format**: Need to verify what output format it produces and how to map to OpenSpec specs
284
+ - **Plugin marketplace**: Should SpecFlow register on Claude Code marketplace for V1, or start with manual installation only?