@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,82 @@
1
+ ---
2
+ name: specflow-plan
3
+ description: "First-iteration deep analysis -- proposal + specs + design + tasks"
4
+ ---
5
+
6
+ # SpecFlow: Plan
7
+
8
+ > **HARD GATE**: User must confirm proposal before specs generation.
9
+
10
+ ## Purpose
11
+
12
+ Plan is the **first-iteration deep-analysis pass**: in a single invocation it produces all four change artifacts (`proposal.md`, delta `specs/`, `design.md`, `tasks.md`). The design and tasks are substantive first drafts — not placeholders — but `/specflow:refine` will later rewrite them across multiple rounds of iteration, and `/specflow:build` Phase A will regenerate `tasks.md` under strict writing-plans rules.
13
+
14
+ Treat every artifact here as "v1, to be iterated on" — depth matters, but so does moving through all four stages in one pass.
15
+
16
+ ## Prerequisites
17
+
18
+ - `specflow/specs/` directory should exist, indicating this is a specflow-initialized project. For a brand-new greenfield change with no existing specs, proceed — the prompt handles that case. If `specflow/` itself does not exist, suggest running `specflow init` first.
19
+ - `specflow` CLI must be available on PATH.
20
+
21
+ ## Stage 1: Create Change
22
+
23
+ Run `specflow change new <name>` to initialize a new change directory.
24
+
25
+ The CLI automatically sets `phase=plan` in `.specflow.yaml` on creation (no separate phase call needed here).
26
+
27
+ ## Stage 2: Generate Proposal
28
+
29
+ Read the file at `.claude/specflow/prompts/plan/proposal.md` and follow its instructions.
30
+
31
+ **Important**: That prompt file contains the required interactive Q&A flow, the exact proposal format (`## Why` / `## What Changes` / `## Capabilities` / `## Impact`), and the user confirmation gate. You MUST read it before writing the proposal — do not invent the format.
32
+
33
+ Generate the proposal document inside the change directory at `specflow/changes/<name>/proposal.md`.
34
+
35
+ ### Gate: Proposal Confirmation (HARD GATE)
36
+
37
+ Present the proposal to the user.
38
+ **Ask the user to confirm the proposal.**
39
+ Do NOT proceed to specs generation until the user explicitly confirms. This is the only mandatory hard gate in the plan flow — everything that follows flows through without interruption so the user can review the full first-iteration package at the end.
40
+
41
+ ## Stage 3: Generate Specs
42
+
43
+ Read the file at `.claude/specflow/prompts/plan/specs.md` and follow its instructions.
44
+
45
+ Generate delta specs inside the change directory at `specflow/changes/<name>/specs/<capability>/spec.md`.
46
+
47
+ ### Gate: Specs Confirmation (optional light gate)
48
+
49
+ Briefly summarize the delta specs generated. Accept a quick acknowledgement from the user ("looks good" / "continue") and proceed. If the user raises substantive objections, pause and revise — otherwise continue directly to Stage 4. This is an optional checkpoint, not a full hard gate; deeper scrutiny will happen in `/specflow:refine`.
50
+
51
+ ## Stage 4: Generate Design (first-iteration)
52
+
53
+ Read the file at `.claude/specflow/prompts/plan/design-draft.md` and follow its instructions.
54
+
55
+ Generate `design.md` inside the change directory. This draft should be substantive: identify real architectural decisions, capture options considered, and record rationale. It is a first iteration — `/specflow:refine` will deepen it through multiple brainstorming rounds — but it is NOT a placeholder.
56
+
57
+ **No gate here.** Continue directly to Stage 5. The user will review everything together at Stage 6.
58
+
59
+ ## Stage 5: Generate Tasks (first-iteration)
60
+
61
+ Read the file at `.claude/specflow/prompts/plan/tasks-draft.md` and follow its instructions.
62
+
63
+ Generate `tasks.md` inside the change directory. Produce a substantive first-iteration task breakdown (3–8 tasks typical), ordered with dependencies. Do not write placeholders like "TBD" or "implement feature". `/specflow:build` Phase A will rewrite this file under strict writing-plans rules, but this first draft feeds both `/specflow:refine` context and Phase A analysis.
64
+
65
+ **No gate here.** Continue directly to Stage 6.
66
+
67
+ ## Stage 6: Final Review
68
+
69
+ Present all four artifacts to the user with clear "first-iteration" labeling:
70
+
71
+ - `proposal.md` — confirmed in Stage 2
72
+ - Delta `specs/` under the change directory — the contract
73
+ - `design.md` — **first-iteration draft**; `/specflow:refine` will deepen this across multiple rounds
74
+ - `tasks.md` — **first-iteration draft**; `/specflow:build` Phase A will rewrite this under strict writing-plans rules
75
+
76
+ Make the iteration expectation explicit: the user should not treat design/tasks as final. They are deliberate first drafts produced so downstream skills have real substance to work with.
77
+
78
+ ### Next Step
79
+
80
+ Suggest `/specflow:refine` to enter the multi-round refinement loop that rewrites `design.md` (and optionally updates the other artifacts) based on brainstorming. After refine completes, `/specflow:build` will consume the refined artifacts.
81
+
82
+ No hard gate after Stage 6 — `/specflow:refine` owns the next overall validation gate.
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: specflow-refine
3
+ description: "Technical deepening -- multi-round attacking review + 4 challenge behaviors + Superpowers 9-step"
4
+ ---
5
+
6
+ # SpecFlow: Refine
7
+
8
+ > **HARD GATE**: No implementation or scaffolding until user confirms refined artifacts.
9
+ > Phase MUST advance to `refined` only with explicit user confirmation of the final state.
10
+
11
+ Refine runs as an **internal auto-multi-round loop** within one invocation. Minimum 2 rounds
12
+ unconditional; AI semantically judges convergence after round 2; no upper limit. Each round
13
+ runs the Superpowers 9-step brainstorming process with 4 challenge behaviors injected,
14
+ produces impact analysis, lets the user pick scope (A/B/C), writes & validates updates, and
15
+ emits a round diff summary.
16
+
17
+ ## Prerequisites
18
+
19
+ - Active change with `.specflow.yaml` `phase=plan` (refine refuses if phase is not `plan`).
20
+ - All 4 plan-phase artifacts exist in `specflow/changes/<name>/`:
21
+ - `proposal.md`
22
+ - `specs/**/*.md` (at least one delta spec)
23
+ - `design.md`
24
+ - `tasks.md`
25
+ - `specflow` CLI available on PATH (for `specflow validate` and the final phase transition).
26
+
27
+ If any precondition fails, stop and instruct the user to run `/specflow:plan` first.
28
+
29
+ ## Stage 1: Pre-loop setup
30
+
31
+ Read, in order:
32
+
33
+ 1. `specflow/changes/<name>/proposal.md`
34
+ 2. All files under `specflow/changes/<name>/specs/`
35
+ 3. `specflow/changes/<name>/design.md`
36
+ 4. `specflow/changes/<name>/tasks.md`
37
+ 5. `specflow/specs/` main baseline (for context on what this change diffs against)
38
+ 6. `.claude/specflow/prompts/refine/brainstorm.md` (the 9-step + 4 challenge behaviors process)
39
+ 7. `.claude/specflow/prompts/refine/update-artifacts.md` (impact analysis + format preservation)
40
+
41
+ Summarize the current state of the 4 artifacts for the user in 3-5 bullets, then announce
42
+ `Round 1 start` and enter the LOOP.
43
+
44
+ ## LOOP (Stages 2-4) — each iteration is one refine round
45
+
46
+ Repeat Stages 2 → 3 → 4 for every round. Stage 5 decides whether to loop again.
47
+
48
+ ### Stage 2: Execute the 9-step brainstorming (per brainstorm.md)
49
+
50
+ Follow `.claude/specflow/prompts/refine/brainstorm.md` Steps 1-4:
51
+
52
+ - Step 1 — Examine existing artifacts (inject Challenge Behavior #1: challenge plan's
53
+ assumptions)
54
+ - Step 2 — Ask clarifying questions (inject Challenge Behaviors #3 and #4: explore omitted
55
+ boundaries, question scope)
56
+ - Step 3 — Propose 2-3 approaches with trade-offs (inject Challenge Behavior #2: propose
57
+ new options for every existing decision)
58
+ - Step 4 — Present design sections for the updates this round proposes
59
+
60
+ Each round MUST produce visible output for each of the 4 challenge behaviors. Do not let
61
+ them be implicit — the user should see the behaviors fire.
62
+
63
+ ### Stage 3: Impact analysis + user scope choice (per update-artifacts.md)
64
+
65
+ Hand off to `.claude/specflow/prompts/refine/update-artifacts.md`:
66
+
67
+ - Apply routing rules to decide which files the round's conclusions affect.
68
+ - Present the impact analysis block listing every affected file.
69
+ - Wait for the user to pick scope A (apply all), B (primary only, defer cascades), or
70
+ C (defer entirely).
71
+
72
+ Never begin writing without the user's explicit A/B/C choice.
73
+
74
+ ### Stage 4: Apply updates + validate + report round diff summary
75
+
76
+ Still under update-artifacts.md:
77
+
78
+ - Apply the writes implied by the user's scope choice, respecting per-artifact format
79
+ preservation rules.
80
+ - Run `specflow validate` on any modified spec file. If validation fails, revert the file
81
+ to its pre-edit state and report the issue to the user; do not proceed until resolved.
82
+ - Emit the round-end diff summary in the format defined by update-artifacts.md.
83
+ - Announce `Round N end`.
84
+
85
+ ## Stage 5: Convergence check
86
+
87
+ Apply this logic at the end of every round:
88
+
89
+ - **If round < 2**: `round++`, unconditionally loop back to Stage 2. The 2-round minimum
90
+ is non-negotiable — do not ask the user whether to continue before round 2 completes.
91
+ - **If round ≥ 2**: perform AI semantic convergence judgment per brainstorm.md Step 8:
92
+ - Are there still meaningful unaddressed challenges across the 4 behaviors?
93
+ - Are there open clarifying questions?
94
+ - Are there unresolved scope concerns?
95
+ - Is any artifact still stale relative to the discussion?
96
+ - Did the latest round introduce new considerations not yet propagated?
97
+ - If ANY answer is yes: NOT converged → `round++`, loop back to Stage 2.
98
+ - If ALL answers are no: converged → proceed to Stage 6.
99
+ - **User override**: the user may request additional rounds at any time, even after AI
100
+ judges convergence. User override takes precedence — `round++` and loop back to Stage 2.
101
+
102
+ Announce each round's convergence decision (and its reasoning) to the user as part of the
103
+ Stage 4 round-end output.
104
+
105
+ ## Stage 6: Final confirmation
106
+
107
+ Only reached after Stage 5 declared convergence AND the user did not request another round.
108
+
109
+ 1. Present a **cross-round summary**: what changed in each round, which artifacts now differ
110
+ from the plan-phase baseline, which decisions were resolved, which questions remained
111
+ open (if any).
112
+ 2. **HARD GATE**: Wait for the user's explicit confirmation of the final refined state.
113
+ A mere acknowledgement of a round's diff summary is NOT confirmation of the overall
114
+ refined state — ask explicitly: "Confirm this refined state is final and I should mark
115
+ the phase as `refined`?"
116
+ 3. On explicit confirmation: invoke `specflow change phase <name> --set refined` to
117
+ advance `.specflow.yaml` `phase` from `plan` to `refined`.
118
+ 4. Suggest `/specflow:build` as the next slash command.
119
+
120
+ If the user declines to confirm and requests more exploration, treat it as a user-requested
121
+ extra round (loop back to Stage 2, phase stays `plan`).
122
+
123
+ ## Not covered by refine
124
+
125
+ - No Phase A rewriting of `tasks.md` at writing-plans precision — that belongs to
126
+ `/specflow:build` Phase A.
127
+ - No code scaffolding, no implementation, no worktree setup — build owns all of that.
128
+ - Refine only updates artifacts and advances phase to `refined`; it never touches code.
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: specflow-review
3
+ description: "Spec-aware code review with regression checking"
4
+ ---
5
+
6
+ # SpecFlow: Review
7
+
8
+ ## Prerequisites
9
+
10
+ - An active change must exist with specs and implementation work in progress.
11
+ - Code changes must be present (staged or unstaged).
12
+
13
+ ## Stage 1: Dispatch Reviewer
14
+
15
+ Read the file at `.claude/specflow/prompts/review/code-review.md` and follow its instructions.
16
+
17
+ Dispatch the reviewer against the current code changes. The review must be spec-aware:
18
+ - Check implementation against delta specs
19
+ - Check for regressions against main specs
20
+ - Verify naming and structural conventions
21
+
22
+ ## Stage 2: Severity Triage
23
+
24
+ Categorize findings by severity:
25
+ - **CRITICAL**: Blocks merge. Must be fixed before proceeding.
26
+ - **HIGH**: Should be fixed. Requires justification to skip.
27
+ - **MEDIUM**: Recommended fix. Can defer with acknowledgment.
28
+ - **LOW**: Suggestions and style nits.
29
+
30
+ ## Stage 3: Report
31
+
32
+ Present the triage report to the user.
33
+
34
+ If any CRITICAL findings exist:
35
+ - List them explicitly.
36
+ - **CRITICAL findings block merge.** Inform the user that these must be resolved.
37
+
38
+ If no CRITICAL findings:
39
+ - Summarize HIGH/MEDIUM/LOW counts.
40
+ - Inform the user the code is eligible to proceed.
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: specflow-scan
3
+ description: "[PLANNED v0.3] Brownfield project scanner -- not yet functional"
4
+ ---
5
+
6
+ # SpecFlow: Scan (Planned — v0.3)
7
+
8
+ > **NOT YET FUNCTIONAL.** The `specflow scan` CLI subcommand does not exist in v0.2.x. Invoking this skill would immediately fail when it tries to run `specflow scan`. The skill is kept registered so its slot is reserved in the command namespace; the implementation is planned for v0.3.
9
+
10
+ ## Behavior in v0.2.x
11
+
12
+ If the user triggers `/specflow:scan` or `$specflow-scan`, do NOT attempt to run `specflow scan` (the CLI will return an unknown-command error). Instead respond:
13
+
14
+ > "`/specflow:scan` / `$specflow-scan` is planned for v0.3 and not yet implemented in v0.2.x. For a brownfield project that has no `specflow/specs/` baseline yet, the workable alternative today is:
15
+ >
16
+ > 1. Run `specflow init --ide both` (or `--ide all` / `--ide codex`) if not already done (creates `specflow/` and IDE assets under `.cursor/`, `.claude/`, and/or `.agents/`).
17
+ > 2. Identify one capability area you are about to change (e.g. `user-auth`, `billing`).
18
+ > 3. Run `/specflow:plan` or `$specflow-plan \"<your change description>\"` directly. In the proposal Q&A, describe the existing behavior in the affected area — plan will generate both the delta spec for your change and an implicit first pass at the capability's contract. After the first archive, the delta becomes the main spec baseline for that capability.
19
+ >
20
+ > This is not a perfect substitute for a full code scan, but it keeps the spec-driven flow moving without waiting for v0.3."
21
+
22
+ Then stop. Do not proceed to any Stage 1/2/3 behavior below — those describe the planned v0.3 flow.
23
+
24
+ ## Planned design (v0.3) — for reference, not currently executable
25
+
26
+ ### Planned Stage 1: Execute Scan
27
+
28
+ Run `specflow scan` against the target project. If `--module` flag is provided, read the IDE-local prompt file:
29
+
30
+ - Cursor: `.cursor/specflow/prompts/shared/dispatching-parallel-agents.md`
31
+ - Claude: `.claude/specflow/prompts/shared/dispatching-parallel-agents.md`
32
+ - Codex: `.agents/specflow/prompts/shared/dispatching-parallel-agents.md`
33
+
34
+ Then scan modules in parallel; otherwise run a single pass.
35
+
36
+ ### Planned Stage 2: Present Results
37
+
38
+ Scan produces `specflow/SCAN_REPORT.md`. Present a summary highlighting detected modules, identified specs and coverage gaps, and suggested next actions.
39
+
40
+ ### Planned Gate: User Confirmation
41
+
42
+ Ask the user to confirm the scan results. Do NOT proceed until explicit confirmation. Confirmed results become the Source of Truth for all downstream commands.
43
+
44
+ ### Planned Stage 3: Finalize
45
+
46
+ Once confirmed, the scan results are locked and the user can run `/specflow:plan` to begin requirements planning.
47
+
48
+ The v0.3 design rationale, scope, and risks will be captured in a dedicated `openspec` change at v0.3 planning time.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: specflow-snap
3
+ description: "Post-hoc change documentation from git diff"
4
+ ---
5
+
6
+ # SpecFlow: Snap
7
+
8
+ ## Prerequisites
9
+
10
+ - Git repository must have uncommitted or recent committed changes to document.
11
+ - `specflow` CLI must be available on PATH.
12
+
13
+ ## Stage 1: Analyze Changes
14
+
15
+ Run `git diff` and `git log` to capture what changed.
16
+
17
+ Collect:
18
+ - Files modified, added, removed
19
+ - Commit messages (if committed)
20
+ - Diff summary per file
21
+
22
+ ## Stage 2: Generate Change
23
+
24
+ Create a new change with all tasks pre-marked as done:
25
+ - Generate proposal from the diff summary
26
+ - Generate delta specs inferred from the actual code changes
27
+ - Generate tasks.md with all tasks marked complete
28
+
29
+ ## Stage 3: Infer Delta Specs
30
+
31
+ From the code changes, infer what behavioral specs were added or modified.
32
+ Write delta spec files inside the change directory.
33
+
34
+ ## Gate: User Confirmation
35
+
36
+ Present the generated change documentation to the user.
37
+ **Ask the user to confirm the inferred specs are accurate.**
38
+ Do NOT archive until confirmed.
39
+
40
+ ## Stage 4: Mark Phase Built
41
+
42
+ Before archive, invoke `specflow change phase <name> --set built` since snap produces a complete retroactive record equivalent to a built change. The CLI creates the snap change with `phase=plan`, but snap's entire flow (analyze → generate → infer → confirm) is post-hoc documentation of already-built work, so setting the phase explicitly satisfies the archive guard without needing `--force`.
43
+
44
+ ## Stage 5: Archive
45
+
46
+ Once confirmed, run `specflow change archive <name>` to merge the inferred specs into main specs.
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: specflow-test
3
+ description: "Multi-level test execution with verification"
4
+ ---
5
+
6
+ # SpecFlow: Test
7
+
8
+ > **HARD GATE**: No "should work" claims -- verification evidence is required.
9
+
10
+ ## Prerequisites
11
+
12
+ - An active change must exist with implementation work present.
13
+ - Test framework must be configured in the project.
14
+
15
+ ## Stage 1: Detect Affected Modules
16
+
17
+ Analyze the current change to identify which modules are affected.
18
+ Determine the appropriate test scope (unit, integration, e2e).
19
+
20
+ ## Stage 2: Execute Tests
21
+
22
+ Read the file at `.claude/specflow/prompts/test/tdd.md` and follow its instructions.
23
+
24
+ Run the test suite for affected modules. Capture:
25
+ - Pass/fail counts
26
+ - Coverage metrics
27
+ - Failure details with stack traces
28
+
29
+ ## Stage 3: Verify Results
30
+
31
+ Read the file at `.claude/specflow/prompts/test/verification.md` and follow its instructions.
32
+
33
+ Produce a verification report with concrete evidence:
34
+ - Actual test output (not summaries)
35
+ - Coverage numbers per module
36
+ - Any flaky or skipped tests noted
37
+
38
+ ## On Failure: Debug Loop
39
+
40
+ If tests fail:
41
+ Read the file at `.claude/specflow/prompts/fix/debug.md` and follow its instructions.
42
+
43
+ Diagnose the root cause. Fix and re-run. Repeat until green or escalate to user.
44
+
45
+ ## Stage 4: Report
46
+
47
+ Present the verification report to the user.
48
+ Every claim must be backed by evidence from test output.
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: specflow-verify
3
+ description: "Dual validation -- delta specs + main specs regression"
4
+ ---
5
+
6
+ # SpecFlow: Verify
7
+
8
+ ## Prerequisites
9
+
10
+ - An active change must exist with delta specs and implementation.
11
+ - `specflow` CLI must be available on PATH.
12
+ - Main specs in `specflow/specs/` are optional: if present, regression is verified against them; if absent (greenfield project that has not archived any change yet), Pass 2 is explicitly skipped (see Stage 2 Pass 2 below). Never silently pass Pass 2 when the directory is missing — always report `skipped (no baseline)` so a main-specs deletion in a brownfield project cannot hide behind a green verify.
13
+
14
+ ## Stage 1: CLI Validation
15
+
16
+ Run `specflow validate` to perform structural validation of specs.
17
+
18
+ If validation fails, report errors and stop. The user must fix spec issues before proceeding.
19
+
20
+ ## Stage 2: Verification
21
+
22
+ Read the file at `.claude/specflow/prompts/verify/verification.md` and follow its instructions.
23
+
24
+ Perform three verification passes:
25
+
26
+ ### Pass 1: Delta Acceptance
27
+ Verify that the implementation satisfies all delta specs in the active change.
28
+ Check each spec scenario against actual behavior.
29
+
30
+ ### Pass 2: Regression
31
+ Verify that existing main specs still pass.
32
+ Flag any regressions introduced by the change.
33
+
34
+ **Baseline-aware execution:**
35
+ - Check whether `specflow/specs/` exists AND contains at least one `*.md` file under any capability subdirectory.
36
+ - **If baseline present** — load every main spec, walk each `### Requirement:` and `#### Scenario:`, and verify the implementation still satisfies it. Report pass/fail per spec with concrete evidence (test output, code inspection).
37
+ - **If baseline absent** — do NOT implicitly pass. Emit the exact line `Pass 2: skipped (no baseline — greenfield project or no archived changes yet)` and move on to Pass 3. The explicit marker prevents a deleted/moved `specflow/specs/` in a brownfield project from silently hiding real regressions.
38
+
39
+ ### Pass 3: Scope Creep
40
+ Check that the implementation does not introduce behavior beyond what the delta specs describe.
41
+ Flag any undocumented changes.
42
+
43
+ ### Pass 4: Security Scan (runs only after Pass 1–3 all PASS)
44
+
45
+ Run Pass 4 only when Pass 1, Pass 2 (or its explicit `skipped (no baseline)` marker), and Pass 3 all produce PASS verdicts. If any earlier pass fails, emit `Pass 4: skipped (earlier passes failed)` and skip the security scan.
46
+
47
+ When Pass 1–3 all PASS:
48
+
49
+ 1. Read `package.json` dependencies (if present) and check for Web framework indicators using prefix/substring matching on dependency keys: `express`, `fastify`, `next`, `koa`, `hapi`, `@nestjs/`, `remix-run`, `nuxt`, `sveltekit`, `astro`, `elysia`.
50
+ 2. If no Web framework indicator is found (or `package.json` does not exist), emit `Pass 4: skipped (non-web project detected)` and determine the overall verdict from Passes 1–3 alone.
51
+ 3. Compute changed files:
52
+ ```bash
53
+ git diff --name-only $(git merge-base HEAD $(git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}' || echo main))
54
+ ```
55
+ 4. If the diff contains only non-code files (for example only `.md` files), emit `Pass 4: skipped (no code files in diff)` and determine the overall verdict from Passes 1–3 alone.
56
+ 5. Otherwise read `.claude/specflow/prompts/verify/ecc-security-reviewer.md` and run the security scan against changed code files only. Pre-existing issues outside the diff should be marked `(pre-existing, out of scope)` and must not affect the verdict.
57
+
58
+ **Pass 4 verdict rules:**
59
+ - Any CRITICAL finding → overall verify verdict is `FAIL`
60
+ - Only HIGH findings (no CRITICAL) → overall verify verdict is `PASS with warnings`; list HIGH findings and require user acknowledgement before `/specflow:done`
61
+ - No CRITICAL or HIGH findings → overall verify verdict remains `PASS`
62
+
63
+ ## Stage 3: Report
64
+
65
+ Present a consolidated verification report:
66
+ - Delta acceptance: pass/fail per spec
67
+ - Regression: pass/fail summary, or `skipped (no baseline)` when applicable
68
+ - Scope creep: any findings
69
+ - Pass 4: Security Scan — pass/fail/skipped with findings
70
+ - Overall verdict: `PASS`, `PASS with warnings`, or `FAIL` with reasons
71
+
72
+ A `skipped` Pass 2 MUST appear verbatim in the report — do not fold it into the "pass" summary. The user needs to see that regression coverage was absent, not inferred as clean.
73
+
74
+ **Overall verdict merge rules:**
75
+ - `FAIL` if any of Pass 1–3 fails OR Pass 4 finds CRITICAL security issues
76
+ - `PASS with warnings` if Pass 1–3 all pass and Pass 4 finds only HIGH-severity issues
77
+ - `PASS` if Pass 1–3 all pass and Pass 4 finds no CRITICAL/HIGH issues or is skipped by rule
@@ -0,0 +1,19 @@
1
+ ## Context
2
+
3
+ <!-- Background and current state -->
4
+
5
+ ## Goals / Non-Goals
6
+
7
+ **Goals:**
8
+ <!-- What this design aims to achieve -->
9
+
10
+ **Non-Goals:**
11
+ <!-- What is explicitly out of scope -->
12
+
13
+ ## Decisions
14
+
15
+ <!-- Key design decisions and rationale -->
16
+
17
+ ## Risks / Trade-offs
18
+
19
+ <!-- Known risks and trade-offs -->
@@ -0,0 +1,23 @@
1
+ ## Why
2
+
3
+ <!-- Explain the motivation for this change. What problem does this solve? Why now? -->
4
+
5
+ ## What Changes
6
+
7
+ <!-- Describe what will change. Be specific about new capabilities, modifications, or removals. -->
8
+
9
+ ## Capabilities
10
+
11
+ ### New Capabilities
12
+ <!-- Capabilities being introduced. Replace <name> with kebab-case identifier (e.g., user-auth, data-export, api-rate-limiting). Each creates specs/<name>/spec.md -->
13
+ - `<name>`: <brief description of what this capability covers>
14
+
15
+ ### Modified Capabilities
16
+ <!-- Existing capabilities whose REQUIREMENTS are changing (not just implementation).
17
+ Only list here if spec-level behavior changes. Each needs a delta spec file.
18
+ Use existing spec names from specflow/specs/. Leave empty if no requirement changes. -->
19
+ - `<existing-name>`: <what requirement is changing>
20
+
21
+ ## Impact
22
+
23
+ <!-- Affected code, APIs, dependencies, systems -->
@@ -0,0 +1,42 @@
1
+ <!--
2
+ Delta spec template.
3
+ Only include the sections you need. A typical new-capability spec uses only ADDED.
4
+ A modification may use ADDED + MODIFIED. Removals need REMOVED with Reason+Migration.
5
+
6
+ CRITICAL format rules:
7
+ - Scenarios MUST use exactly 4 hashtags (####). Three hashtags will fail validation.
8
+ - Scenario steps MUST use bullet dash + bold: `- **WHEN** ...` and `- **THEN** ...`.
9
+ - Every requirement MUST have at least one scenario.
10
+ -->
11
+
12
+ ## ADDED Requirements
13
+
14
+ ### Requirement: <!-- requirement name -->
15
+ <!-- requirement text using SHALL/MUST -->
16
+
17
+ #### Scenario: <!-- scenario name -->
18
+ - **WHEN** <!-- condition -->
19
+ - **THEN** <!-- expected outcome -->
20
+
21
+ ## MODIFIED Requirements
22
+
23
+ <!-- Include the FULL updated requirement block (not just the diff).
24
+ The requirement name must match the existing spec exactly. -->
25
+
26
+ ### Requirement: <!-- existing requirement name -->
27
+ <!-- full updated requirement text -->
28
+
29
+ #### Scenario: <!-- updated or new scenario name -->
30
+ - **WHEN** <!-- condition -->
31
+ - **THEN** <!-- new expected outcome -->
32
+
33
+ ## REMOVED Requirements
34
+
35
+ ### Requirement: <!-- requirement name -->
36
+ **Reason**: <!-- why being removed -->
37
+ **Migration**: <!-- how users should adapt -->
38
+
39
+ ## RENAMED Requirements
40
+
41
+ FROM: <!-- old requirement name -->
42
+ TO: <!-- new requirement name -->
@@ -0,0 +1,9 @@
1
+ ## 1. <!-- Task Group Name -->
2
+
3
+ - [ ] 1.1 <!-- Task description -->
4
+ - [ ] 1.2 <!-- Task description -->
5
+
6
+ ## 2. <!-- Task Group Name -->
7
+
8
+ - [ ] 2.1 <!-- Task description -->
9
+ - [ ] 2.2 <!-- Task description -->