@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,123 @@
1
+ > **HARD GATE — READ THIS FIRST.** This is the **first iteration of deep design analysis**, NOT a placeholder skeleton and NOT a template to fill in later. If your output is "TBD", "to be decided in refine", empty bullets, or boilerplate section headers with no substance, you have failed this task. The refine phase will deepen and challenge this design — but it needs substantive material to challenge. Stub-quality output wastes the refine pass.
2
+
3
+ # Plan Phase: First-Iteration Design Draft
4
+
5
+ ## Purpose
6
+
7
+ Generate a substantive `design.md` representing your **first round of deep thinking** on this change. This is v1 of the design — refine will produce v2 by challenging assumptions, proposing alternative options, probing edge cases, and questioning scope. Your job here is to give refine something real to work with.
8
+
9
+ ## Inputs You Must Read
10
+
11
+ - `specflow/changes/<change-name>/proposal.md` — the approved proposal
12
+ - `specflow/changes/<change-name>/specs/<capability>/spec.md` — all delta specs
13
+ - `specflow/specs/` (if it exists) — current main specs for conflict awareness
14
+ - The codebase itself — read enough files to understand what exists today
15
+
16
+ ## Reference Example (IMPORTANT)
17
+
18
+ **Before you start writing, read this example for structural and depth guidance:**
19
+
20
+ `.claude/specflow/prompts/reference/specflow/example-design.md`
21
+
22
+ That example is the archived design from the `create-specflow-plugin` change. Note specifically:
23
+
24
+ - Each Decision has a **name**, multiple **Options considered** with trade-offs, a **Chosen** option, and a **Rationale** tying the choice back to the goals
25
+ - Goals and Non-Goals are **specific to that change** (not generic software engineering platitudes)
26
+ - Risks are **tied to the actual change** (port maintenance burden, progressive loading reliability, dependency cost) — not generic project management risks
27
+ - Open Questions are concrete ("Should we register on marketplace for V1?") — not filler
28
+
29
+ **Use the example as a quality bar, NOT as a content template to copy.** Your change is different; your decisions, risks, and goals are different. Match the **depth and format**, not the words.
30
+
31
+ ## What To Produce
32
+
33
+ Generate `design.md` with the following sections. Each section has specific instructions — follow them literally.
34
+
35
+ ### 1. Context
36
+
37
+ Describe what exists today and why this change is needed. Include:
38
+
39
+ - Relevant subsystems and their current state
40
+ - Technical constraints (language, platform, existing patterns)
41
+ - Why now — what forces this change
42
+
43
+ Not a place for "we want to build feature X." That belongs in the proposal. Context is the **technical landscape** the change lands in.
44
+
45
+ ### 2. Goals / Non-Goals
46
+
47
+ **Identify the real Goals and Non-Goals of THIS change specifically.**
48
+
49
+ - Goals: tied to success criteria from the proposal, but technically stated ("port 6 OpenSpec modules" — not "make the CLI better")
50
+ - Non-Goals: explicit scope exclusions that a reasonable reader might assume are included ("not supporting non-Claude-Code AI tools in V1" — not generic "we will not boil the ocean")
51
+
52
+ Generic goals like "maintainable code" or "good performance" are **not Goals** — those are engineering defaults. Only list Goals that are distinctive to this change.
53
+
54
+ ### 3. Design Decisions
55
+
56
+ **Identify the real architectural decisions this change requires** — i.e., identify real branch points, not imagined ones. For each decision:
57
+
58
+ 1. Give it a clear name (e.g., "D1: Unified npm package with CLI + plugin")
59
+ 2. List **Options considered** — at least 2, usually 3. Each option with its trade-offs.
60
+ 3. State **Chosen** — which option you're recommending
61
+ 4. Give **Rationale** — the reasoning tying your chosen option to the Goals. Every decision needs its rationale spelled out.
62
+
63
+ **Find the decisions that actually branch.** Don't invent decisions where there's no real choice. Don't skip decisions because "the answer is obvious" — write it down with the options considered and the rationale for why it's obvious.
64
+
65
+ Signals that you've found a real decision:
66
+ - "We could do X or Y, and both have real costs"
67
+ - "The naive approach is X, but it breaks when Z"
68
+ - "The proposal implies X but there's a tension with Y"
69
+
70
+ If during this first iteration you are genuinely uncertain about an option, **mark the decision `(plan-phase analysis, may revise in refine)`**. Honesty about uncertainty is better than false certainty — refine exists precisely to close these gaps. Do NOT use this marker as an escape hatch for every decision; use it only where you actually lack information.
71
+
72
+ ### 4. Risks / Trade-offs
73
+
74
+ **Identify specific risks tied to THIS change.** Each risk should:
75
+ - Be concrete enough that a reader can imagine it materializing
76
+ - Include a mitigation (what reduces likelihood or impact)
77
+
78
+ **Avoid generic risks** like "schedule delay", "scope creep", "team availability", "technical debt", "unknown unknowns" — unless the risk is genuinely tied to this change (e.g., "scope creep because spec has 7 capabilities that could each justify a separate change"). If a risk applies to every software project, it's not a design risk — it's a project management concern.
79
+
80
+ Good risks look like: "Port maintenance burden — 2800 lines diverging from upstream OpenSpec." Bad risks look like: "Delays may occur if the team is busy."
81
+
82
+ ### 5. Migration Plan (if applicable)
83
+
84
+ If the change affects existing users, data, configs, or APIs, describe the migration path. If it's greenfield, you may write "N/A — greenfield change" and move on. Don't write a placeholder migration for a greenfield change.
85
+
86
+ ### 6. Open Questions
87
+
88
+ List specific questions you genuinely cannot answer from proposal + specs + code alone. These will be addressed in refine. Examples:
89
+
90
+ - "Exact CLI command naming — to be designed during implementation"
91
+ - "Should we support operation X or defer to a future change?"
92
+
93
+ If you have no real open questions, write "None at this stage" rather than inventing filler.
94
+
95
+ ## Quality Is Not Quantity-Gated
96
+
97
+ There is **no minimum number** of decisions, risks, or open questions. Two well-argued decisions are better than five shallow ones. The user reviewing the design is the quality judge, not a counter.
98
+
99
+ What matters:
100
+ - Decisions trace to real architectural branches
101
+ - Options have honest trade-offs, not strawmen
102
+ - Rationale ties to Goals
103
+ - Risks are specific and mitigable
104
+ - The reader finishes the document knowing **how** you'd build this, not just **what**
105
+
106
+ ## Save and Proceed
107
+
108
+ Save the document to:
109
+
110
+ ```
111
+ specflow/changes/<change-name>/design.md
112
+ ```
113
+
114
+ **Do NOT ask the user to confirm this draft at this stage.** The end-of-plan summary (handled by the orchestrating SKILL) will present all four plan-phase artifacts together for one cohesive user review. Write the best first-iteration design you can, save it, and move on to the next plan-phase artifact.
115
+
116
+ ## Remember
117
+
118
+ - First iteration, not placeholder
119
+ - Substance over structure — skip sections with "N/A" rather than fake-filling them
120
+ - Reference example is a depth guide, not a copy target
121
+ - Honest uncertainty > false certainty — use the `(plan-phase analysis, may revise in refine)` marker when genuinely uncertain
122
+ - No quantity gates — quality is judged by user review
123
+ - No confirmation gate here — the SKILL handles overall plan-phase review
@@ -0,0 +1,85 @@
1
+ > **HARD GATE**: User must confirm the proposal direction before proceeding to spec generation. Do NOT generate delta specs until the user has reviewed and approved the proposal.
2
+
3
+ # Proposal Generation
4
+
5
+ Generate a proposal document following the SpecFlow format. The proposal establishes WHY a change is needed and WHAT it affects.
6
+
7
+ ## Process
8
+
9
+ ### Step 1: Baseline Awareness
10
+
11
+ Check if `specflow/specs/` exists and contains spec files:
12
+
13
+ ```bash
14
+ ls specflow/specs/ 2>/dev/null
15
+ ```
16
+
17
+ **If specs exist:**
18
+ 1. List all existing spec files
19
+ 2. Identify which specs may be affected by the proposed change
20
+ 3. Note potential conflicts or dependencies
21
+ 4. Report: "Found N existing specs. The following may be affected: [list]"
22
+
23
+ **If no specs exist:**
24
+ - This is a greenfield change; note that no baseline specs need to be considered
25
+
26
+ ### Step 2: Gather Proposal Information
27
+
28
+ Ask the user (one question at a time):
29
+
30
+ 1. **What is the change?** — One sentence summary
31
+ 2. **Why is this needed?** — Motivation and context
32
+ 3. **What is the expected outcome?** — Success criteria
33
+ 4. **What areas are affected?** — Components, modules, interfaces
34
+
35
+ ### Step 3: Generate Proposal Document
36
+
37
+ **CRITICAL: Use the exact format below.** The `Capabilities` section creates the contract between proposal and specs phases — each capability listed here will need a corresponding spec file.
38
+
39
+ ```markdown
40
+ ## Why
41
+
42
+ <!-- 1-2 sentences on the problem or opportunity. What problem does this solve? Why now? -->
43
+
44
+ ## What Changes
45
+
46
+ <!-- Bullet list of changes. Be specific about new capabilities, modifications, or removals. Mark breaking changes with **BREAKING**. -->
47
+
48
+ ## Capabilities
49
+
50
+ ### New Capabilities
51
+ <!-- Capabilities being introduced. Use kebab-case names (e.g., user-auth, data-export). Each creates specs/<name>/spec.md -->
52
+ - `<name>`: <brief description>
53
+
54
+ ### Modified Capabilities
55
+ <!-- Existing capabilities whose REQUIREMENTS are changing. Use existing spec names from specflow/specs/. Leave empty if no requirement changes. -->
56
+ - `<existing-name>`: <what requirement is changing>
57
+
58
+ ## Impact
59
+
60
+ <!-- Affected code, APIs, dependencies, systems -->
61
+ ```
62
+
63
+ **Requirements:**
64
+ - Keep concise (1-2 pages)
65
+ - Focus on "why" not "how" — implementation details belong in design.md
66
+ - Research existing specs before filling in the Capabilities section
67
+ - Use the exact section headings shown above (`## Why`, `## What Changes`, `## Capabilities`, `## Impact`)
68
+
69
+ ### Step 4: Save and Present
70
+
71
+ Save to: `specflow/changes/<change-name>/proposal.md`
72
+
73
+ Present to user for review:
74
+
75
+ > "Proposal saved to `specflow/changes/<change-name>/proposal.md`. Please review the direction and affected areas. Once you confirm, I'll proceed to generate delta specs for each affected capability."
76
+
77
+ ### Step 5: Gate — Wait for User Confirmation
78
+
79
+ **Do NOT proceed to spec generation until the user confirms.**
80
+
81
+ If the user requests changes, update the proposal and re-present.
82
+
83
+ ## Next Step
84
+
85
+ Once approved, proceed to generate delta specs.
@@ -0,0 +1,114 @@
1
+ # Delta Specs Generation
2
+
3
+ Generate delta spec files that define WHAT the system should do for each affected capability.
4
+
5
+ ## Prerequisites
6
+
7
+ - An approved proposal exists at `specflow/changes/<change-name>/proposal.md`
8
+ - User has confirmed the proposal direction
9
+
10
+ ## Process
11
+
12
+ ### Step 1: Read Proposal
13
+
14
+ Read the approved proposal. Extract:
15
+ - Which capabilities are listed under `### New Capabilities` and `### Modified Capabilities`
16
+ - Success criteria to translate into scenarios
17
+
18
+ ### Step 2: Read Existing Specs (if modifying)
19
+
20
+ If modifying existing capabilities, read the current spec from `specflow/specs/<capability>/spec.md`:
21
+ 1. Understand the current requirements and scenarios
22
+ 2. For MODIFIED requirements, copy the ENTIRE requirement block first, then edit
23
+
24
+ ### Step 3: Generate Delta Spec Files
25
+
26
+ Create one spec file per capability at `specflow/changes/<change-name>/specs/<capability>/spec.md`.
27
+
28
+ **CRITICAL FORMAT — the specflow CLI parses this exact structure. Deviations will cause validation and archive failures.**
29
+
30
+ Use `##` headers for delta operation sections. Use `###` for requirements. Use `####` for scenarios. Use `- **WHEN**` and `- **THEN**` bullet format for scenario steps.
31
+
32
+ ```markdown
33
+ ## ADDED Requirements
34
+
35
+ ### Requirement: <requirement name>
36
+ <Description using SHALL/MUST for normative language.>
37
+
38
+ #### Scenario: <scenario name>
39
+ - **WHEN** <precondition or trigger>
40
+ - **THEN** <expected outcome>
41
+
42
+ #### Scenario: <another scenario>
43
+ - **WHEN** <condition>
44
+ - **THEN** <outcome>
45
+
46
+ ## MODIFIED Requirements
47
+
48
+ ### Requirement: <existing requirement name>
49
+ <Full updated description — MUST include complete content, not just the diff.>
50
+
51
+ #### Scenario: <scenario name>
52
+ - **WHEN** <condition>
53
+ - **THEN** <new expected outcome>
54
+
55
+ ## REMOVED Requirements
56
+
57
+ ### Requirement: <requirement name>
58
+ **Reason**: <why this is being removed>
59
+ **Migration**: <how users should adapt>
60
+
61
+ ## RENAMED Requirements
62
+
63
+ FROM: <old requirement name>
64
+ TO: <new requirement name>
65
+ ```
66
+
67
+ **Format rules:**
68
+ - Each requirement: `### Requirement: <name>` followed by description
69
+ - Use SHALL/MUST for normative requirements (avoid should/may)
70
+ - Each scenario: `#### Scenario: <name>` — **MUST use exactly 4 hashtags (`####`)**. Using 3 hashtags will fail validation silently.
71
+ - Scenario steps: `- **WHEN** <condition>` and `- **THEN** <outcome>` — **MUST use bullet dash + bold format**
72
+ - Every requirement MUST have at least one scenario
73
+ - Only include the sections you need (e.g., only `## ADDED Requirements` for new capabilities)
74
+
75
+ **MODIFIED requirements workflow:**
76
+ 1. Read the existing requirement from `specflow/specs/<capability>/spec.md`
77
+ 2. Copy the ENTIRE requirement block (from `### Requirement:` through all scenarios)
78
+ 3. Paste under `## MODIFIED Requirements` and edit to reflect new behavior
79
+ 4. The requirement name must match exactly (whitespace-insensitive)
80
+
81
+ **Common pitfall:** Using MODIFIED with partial content loses detail during archive. If adding new concerns without changing existing behavior, use ADDED instead.
82
+
83
+ ### Step 4: Validate
84
+
85
+ Run validation on each generated spec file:
86
+
87
+ ```bash
88
+ specflow validate specflow/changes/<change-name>/specs/<capability>/spec.md
89
+ ```
90
+
91
+ If validation fails, fix the format issues and re-validate.
92
+
93
+ ### Step 5: Save and Present
94
+
95
+ Save each spec file. Then present a summary:
96
+
97
+ > "Generated N delta specs:
98
+ > - `<capability-1>`: ADDED (N requirements, M scenarios)
99
+ > - `<capability-2>`: MODIFIED (N requirements)
100
+ >
101
+ > All validated. Files at `specflow/changes/<change-name>/specs/`."
102
+
103
+ ## Principles
104
+
105
+ - **One delta spec per capability** — don't merge unrelated capabilities
106
+ - **WHEN/THEN is mandatory** — every behavioral change must have at least one scenario
107
+ - **Be specific** — "WHEN user runs `notecli export`" not "WHEN user interacts"
108
+ - **Include negative scenarios** — error cases, edge cases, empty states
109
+ - **Specs are testable** — each scenario is a potential test case
110
+ - **No implementation details** — describe behavior, not how to build it
111
+
112
+ ## Next Step
113
+
114
+ Once delta specs are approved, proceed to `/specflow:refine` for design work or `/specflow:build` for planning.
@@ -0,0 +1,123 @@
1
+ > **HARD GATE — READ THIS FIRST.** Generate substantive first-iteration tasks. Not placeholders. Not "TBD". Not empty group headers. Each group gets real tasks with concrete verbs. Build Phase A will later rewrite this to writing-plans precision (exact paths, code blocks, bite-sized steps) — but you are producing the first honest pass at "what needs to happen," not a skeleton for someone else to fill.
2
+
3
+ # Plan Phase: First-Iteration Tasks Draft
4
+
5
+ ## Purpose
6
+
7
+ Generate a substantive first-iteration `tasks.md` that maps the change into coarse, concrete work items. This is **v1 of the task plan** — Build Phase A will use writing-plans to produce v2 (with exact file paths, code snippets, and bite-sized test-first steps). Your job here is to outline the real work so refine can challenge it and Build Phase A can refine it into executable form.
8
+
9
+ ## Inputs You Must Read
10
+
11
+ - `specflow/changes/<change-name>/proposal.md` — establishes scope and capabilities
12
+ - `specflow/changes/<change-name>/specs/<capability>/spec.md` — delta specs define behavior
13
+ - `specflow/changes/<change-name>/design.md` — design decisions that drive the tasks
14
+ - `templates/tasks.md` (if it exists in the SpecFlow install) — the tasks template scaffold
15
+
16
+ ## Top-of-File Marker (Required)
17
+
18
+ The generated `tasks.md` file **must begin** with this HTML comment as its first line (this is content you inject into the output file, not part of this prompt):
19
+
20
+ ```
21
+ <!-- Plan-phase first-iteration tasks. Will be rewritten to writing-plans precision in /specflow:build Phase A. -->
22
+ ```
23
+
24
+ This marker tells future readers (and the Build Phase A prompt) that this document is coarse-grained by design and will be rewritten to a stricter format later.
25
+
26
+ ## Structure Rules
27
+
28
+ 1. **3 to 8 task groups** at the top level
29
+ - Each group uses `## N. <Group Name>` as its header (where N is a positive integer starting at 1)
30
+ - Group names are capability- or layer-oriented, not generic ("Core artifact management" — not "Phase 1")
31
+
32
+ 2. **Each group contains 2 to 6 concrete checkbox items**
33
+ - Format: `- [ ] N.M <动作短语>` where N is the group number and M is the item index within the group
34
+ - Mixed Chinese and English is acceptable (project convention); pick the language the action verb flows in
35
+
36
+ 3. **Items are concrete actions, not topics**
37
+ - "实现 searchNotes 纯函数" (good — specific function)
38
+ - "添加 CLI --verbose 标志并接入 logger" (good — specific change)
39
+ - "处理搜索逻辑" (bad — vague topic, not an action)
40
+ - "handle searching" (bad — same problem in English)
41
+ - "完善测试" (bad — improvement verb without a subject)
42
+
43
+ 4. **Each item should be a coherent unit of work** — roughly the size that Build Phase A will later expand into a handful of bite-sized TDD steps. If an item feels like it's really 5 unrelated actions, split it.
44
+
45
+ ## Grouping Guidance
46
+
47
+ Let the change characteristics drive the grouping. Two common strategies — pick whichever fits better, or mix them deliberately:
48
+
49
+ - **By capability**: each spec capability becomes a group. Good when the change introduces parallel capabilities with clean seams between them.
50
+ - Example: `## 1. notes-search capability`, `## 2. notes-export capability`
51
+ - **By implementation layer**: data → service → API → CLI → docs. Good when the change touches many layers of one feature.
52
+ - Example: `## 1. Schema and migrations`, `## 2. Repository layer`, `## 3. Service layer`, `## 4. CLI wiring`, `## 5. Tests and verification`
53
+
54
+ If the change has both parallel capabilities and deep layering, a two-level grouping is fine (groups by capability, items implicitly ordered layer-by-layer inside each group).
55
+
56
+ ## Example — Good Granularity
57
+
58
+ Below is a short worked example for a hypothetical "add search to notes CLI" change. Study the **granularity and verb concreteness**, not the specific content.
59
+
60
+ ```markdown
61
+ <!-- Plan-phase first-iteration tasks. Will be rewritten to writing-plans precision in /specflow:build Phase A. -->
62
+
63
+ # notes-search Implementation Tasks
64
+
65
+ ## 1. 搜索核心逻辑
66
+
67
+ - [ ] 1.1 实现 searchNotes 纯函数(输入: notes[], query; 输出: 匹配列表)
68
+ - [ ] 1.2 实现 fuzzy-match 评分算法并暴露 scoreNote(note, query)
69
+ - [ ] 1.3 为 searchNotes 和 scoreNote 写单元测试(覆盖空 query、空 notes、多匹配排序)
70
+
71
+ ## 2. 持久化层接入
72
+
73
+ - [ ] 2.1 在 NoteRepository 上增加 listAllForSearch 方法(不分页)
74
+ - [ ] 2.2 更新 InMemoryNoteRepository 的测试夹具提供搜索样本数据
75
+
76
+ ## 3. CLI 命令
77
+
78
+ - [ ] 3.1 新增 `notes search <query>` 子命令并接入 commander 路由
79
+ - [ ] 3.2 实现 search 命令的输出格式(按分数降序,截断正文到 80 字符)
80
+ - [ ] 3.3 为 CLI 命令写集成测试(调用子命令,断言输出)
81
+
82
+ ## 4. 文档与样例
83
+
84
+ - [ ] 4.1 在 README 的 Usage 段落增加 search 示例
85
+ - [ ] 4.2 在 specflow/specs/notes-search/spec.md 对齐最终命令形态
86
+ ```
87
+
88
+ Note how each item names a specific artifact or action (`searchNotes` function, `NoteRepository.listAllForSearch` method, `notes search <query>` command) rather than a fuzzy area ("handle searching", "improve CLI"). That level of concreteness is the target.
89
+
90
+ ## What This Draft Is NOT
91
+
92
+ - It is **not** the writing-plans format. Build Phase A does that rewrite with exact file paths, code blocks, and `Write test → Run test → Implement → Run test → Commit` per step. Do not pre-write those here — you don't yet have the design detail to do it well, and duplicating effort wastes the refine pass.
93
+ - It is **not** a skeleton to be filled in. Every item should reflect a real action you'd expect to perform.
94
+ - It is **not** a design document. If you find yourself writing "decide whether to use X or Y" as a task, that's a design decision that belongs in `design.md`. Move it there.
95
+
96
+ ## Coverage Check
97
+
98
+ After drafting, skim your task list against the design and specs:
99
+
100
+ - Is every capability in the delta specs represented by at least one task?
101
+ - Does every design decision that requires implementation work have tasks backing it?
102
+ - Are tests called out as explicit items (they should be — even at this granularity)?
103
+ - Is documentation covered if the design introduces user-facing changes?
104
+
105
+ If a capability or design decision has **no tasks**, either add them or note in `design.md` that this part is out-of-scope / handled by the existing code. Silent gaps are the failure mode to avoid.
106
+
107
+ ## Save and Proceed
108
+
109
+ Save the document to:
110
+
111
+ ```
112
+ specflow/changes/<change-name>/tasks.md
113
+ ```
114
+
115
+ **Do NOT ask the user to confirm this draft at this stage.** The orchestrating SKILL will present all plan-phase artifacts together at the end of the plan phase. Refine will challenge and restructure; Build Phase A will rewrite to precision. Your job is to hand off a substantive first pass.
116
+
117
+ ## Remember
118
+
119
+ - Substantive, not placeholder
120
+ - 3 to 8 groups, 2 to 6 items each
121
+ - Concrete verbs on concrete subjects
122
+ - Top-of-file marker comment is mandatory
123
+ - Writing-plans precision comes in Build Phase A — do not pre-write it here
@@ -0,0 +1,2 @@
1
+ Read context files, work through pending tasks, mark complete as you go.
2
+ Pause if you hit blockers or need clarification.
@@ -0,0 +1,20 @@
1
+ Create the design document that explains HOW to implement the change.
2
+
3
+ When to include design.md (create only if any apply):
4
+ - Cross-cutting change (multiple services/modules) or new architectural pattern
5
+ - New external dependency or significant data model changes
6
+ - Security, performance, or migration complexity
7
+ - Ambiguity that benefits from technical decisions before coding
8
+
9
+ Sections:
10
+ - **Context**: Background, current state, constraints, stakeholders
11
+ - **Goals / Non-Goals**: What this design achieves and explicitly excludes
12
+ - **Decisions**: Key technical choices with rationale (why X over Y?). Include alternatives considered for each decision.
13
+ - **Risks / Trade-offs**: Known limitations, things that could go wrong. Format: [Risk] → Mitigation
14
+ - **Migration Plan**: Steps to deploy, rollback strategy (if applicable)
15
+ - **Open Questions**: Outstanding decisions or unknowns to resolve
16
+
17
+ Focus on architecture and approach, not line-by-line implementation.
18
+ Reference the proposal for motivation and specs for requirements.
19
+
20
+ Good design docs explain the "why" behind technical decisions.
@@ -0,0 +1,18 @@
1
+ Create the proposal document that establishes WHY this change is needed.
2
+
3
+ Sections:
4
+ - **Why**: 1-2 sentences on the problem or opportunity. What problem does this solve? Why now?
5
+ - **What Changes**: Bullet list of changes. Be specific about new capabilities, modifications, or removals. Mark breaking changes with **BREAKING**.
6
+ - **Capabilities**: Identify which specs will be created or modified:
7
+ - **New Capabilities**: List capabilities being introduced. Each becomes a new `specs/<name>/spec.md`. Use kebab-case names (e.g., `user-auth`, `data-export`).
8
+ - **Modified Capabilities**: List existing capabilities whose REQUIREMENTS are changing. Only include if spec-level behavior changes (not just implementation details). Each needs a delta spec file. Check `specflow/specs/` for existing spec names. Leave empty if no requirement changes.
9
+ - **Impact**: Affected code, APIs, dependencies, or systems.
10
+
11
+ IMPORTANT: The Capabilities section is critical. It creates the contract between
12
+ proposal and specs phases. Research existing specs before filling this in.
13
+ Each capability listed here will need a corresponding spec file.
14
+
15
+ Keep it concise (1-2 pages). Focus on the "why" not the "how" -
16
+ implementation details belong in design.md.
17
+
18
+ This is the foundation - specs, design, and tasks all build on this.
@@ -0,0 +1,47 @@
1
+ Create specification files that define WHAT the system should do.
2
+
3
+ Create one spec file per capability listed in the proposal's Capabilities section.
4
+ - New capabilities: use the exact kebab-case name from the proposal (specs/<capability>/spec.md).
5
+ - Modified capabilities: use the existing spec folder name from specflow/specs/<capability>/ when creating the delta spec at specs/<capability>/spec.md.
6
+
7
+ Delta operations (use ## headers):
8
+ - **ADDED Requirements**: New capabilities
9
+ - **MODIFIED Requirements**: Changed behavior - MUST include full updated content
10
+ - **REMOVED Requirements**: Deprecated features - MUST include **Reason** and **Migration**
11
+ - **RENAMED Requirements**: Name changes only - use FROM:/TO: format
12
+
13
+ Format requirements:
14
+ - Each requirement: `### Requirement: <name>` followed by description
15
+ - Use SHALL/MUST for normative requirements (avoid should/may)
16
+ - Each scenario: `#### Scenario: <name>` with WHEN/THEN format
17
+ - **CRITICAL**: Scenarios MUST use exactly 4 hashtags (`####`). Using 3 hashtags or bullets will fail silently.
18
+ - Every requirement MUST have at least one scenario.
19
+
20
+ MODIFIED requirements workflow:
21
+ 1. Locate the existing requirement in specflow/specs/<capability>/spec.md
22
+ 2. Copy the ENTIRE requirement block (from `### Requirement:` through all scenarios)
23
+ 3. Paste under `## MODIFIED Requirements` and edit to reflect new behavior
24
+ 4. Ensure header text matches exactly (whitespace-insensitive)
25
+
26
+ Common pitfall: Using MODIFIED with partial content loses detail at archive time.
27
+ If adding new concerns without changing existing behavior, use ADDED instead.
28
+
29
+ Example:
30
+ ```
31
+ ## ADDED Requirements
32
+
33
+ ### Requirement: User can export data
34
+ The system SHALL allow users to export their data in CSV format.
35
+
36
+ #### Scenario: Successful export
37
+ - **WHEN** user clicks "Export" button
38
+ - **THEN** system downloads a CSV file with all user data
39
+
40
+ ## REMOVED Requirements
41
+
42
+ ### Requirement: Legacy export
43
+ **Reason**: Replaced by new export system
44
+ **Migration**: Use new export endpoint at /api/v2/export
45
+ ```
46
+
47
+ Specs should be testable - each scenario is a potential test case.
@@ -0,0 +1,26 @@
1
+ Create the task list that breaks down the implementation work.
2
+
3
+ **IMPORTANT: Follow the template below exactly.** The apply phase parses
4
+ checkbox format to track progress. Tasks not using `- [ ]` won't be tracked.
5
+
6
+ Guidelines:
7
+ - Group related tasks under ## numbered headings
8
+ - Each task MUST be a checkbox: `- [ ] X.Y Task description`
9
+ - Tasks should be small enough to complete in one session
10
+ - Order tasks by dependency (what must be done first?)
11
+
12
+ Example:
13
+ ```
14
+ ## 1. Setup
15
+
16
+ - [ ] 1.1 Create new module structure
17
+ - [ ] 1.2 Add dependencies to package.json
18
+
19
+ ## 2. Core Implementation
20
+
21
+ - [ ] 2.1 Implement data export function
22
+ - [ ] 2.2 Add CSV formatting utilities
23
+ ```
24
+
25
+ Reference specs for what needs to be built, design for how to build it.
26
+ Each task should be verifiable - you know when it's done.