@chenmk/superflow 0.1.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 (198) hide show
  1. package/INSTALL.en.md +106 -0
  2. package/INSTALL.md +664 -0
  3. package/LICENSE +21 -0
  4. package/README.md +142 -0
  5. package/README.zh-CN.md +117 -0
  6. package/assets/context-templates/business-rules.md +98 -0
  7. package/assets/context-templates/decisions.md +153 -0
  8. package/assets/context-templates/external-systems.md +166 -0
  9. package/assets/context-templates/incidents.md +89 -0
  10. package/assets/manifest.json +53 -0
  11. package/assets/prompts/superflow-archive.md +9 -0
  12. package/assets/prompts/superflow-clarify.md +10 -0
  13. package/assets/prompts/superflow-design.md +10 -0
  14. package/assets/prompts/superflow-docs.md +10 -0
  15. package/assets/prompts/superflow-implement.md +10 -0
  16. package/assets/prompts/superflow-pipeline.md +13 -0
  17. package/assets/prompts/superflow-verify.md +10 -0
  18. package/assets/rules/superflow-phase-guard.md +50 -0
  19. package/assets/scripts/claude-auto-backup-hook.sh +313 -0
  20. package/assets/scripts/codex-auto-backup-hook.sh +361 -0
  21. package/assets/scripts/install-sql-pre-commit.sh +44 -0
  22. package/assets/scripts/superflow-contract-hooks.sh +744 -0
  23. package/assets/scripts/superflow-delivery-check.sh +315 -0
  24. package/assets/scripts/superflow-dependency-update-hook.sh +161 -0
  25. package/assets/scripts/superflow-enforce-hook.sh +70 -0
  26. package/assets/scripts/superflow-hook-guard.sh +132 -0
  27. package/assets/scripts/superflow-integration-evidence-hook.sh +80 -0
  28. package/assets/scripts/superflow-sql-sync-hook.py +950 -0
  29. package/assets/scripts/superflow-test-report-lint.py +433 -0
  30. package/assets/scripts/superflow-verify-integration.sh +90 -0
  31. package/assets/scripts/sync-settings-json.py +52 -0
  32. package/assets/skills/api-doc-changelog/SKILL.md +193 -0
  33. package/assets/skills/openspec-apply-change/SKILL.md +156 -0
  34. package/assets/skills/openspec-archive-change/SKILL.md +114 -0
  35. package/assets/skills/openspec-explore/SKILL.md +288 -0
  36. package/assets/skills/openspec-propose/SKILL.md +110 -0
  37. package/assets/skills/superflow-archive/SKILL.md +61 -0
  38. package/assets/skills/superflow-clarify/SKILL.md +146 -0
  39. package/assets/skills/superflow-clarify/agents/openai.yaml +4 -0
  40. package/assets/skills/superflow-design/SKILL.md +83 -0
  41. package/assets/skills/superflow-design/agents/openai.yaml +4 -0
  42. package/assets/skills/superflow-docs/SKILL.md +316 -0
  43. package/assets/skills/superflow-docs/agents/openai.yaml +4 -0
  44. package/assets/skills/superflow-hotfix/SKILL.md +48 -0
  45. package/assets/skills/superflow-implement/SKILL.md +461 -0
  46. package/assets/skills/superflow-implement/agents/openai.yaml +4 -0
  47. package/assets/skills/superflow-pipeline/SKILL.md +844 -0
  48. package/assets/skills/superflow-pipeline/agents/openai.yaml +4 -0
  49. package/assets/skills/superflow-pipeline/references/api-design-template.md +431 -0
  50. package/assets/skills/superflow-pipeline/references/architecture-design-template.md +119 -0
  51. package/assets/skills/superflow-pipeline/references/batch-prompt-template.md +536 -0
  52. package/assets/skills/superflow-pipeline/references/batch-split-guide.md +140 -0
  53. package/assets/skills/superflow-pipeline/references/decision-point.md +30 -0
  54. package/assets/skills/superflow-pipeline/references/dirty-worktree.md +35 -0
  55. package/assets/skills/superflow-pipeline/references/document-templates.md +123 -0
  56. package/assets/skills/superflow-pipeline/references/feature-gated-workflow.md +124 -0
  57. package/assets/skills/superflow-pipeline/references/implementation-prompt-template.md +1056 -0
  58. package/assets/skills/superflow-pipeline/references/mock-strategy-guide.md +86 -0
  59. package/assets/skills/superflow-pipeline/references/openspec-format.md +57 -0
  60. package/assets/skills/superflow-pipeline/references/orchestration.md +639 -0
  61. package/assets/skills/superflow-pipeline/references/p0-baseline-template.md +174 -0
  62. package/assets/skills/superflow-pipeline/references/project-config.md +40 -0
  63. package/assets/skills/superflow-pipeline/references/prompt-usage-template.md +152 -0
  64. package/assets/skills/superflow-pipeline/references/quality-gate.md +299 -0
  65. package/assets/skills/superflow-pipeline/references/quality-standards.md +190 -0
  66. package/assets/skills/superflow-pipeline/references/reviewer-checklist.md +154 -0
  67. package/assets/skills/superflow-pipeline/references/sql-risk-review-checklist.md +323 -0
  68. package/assets/skills/superflow-pipeline/references/subagent-progress.md +90 -0
  69. package/assets/skills/superflow-pipeline/references/superpower-technical-design-template.md +125 -0
  70. package/assets/skills/superflow-pipeline/references/test-execution-template.md +220 -0
  71. package/assets/skills/superflow-pipeline/references/test-guide.md +30 -0
  72. package/assets/skills/superflow-pipeline/references/traceability-matrix.md +106 -0
  73. package/assets/skills/superflow-pipeline/references/validation-integrity.md +134 -0
  74. package/assets/skills/superflow-pipeline/scripts/superflow-archive.sh +178 -0
  75. package/assets/skills/superflow-pipeline/scripts/superflow-env.sh +118 -0
  76. package/assets/skills/superflow-pipeline/scripts/superflow-guard.sh +428 -0
  77. package/assets/skills/superflow-pipeline/scripts/superflow-handoff.sh +296 -0
  78. package/assets/skills/superflow-pipeline/scripts/superflow-state.sh +574 -0
  79. package/assets/skills/superflow-pipeline/scripts/superflow-status.sh +172 -0
  80. package/assets/skills/superflow-pipeline/scripts/superflow-yaml-validate.sh +138 -0
  81. package/assets/skills/superflow-table-impact-analysis/SKILL.md +77 -0
  82. package/assets/skills/superflow-tweak/SKILL.md +46 -0
  83. package/assets/skills/superflow-verify/SKILL.md +112 -0
  84. package/assets/skills-en/api-doc-changelog/SKILL.md +193 -0
  85. package/assets/skills-en/openspec-apply-change/SKILL.md +156 -0
  86. package/assets/skills-en/openspec-archive-change/SKILL.md +114 -0
  87. package/assets/skills-en/openspec-explore/SKILL.md +288 -0
  88. package/assets/skills-en/openspec-propose/SKILL.md +110 -0
  89. package/assets/skills-en/superflow-archive/SKILL.md +61 -0
  90. package/assets/skills-en/superflow-clarify/SKILL.md +146 -0
  91. package/assets/skills-en/superflow-clarify/agents/openai.yaml +4 -0
  92. package/assets/skills-en/superflow-design/SKILL.md +83 -0
  93. package/assets/skills-en/superflow-design/agents/openai.yaml +4 -0
  94. package/assets/skills-en/superflow-docs/SKILL.md +316 -0
  95. package/assets/skills-en/superflow-docs/agents/openai.yaml +4 -0
  96. package/assets/skills-en/superflow-hotfix/SKILL.md +48 -0
  97. package/assets/skills-en/superflow-implement/SKILL.md +461 -0
  98. package/assets/skills-en/superflow-implement/agents/openai.yaml +4 -0
  99. package/assets/skills-en/superflow-pipeline/SKILL.md +844 -0
  100. package/assets/skills-en/superflow-pipeline/agents/openai.yaml +4 -0
  101. package/assets/skills-en/superflow-pipeline/references/api-design-template.md +431 -0
  102. package/assets/skills-en/superflow-pipeline/references/architecture-design-template.md +119 -0
  103. package/assets/skills-en/superflow-pipeline/references/batch-prompt-template.md +536 -0
  104. package/assets/skills-en/superflow-pipeline/references/batch-split-guide.md +140 -0
  105. package/assets/skills-en/superflow-pipeline/references/decision-point.md +30 -0
  106. package/assets/skills-en/superflow-pipeline/references/dirty-worktree.md +35 -0
  107. package/assets/skills-en/superflow-pipeline/references/document-templates.md +123 -0
  108. package/assets/skills-en/superflow-pipeline/references/feature-gated-workflow.md +124 -0
  109. package/assets/skills-en/superflow-pipeline/references/implementation-prompt-template.md +1056 -0
  110. package/assets/skills-en/superflow-pipeline/references/mock-strategy-guide.md +86 -0
  111. package/assets/skills-en/superflow-pipeline/references/openspec-format.md +57 -0
  112. package/assets/skills-en/superflow-pipeline/references/orchestration.md +639 -0
  113. package/assets/skills-en/superflow-pipeline/references/p0-baseline-template.md +174 -0
  114. package/assets/skills-en/superflow-pipeline/references/project-config.md +40 -0
  115. package/assets/skills-en/superflow-pipeline/references/prompt-usage-template.md +152 -0
  116. package/assets/skills-en/superflow-pipeline/references/quality-gate.md +299 -0
  117. package/assets/skills-en/superflow-pipeline/references/quality-standards.md +190 -0
  118. package/assets/skills-en/superflow-pipeline/references/reviewer-checklist.md +154 -0
  119. package/assets/skills-en/superflow-pipeline/references/sql-risk-review-checklist.md +323 -0
  120. package/assets/skills-en/superflow-pipeline/references/subagent-progress.md +90 -0
  121. package/assets/skills-en/superflow-pipeline/references/superpower-technical-design-template.md +125 -0
  122. package/assets/skills-en/superflow-pipeline/references/test-execution-template.md +220 -0
  123. package/assets/skills-en/superflow-pipeline/references/test-guide.md +30 -0
  124. package/assets/skills-en/superflow-pipeline/references/traceability-matrix.md +106 -0
  125. package/assets/skills-en/superflow-pipeline/references/validation-integrity.md +134 -0
  126. package/assets/skills-en/superflow-pipeline/scripts/superflow-archive.sh +178 -0
  127. package/assets/skills-en/superflow-pipeline/scripts/superflow-env.sh +118 -0
  128. package/assets/skills-en/superflow-pipeline/scripts/superflow-guard.sh +428 -0
  129. package/assets/skills-en/superflow-pipeline/scripts/superflow-handoff.sh +296 -0
  130. package/assets/skills-en/superflow-pipeline/scripts/superflow-state.sh +574 -0
  131. package/assets/skills-en/superflow-pipeline/scripts/superflow-status.sh +172 -0
  132. package/assets/skills-en/superflow-pipeline/scripts/superflow-yaml-validate.sh +138 -0
  133. package/assets/skills-en/superflow-table-impact-analysis/SKILL.md +77 -0
  134. package/assets/skills-en/superflow-tweak/SKILL.md +46 -0
  135. package/assets/skills-en/superflow-verify/SKILL.md +112 -0
  136. package/dist/cli/index.js +186 -0
  137. package/dist/cli/index.js.map +1 -0
  138. package/dist/commands/archive.js +6 -0
  139. package/dist/commands/archive.js.map +1 -0
  140. package/dist/commands/clarify.js +6 -0
  141. package/dist/commands/clarify.js.map +1 -0
  142. package/dist/commands/design.js +6 -0
  143. package/dist/commands/design.js.map +1 -0
  144. package/dist/commands/docs.js +6 -0
  145. package/dist/commands/docs.js.map +1 -0
  146. package/dist/commands/doctor.js +473 -0
  147. package/dist/commands/doctor.js.map +1 -0
  148. package/dist/commands/implement.js +6 -0
  149. package/dist/commands/implement.js.map +1 -0
  150. package/dist/commands/init.js +471 -0
  151. package/dist/commands/init.js.map +1 -0
  152. package/dist/commands/pipeline.js +6 -0
  153. package/dist/commands/pipeline.js.map +1 -0
  154. package/dist/commands/scan.js +59 -0
  155. package/dist/commands/scan.js.map +1 -0
  156. package/dist/commands/status.js +173 -0
  157. package/dist/commands/status.js.map +1 -0
  158. package/dist/commands/uninstall.js +213 -0
  159. package/dist/commands/uninstall.js.map +1 -0
  160. package/dist/commands/update.js +187 -0
  161. package/dist/commands/update.js.map +1 -0
  162. package/dist/commands/verify.js +6 -0
  163. package/dist/commands/verify.js.map +1 -0
  164. package/dist/core/assets.js +27 -0
  165. package/dist/core/assets.js.map +1 -0
  166. package/dist/core/context.js +100 -0
  167. package/dist/core/context.js.map +1 -0
  168. package/dist/core/dependencies.js +146 -0
  169. package/dist/core/dependencies.js.map +1 -0
  170. package/dist/core/detect.js +71 -0
  171. package/dist/core/detect.js.map +1 -0
  172. package/dist/core/i18n.js +103 -0
  173. package/dist/core/i18n.js.map +1 -0
  174. package/dist/core/integrity.js +46 -0
  175. package/dist/core/integrity.js.map +1 -0
  176. package/dist/core/manifest.js +18 -0
  177. package/dist/core/manifest.js.map +1 -0
  178. package/dist/core/prompts.js +20 -0
  179. package/dist/core/prompts.js.map +1 -0
  180. package/dist/core/registry.js +134 -0
  181. package/dist/core/registry.js.map +1 -0
  182. package/dist/core/rules.js +17 -0
  183. package/dist/core/rules.js.map +1 -0
  184. package/dist/core/scripts.js +40 -0
  185. package/dist/core/scripts.js.map +1 -0
  186. package/dist/core/skill-check.js +31 -0
  187. package/dist/core/skill-check.js.map +1 -0
  188. package/dist/core/skills.js +56 -0
  189. package/dist/core/skills.js.map +1 -0
  190. package/dist/core/state.js +43 -0
  191. package/dist/core/state.js.map +1 -0
  192. package/dist/types.js +2 -0
  193. package/dist/types.js.map +1 -0
  194. package/dist/utils/path.js +11 -0
  195. package/dist/utils/path.js.map +1 -0
  196. package/dist/utils/shell.js +29 -0
  197. package/dist/utils/shell.js.map +1 -0
  198. package/package.json +60 -0
@@ -0,0 +1,461 @@
1
+ ---
2
+ name: superflow-implement
3
+ description: Use when implementation prompts, batched task prompts, follow-up prompts, reviewer checklists, validation plans, or test-report updates must be generated from existing OpenSpec/SDD documents.
4
+ ---
5
+
6
+ # SDD Implement
7
+
8
+ Use `$openspec-apply-change` as the primary path for implementing tasks from an
9
+ OpenSpec change. Use this skill only after SDD docs exist and the user needs
10
+ extra SDD-specific prompt splitting, P0/P1/P2 handoff, CR/Px follow-up prompts,
11
+ review checklists, validation plans, or test-report updates.
12
+
13
+ ## Preconditions
14
+
15
+ - `proposal.md`, `api.md`, `design.md`, `tasks.md`, `tests.md`,
16
+ `traceability-matrix.md`, `sdd-quality-gate.md`, `test-report.md`, and
17
+ `review-checklist.md` exist. Prompt files may be absent at entry because this
18
+ skill owns prompt generation; they are mandatory before this phase can exit.
19
+ For full workflow, `docs/superpowers/specs/*-technical-design.md` exists and
20
+ `.sdd/state.yaml` records it as `technical_design`.
21
+ For bug fixes, root-cause reports, incident fixes, CR/Px fixes, and
22
+ report-driven corrections, `bug-fix-plan.md` also exists.
23
+ - If the task is embedded under a larger change, root `tasks.md`, `tests.md`,
24
+ `traceability-matrix.md`, `sdd-quality-gate.md`, and `test-report.md`
25
+ reference the task before prompt generation. Root `prompt/implementation.md`
26
+ and root `prompt/<task-name>.md` must be created and cross-linked before
27
+ implementation phase exit.
28
+ - `tests.md` contains executable test cases with case IDs, automation commands,
29
+ RED expected failures, GREEN expected passes, DB assertions, log assertions,
30
+ and matching `test-report.md` evidence locations. If tests are vague,
31
+ missing automation commands, or lack RED/GREEN expectations, stop and return
32
+ to `$superflow-docs`.
33
+ - `.sdd/handoff/sdd-context.md`, `.sdd/handoff/sdd-context.json`,
34
+ `.sdd/handoff/sdd-context.sha256`, and `.sdd/state.yaml` exist for the
35
+ change/task. If missing, run
36
+ `../superflow-pipeline/scripts/superflow-handoff.sh <change-dir> --refresh` and
37
+ `../superflow-pipeline/scripts/superflow-state.sh init <change-dir> docs`, then
38
+ rerun `../superflow-pipeline/scripts/superflow-guard.sh <change-dir> docs`.
39
+ If the guard fails, stop and return to `$superflow-docs`.
40
+ - `.sdd/state.yaml` must be in `phase: implement` before implementation prompt
41
+ execution. If it is still `docs`, run
42
+ `../superflow-pipeline/scripts/superflow-yaml-validate.sh <change-dir>` and
43
+ `../superflow-pipeline/scripts/superflow-guard.sh <change-dir> docs --apply`
44
+ after the docs gate passes. If `superflow-state.sh recover <change-dir>` reports a
45
+ stale handoff, stale prompt, or missing field, return to `$superflow-docs`.
46
+ If it is still `design`, run
47
+ `../superflow-pipeline/scripts/superflow-guard.sh <change-dir> design --apply`
48
+ after the Superpowers technical design gate passes.
49
+ - Before splitting into worktrees or subagents, apply
50
+ `../superflow-pipeline/references/dirty-worktree.md`. If SDD docs changed,
51
+ regenerate handoff and require every agent to reread the new hash.
52
+ - Existing SDD docs record platform-level impact discovery evidence. Prefer
53
+ understand-anything artifacts when present, but treat them only as locator
54
+ evidence. If missing, stale, incomplete, or unavailable, docs/prompts must
55
+ show the downgrade path: `rg`, source reading, Mapper/XML, configuration,
56
+ database table names, log templates, and sibling-repo search. Missing
57
+ understand-anything alone is not a blocker; missing platform impact discovery
58
+ evidence is a blocker.
59
+ - Existing SDD docs record discovery method, understand-anything index status
60
+ when available, analyzed platform scope, impacted modules/interfaces/tables,
61
+ regression risks, source/DB/API confirmation evidence, and validation approach.
62
+ - For complex requirements, `feature-gates.md` marks the target feature as `已冻结`.
63
+ - The target scope is explicit: one feature, one batch, or one CR/Px follow-up.
64
+
65
+ If docs are missing, only root-level links exist without task-local docs, or the
66
+ feature is not frozen, stop and return to `$superflow-docs` or `$superflow-clarify`.
67
+
68
+ ## Prompt Completeness Is Mandatory
69
+
70
+ Before implementation phase can exit:
71
+
72
+ - `prompt/implementation.md` exists as the root prompt index.
73
+ - At least one task prompt exists under `prompt/<task-name>.md`; root
74
+ `prompt/implementation.md` alone is not enough when `tasks.md` contains task
75
+ checkboxes.
76
+ - `tasks.md`, `traceability-matrix.md`, `sdd-quality-gate.md`, and
77
+ `test-report.md` link the generated prompt files.
78
+ - Embedded tasks have both task-local `prompt/<task-name>.md` and root
79
+ `prompt/<task-name>.md`, and both point back to the task-local docs.
80
+ - Missing prompts are `Blocked for prompt generation`; do not proceed to
81
+ coding or verification.
82
+
83
+ ## Prompt Splitting Rules
84
+
85
+ - Split by independently verifiable feature closure, not by a giant backend module.
86
+ - Use P0 for baseline only: worktree, branch, compile, SQL/entity/mapper/DTO consistency.
87
+ - Keep business prompts small and explicit.
88
+ - Every implementation prompt must begin with the mandatory superpower/team
89
+ prefix from `../superflow-pipeline/references/implementation-prompt-template.md`:
90
+ `使用superpower技能,开启合适的团队,最少包含一名开发和一名测试交叉验证进行需求开发,测试验证闭环交付,更新测试文档和api.md:`
91
+ It must also state that missing superpower blocks normal development, and must
92
+ name at least Worker, independent Tester, Reviewer, and Leader responsibilities.
93
+ Do not generate "single-agent only" prompts for implementation work.
94
+ - Every implementation prompt must include a "Superpower 技术详设继承" section.
95
+ It must link and summarize `.sdd/state.yaml` `technical_design`
96
+ (`docs/superpowers/specs/*-technical-design.md`) as the source-level HOW
97
+ authority:
98
+ `执行模式 | 团队角色 | 拆分建议 | TDD/RED切入点 | 独立Tester验证点 |
99
+ 高风险猜测点 | 禁止自由发挥项 | handoff_hash | 进入prompt的强制要求`.
100
+ The prompt must say that OpenSpec/SDD docs remain the WHAT/API/DB/tests
101
+ source of truth. Superpowers may own technical design, development,
102
+ testing, review, worktrees, and verification choreography, but must not change
103
+ requirements, API, DB, SQL, field semantics, tests, or acceptance gates. If
104
+ the technical design is missing, stale, or contradicts `design.md`/`api.md`/
105
+ `tests.md`, stop and return to `$superflow-docs`.
106
+ - When a task changes field values, status/enum values, online/offline state,
107
+ deletion/restoration state, sync markers, payment/refund status, third-party
108
+ status, or any value read by other code, every implementation prompt must
109
+ include "字段/状态反向影响面核实". It must inherit the technical design
110
+ `Field And Status Reverse Impact` matrix and require reverse search across
111
+ source, Mapper XML, entities, DTO/VO, SQL, scheduled jobs, MQ/event consumers,
112
+ callbacks, third-party adapters, shared SDK/tables, and sibling repos when
113
+ applicable. A prompt that only changes the direct setter/writer is blocked.
114
+ - Every implementation prompt must include a "上下文防漂移与状态继承" section.
115
+ It must link `.sdd/handoff/sdd-context.md` as a clickable Markdown link,
116
+ record the exact `handoff_hash`, and require Worker/Tester/Reviewer to read
117
+ the handoff plus original `api.md`/`design.md`/`tests.md` and
118
+ `technical_design` before coding.
119
+ After any SDD doc change, the team must rerun `superflow-handoff.sh --refresh` and
120
+ compare the new hash. A stale or mismatched hash blocks coding and delivery.
121
+ The prompt must also require `.sdd/state.yaml` phase evidence and
122
+ `superflow-guard.sh <change-dir> implement` before moving to verification.
123
+ - Every implementation prompt must include a "状态机执行决策" section. It must
124
+ record `build_mode`, `isolation`, `tdd_mode`, `review_mode`,
125
+ `subagent_dispatch` when applicable, `implementation_prompt`, and the derived
126
+ `worktree_ports` in `.sdd/state.yaml` with `superflow-state.sh set`. Full
127
+ workflow may not use `build_mode: direct` unless `direct_override: true` is
128
+ explicitly recorded. Full workflow must choose
129
+ `review_mode: off|standard|thorough` before leaving implement; choosing `off`
130
+ requires a written reason.
131
+ Before verification, run `superflow-state.sh scale <change-dir>` and then
132
+ `superflow-guard.sh <change-dir> implement --apply`.
133
+ - If `build_mode: subagent-driven-development`, every prompt must require
134
+ `.sdd/subagent-progress.md` from
135
+ `../superflow-pipeline/references/subagent-progress.md`. Worker, Tester,
136
+ Reviewer, and Leader rows must include worktree, port, scope, status,
137
+ stage, implementation commit, RED/GREEN evidence, spec review, quality
138
+ review, review-fix round, evidence, and blocker. Context compression or
139
+ handoff hash changes force all rows back to reread mode before coding
140
+ continues.
141
+ - When a subagent task is checked off, the coordinator must run
142
+ `superflow-state.sh task-checkoff <plan_file> <plan_task_text>` and, when mapped,
143
+ `superflow-state.sh task-checkoff <openspec_task_file> <openspec_task_text>`.
144
+ Duplicate task text or unchecked task state blocks continuation.
145
+ - Every implementation prompt must include a "平台级影响面发现与事实核实" section.
146
+ It must instruct the development team to use understand-anything as a locator
147
+ when available, or downgrade to `rg`, source reading, Mapper/XML,
148
+ configuration, database table names, log templates, and sibling-repo search
149
+ when it is missing, stale, incomplete, or unavailable. The team must inspect
150
+ the whole platform impact:
151
+ current repo, sibling repos, shared SDKs/DTOs, shared database tables,
152
+ callbacks, scheduled jobs, external platform adapters, and configuration
153
+ consumers. The prompt must require evidence in `test-report.md`:
154
+ `发现方式 | understand 索引状态 | 分析范围 | 受影响模块/接口/表 | 潜在回归点 | 源码/DB/API事实核实 | 验证命令/真实链路`。
155
+ understand-anything output alone is not proof. Missing platform impact
156
+ discovery or missing source/DB/API confirmation blocks coding.
157
+ - Every implementation prompt that relies on an existing field, table relation,
158
+ data permission rule, status flow, Mapper/XML query, external parameter, or
159
+ upstream/downstream call must include an "既有代码与数据关系核实" section.
160
+ It must require the Worker/Reviewer to verify in this order:
161
+ platform impact discovery -> source/Mapper/XML anchors -> read-only database
162
+ checks when source is insufficient. The prompt must forbid blind design from
163
+ field names or graph output, and must require the agent to stop and ask the
164
+ user when the relationship is still unclear after those checks.
165
+ - Every implementation prompt must include a "字段语义合同" section when risky
166
+ fields are present. The Worker must copy the contract from `design.md` and
167
+ verify it against current source/Mapper/DB before coding:
168
+ `字段 | 来源表/DTO/事件 | 真实语义 | 目标字段 | 目标语义 | 是否可等价 |
169
+ 证据锚点 | 禁止用法 | 不确定项/owner`.
170
+ Any unverified field semantics block coding.
171
+ - Every implementation prompt that writes, updates, binds, persists, snapshots,
172
+ synchronizes, or advances status must include a "写入闭环核查" section:
173
+ `业务动作 | Java setter/赋值点 | Converter/DTO 映射 | Mapper insert/update |
174
+ DB column | 后续读取方 | 消费入口 | 验证 SQL | 测试用例`.
175
+ The prompt must forbid treating Java assignment as persistence proof.
176
+ Mapper/XML/DB/consumer evidence is required before delivery.
177
+ - Every implementation prompt must include a "真实入口调用链" section. It must
178
+ require the Worker to identify the real Controller/RPC/MQ/scheduler/device/
179
+ applet/third-party entry, upstream/downstream services, async callbacks,
180
+ critical field changes, DB state, and final consumer. Service-only or
181
+ test-controller-only evidence is not enough for completion.
182
+ - Every implementation prompt that touches database-backed behavior must include
183
+ a "数据表反向影响面核查" section. It must require the team to start from each
184
+ affected table/field and enumerate all writers, readers, filter conditions,
185
+ status/default-value recovery paths, scheduled jobs, MQ consumers, frontend or
186
+ applet endpoints, sibling repos, third-party adapters, and final user-facing
187
+ entry points. The prompt must require reverse-state tests such as offline ->
188
+ online, deleted -> restored, missing -> reappearing, and old invalid value ->
189
+ valid when upstream omits a field. Missing consumer mapping blocks coding.
190
+ Use `$superflow-table-impact-analysis` when available.
191
+ - Every implementation prompt that touches status fields, enum fields, sync
192
+ payloads, derived values, defaults, compatibility logic, or cross-system
193
+ interpretation must include a "业务语义优先与禁止默认兜底" section. It must
194
+ require the team to identify:
195
+ `真源字段 | 真源枚举 | 目标字段 | 目标枚举 | 消费方解释 | 业务依据 | 不确定项`.
196
+ The prompt must forbid default values, fallback values, null-to-available
197
+ conversions, old-value retention, and alternative-field substitution unless
198
+ the requirement or owner explicitly approves compatibility for dirty
199
+ historical data or uncontrollable external input. If compatibility is
200
+ approved, the prompt must require:
201
+ `兜底触发条件 | 业务依据 | 会掩盖的异常 | 监控/告警/暴露方式 | 移除条件 | owner确认`.
202
+ Missing semantic proof blocks coding.
203
+ - Every implementation prompt must include a "禁止 fallback 与猜测实现" section
204
+ even when no compatibility is planned. It must explicitly forbid defaulting,
205
+ fallback queries, substitute fields, keep-old-value behavior, null-to-valid
206
+ conversion, silent skip, and downstream compensation for upstream missing
207
+ snapshots unless the docs record owner-approved compatibility.
208
+ - Every implementation prompt must include a "测试先行与红绿验证" section before
209
+ any coding steps. It must require the Worker to:
210
+ 1. read `tests.md` and list the exact case IDs in scope;
211
+ 2. create or activate the automated tests first;
212
+ 3. run the targeted command before production-code edits and record the RED
213
+ failure output in `test-report.md`;
214
+ 4. only then write minimal production code;
215
+ 5. rerun the same command and record the GREEN pass output;
216
+ 6. keep the same case IDs linked through `tests.md`, prompt, and
217
+ `test-report.md`.
218
+ If a RED run cannot be executed because of missing environment, token, device,
219
+ third-party service, or test data, the prompt must require `Blocked` or
220
+ `Partially verified`; it must not permit coding first and backfilling tests.
221
+ - Every implementation prompt for API, CRUD, Mapper/XML, database-backed,
222
+ configuration-driven, MQ, scheduled-job, payment/refund, device, applet, or
223
+ third-party behavior must include an "接口自动化执行清单" section. It must
224
+ extract all relevant L3/L4 cases from `tests.md` and include complete command
225
+ templates: token/cookie setup, curl/Postman/Newman/pytest/RestAssured command,
226
+ request payload source, response assertions, DB SELECT, log keywords, and
227
+ evidence fields to paste into `test-report.md`.
228
+ These cases are hard-gated by
229
+ `superflow-test-report-lint.py --tests <tests.md> <test-report.md>`; a report
230
+ that only contains unit tests, mock evidence, BUILD SUCCESS, or generic
231
+ keywords must be marked `Blocked`/`Partially verified`, not Passed.
232
+ - Every prompt must forbid these shortcuts explicitly:
233
+ tests-after only, `BUILD SUCCESS` as proof, skipped tests as pass, mock-only
234
+ pass for real integration, HTTP 200 without business assertions, DB-only
235
+ proof without consumer path, and changing tests to match an implementation
236
+ without updating SDD docs and getting review.
237
+ - Every implementation prompt must include an "Agent 执行前自检" section before
238
+ edit permissions. The Worker must fill:
239
+ `真实入口已定位 | 字段语义合同已核对 | 写入闭环已核对 |
240
+ 禁止兜底边界已确认 | RED 测试已执行 | 允许修改文件 | 禁止修改文件 |
241
+ 阻塞项`.
242
+ Any unchecked or uncertain item blocks production-code edits.
243
+ - Every worktree prompt must include a "worktree 启动端口" section. The agent
244
+ must read the current application config first, find the base `server.port`
245
+ and context path, then derive this task's port as `base port + P/CR number`
246
+ (for example P50 with base 9250 uses 9300). The prompt must show the derived
247
+ port, explicit startup command with `--server.port=<derived-port>`, Base URL,
248
+ health check/curl URLs using that port, and a fallback rule to move to the
249
+ next free port only when the derived port is occupied. Do not let worktree
250
+ prompts reuse the main workspace port by default.
251
+ - Every implementation prompt must make referenced Markdown files clickable.
252
+ When listing SDD/OpenSpec docs, prompt files, SQL summaries, reports, or
253
+ related local docs, use Markdown links such as `[design.md](../design.md)` or
254
+ `[P64 prompt](p64-export-plot-display.md)` instead of plain text paths.
255
+ Links must be relative to the prompt file location and must point to the real
256
+ file. Keep code/source file paths as plain inline code when line precision is
257
+ more useful, but any referenced `.md` handoff document must be clickable.
258
+ - Each prompt must state allowed files, forbidden files, dependencies, exact API contract, DB fields, tests, and report format.
259
+ - Database-backed prompts must include this table in the prompt and require it
260
+ to be filled in `test-report.md`:
261
+ `表/字段 | 写入方 | 读取/过滤方 | 跨仓/外部消费方 | 真实入口 | 反向状态场景 | 验证证据`.
262
+ - If a prompt touches sibling repos, SDKs, public jars, protocol DTOs, enums,
263
+ validation annotations, serialization field types, or Maven/Gradle dependencies,
264
+ it must include a "引用项目版本升级" section. That section must name current
265
+ version, target version, dependency file to update, build/install/deploy command,
266
+ and dependency-resolution evidence required in `test-report.md`.
267
+ - Do not allow same-version SNAPSHOT overwrite as closure for public SDK changes;
268
+ require an explicit version bump such as `1.0.8-SNAPSHOT -> 1.0.9-SNAPSHOT`
269
+ unless the user or release owner explicitly provides a different version.
270
+ - If a batch has already been executed, do not edit its old prompt. Create a new CR/Px or next-number prompt.
271
+ - Do not mix unrelated changes into the current implementation prompt.
272
+ - For parallel worktree execution, worker prompts must update only their own
273
+ `embedded-changes/pXX-*` delivery files (`tasks.md`, `test-report.md`,
274
+ `sdd-quality-gate.md`, and related P-local docs). They must not edit
275
+ top-level aggregate OpenSpec files such as root `tasks.md`,
276
+ `test-report.md`, `traceability-matrix.md`, `sdd-quality-gate.md`, or
277
+ `tests.md`; those files are updated later by a Leader closeout prompt to
278
+ avoid merge conflicts.
279
+
280
+ Use references only as needed:
281
+
282
+ - `../superflow-pipeline/references/batch-split-guide.md`
283
+ - `../superflow-pipeline/references/batch-prompt-template.md`
284
+ - `../superflow-pipeline/references/superpower-technical-design-template.md`
285
+ - `../superflow-pipeline/references/p0-baseline-template.md`
286
+ - `../superflow-pipeline/references/implementation-prompt-template.md`
287
+ - `../superflow-pipeline/references/orchestration.md`
288
+ - `../superflow-pipeline/references/reviewer-checklist.md`
289
+ - `../superflow-pipeline/references/quality-gate.md`
290
+ - `../superflow-pipeline/references/validation-integrity.md`
291
+ - `../superflow-pipeline/references/decision-point.md`
292
+ - `../superflow-pipeline/references/dirty-worktree.md`
293
+ - `../superflow-pipeline/references/subagent-progress.md`
294
+ - `../superflow-pipeline/references/project-config.md`
295
+
296
+ ## Implementation Gate
297
+
298
+ Before saying a batch is complete:
299
+
300
+ - Verify task document completeness first. Required task-local files:
301
+ `.openspec.yaml`, `proposal.md`, bug-fix `bug-fix-plan.md` when applicable,
302
+ `api.md`, `spec.md` or `specs/<capability>/spec.md`, `design.md`,
303
+ `docs/superpowers/specs/*-technical-design.md` for full workflow, `tasks.md`,
304
+ `tests.md`, `traceability-matrix.md`, `review-checklist.md`,
305
+ `sdd-quality-gate.md`, `test-report.md`, and task-local
306
+ `prompt/<task-name>.md`. For embedded tasks, also verify root
307
+ `prompt/<task-name>.md`, root `prompt/implementation.md`, root `tasks.md`,
308
+ root `tests.md`, root `traceability-matrix.md`, root `sdd-quality-gate.md`,
309
+ and root `test-report.md` all reference the task. Missing files or links mean
310
+ `Blocked for docs`, not ready for coding.
311
+ - Verify prompt cross-links next: the task-local prompt and root prompt both
312
+ exist when applicable, `prompt/implementation.md` references the root prompt,
313
+ `tasks.md` references it, `traceability-matrix.md` references it, and
314
+ `tests.md` / `test-report.md` contain the matching validation entry.
315
+ - Verify Red-Green evidence before accepting code: `test-report.md` must show
316
+ the pre-code RED command/output for each bug fix or new behavior case, then
317
+ the same command/output passing after implementation. If tests were written
318
+ only after code or RED was not observed, mark `Blocked`.
319
+ - Verify interface automation evidence: for every in-scope L3/L4 API or real
320
+ business entry, `test-report.md` must include command, request payload source,
321
+ response assertion, DB SELECT evidence, log evidence, and actual environment
322
+ details. Missing token/device/third-party/test data means
323
+ `Blocked`/`Partially verified`, not Passed.
324
+ - Verify Markdown handoff links: every referenced `.md` file inside generated
325
+ prompt docs is formatted as a clickable relative Markdown link and the target
326
+ file exists from the prompt file's directory.
327
+ - Verify platform impact discovery evidence: the team analyzed whole-platform
328
+ impact using understand-anything when available or a documented downgrade path
329
+ when unavailable, and `test-report.md` records affected
330
+ modules/interfaces/tables plus source/DB/API confirmation and regression
331
+ validation. Missing platform impact discovery or missing fact confirmation
332
+ means `Blocked`, not complete.
333
+ - Verify existing-code/data relationship evidence when the implementation
334
+ depended on existing behavior: graph scope, source anchors, DB checks or
335
+ reason skipped, final judgment, and unresolved questions. If any key
336
+ relationship remains unclear, mark the batch `Blocked` and ask the user
337
+ instead of weakening or inventing the design.
338
+ - Verify the five hard gates before accepting a batch: field semantic contract,
339
+ write-through persistence closure, real-entry call chain, no-fallback/
340
+ no-guessing boundary, and agent pre-coding self-check. Missing evidence means
341
+ `Blocked`, even if code compiles and tests pass.
342
+ - Verify Superpower execution strategy inheritance before accepting a batch:
343
+ the prompt consumed `.sdd/state.yaml` `technical_design`, kept OpenSpec/SDD
344
+ as the WHAT/API/DB/tests authority, and did not let Superpowers overwrite
345
+ contracts. Missing, stale, or drifting technical design means `Blocked`.
346
+ - Verify field/status reverse impact before accepting a batch when any field,
347
+ status, enum, sync marker, online/offline, deletion/restoration, payment/
348
+ refund, or third-party state changed: the prompt and report list writers,
349
+ readers, filters, derived/sync paths, consumers, intentional non-changes, and
350
+ consumer tests. Missing reverse impact evidence means `Blocked`.
351
+ - Verify context drift guard before accepting a batch: the prompt and
352
+ `test-report.md` record the same hash as `.sdd/handoff/sdd-context.sha256`,
353
+ `.sdd/state.yaml` exists, and
354
+ `~/.codex/skills/superflow-pipeline/scripts/superflow-guard.sh <change-dir> implement`
355
+ or `verify` passes for the current phase. Stale hash, missing state, or guard
356
+ failure means `Blocked`.
357
+ - Verify workflow state before accepting a batch: `.sdd/state.yaml` records
358
+ `build_mode`, `isolation`, `tdd_mode`, `review_mode`, `verify_mode`,
359
+ `technical_design`, `implementation_prompt`, `verification_report`,
360
+ `context_compression`, and current `phase`.
361
+ `superflow-yaml-validate.sh <change-dir>` and
362
+ `superflow-state.sh recover <change-dir>` must give a coherent recovery action
363
+ after context compression. Missing or contradictory state means `Blocked`.
364
+ - Verify subagent progress when parallel execution was used:
365
+ `.sdd/subagent-progress.md` exists, all rows reference the current
366
+ `handoff_hash`, current transaction has a unique task text, stage is
367
+ `checkoff|done`, implementation commit is visible, RED/GREEN evidence is
368
+ present, spec and quality reviews passed, review-fix round is <= 3, task
369
+ checkoff commands passed, no active row has an unresolved blocker, and Leader
370
+ closeout copied worker/tester/reviewer evidence into the delivery docs.
371
+ - Verify table reverse impact evidence for database-backed work: all affected
372
+ fields have writers/readers/filters/consumer endpoints mapped, reverse-state
373
+ scenarios tested, and at least one final business entry point verified. A
374
+ sync-task-only pass or DB-only assertion is not enough.
375
+ - Verify business semantic evidence for status/enum/sync/default work: the
376
+ source-of-truth field, enum mapping, target field, consumer interpretation,
377
+ and business basis are recorded and tested. A non-null value, HTTP 200,
378
+ successful sync, or fallback/default result is not proof. Unapproved fallback,
379
+ default, old-value retention, null conversion, or alternative-field
380
+ substitution means `Blocked`, not complete.
381
+ - Verify compile/build output.
382
+ - Verify tests actually ran; `BUILD SUCCESS` alone is not proof.
383
+ - Verify tests did not merely pass after implementation. The report must prove
384
+ the test suite could catch the original failure or absent behavior.
385
+ - If a sibling repo or SDK was changed, verify its version was bumped, current
386
+ project dependency version was updated, and dependency resolution proves the
387
+ current project uses the new artifact.
388
+ - For interface, CRUD, Mapper/XML, database-backed, or configuration-driven
389
+ changes, require the three-layer gate: prompt completion definition,
390
+ `.sdd-enforced`/`.db-verified` hook markers, and
391
+ `~/.codex/hooks/superflow-verify-integration.sh <test-report.md>` before delivery.
392
+ - Before committing an implementation batch, require
393
+ `~/.codex/hooks/superflow-delivery-check.sh --check-staged <repo-root>` after
394
+ staging changes. This check must pass together with `superflow-verify-integration`;
395
+ if it reports missing `tasks.md`, `test-report.md`, `sdd-quality-gate.md`, or
396
+ stale completion placeholders, update the delivery documents before commit.
397
+ - Before marking any SDD task as delivered, require
398
+ `~/.codex/hooks/superflow-test-report-lint.py --tests <tests.md> <embedded test-report.md>`
399
+ for the current P/CR report. This lint must pass for implementation reports
400
+ and must at least be reviewed for aggregate/root reports. It catches false
401
+ green evidence (`Tests are skipped` + `BUILD SUCCESS`), contradictory
402
+ `Tests run` or `N/N` counts for the same command, missing L3/L4 real-entry
403
+ evidence, stale source anchors, and cross-repo test evidence that omits the
404
+ exact skipTests workaround.
405
+ - Report Maven evidence by command, not by wishful grouping. If
406
+ `mvn test -Dtest='*P47*'` does not match a class such as
407
+ `PackageRecordServiceImplTest`, record a separate command for that class
408
+ instead of folding the extra test into the wildcard count.
409
+ - Do not quote deleted or rejected implementation details as current evidence.
410
+ If a report must mention an old method or old wording, it must be clearly
411
+ marked as deleted/old and must not appear in the current functional evidence
412
+ table.
413
+ - If `superflow-delivery-check.sh` blocks top-level aggregate document changes during
414
+ parallel work, remove those root document edits from the worker commit and
415
+ keep only P-local delivery updates. Only a Leader/closeout worktree may create
416
+ `.sdd-aggregate-closeout` and update aggregate OpenSpec documents in a
417
+ separate commit.
418
+ - Treat unit tests as supporting evidence only. The implementation prompt must
419
+ require real Spring Boot startup, process/port/health evidence, real curl/API
420
+ calls, database queries, log checks, and test-report evidence.
421
+ - If the batch touches database-backed Java/XML code, verify the version-level
422
+ summary SQL file has been updated. Do not accept "the dev database already
423
+ has it" as completion evidence.
424
+ - Record a SQL closeout table for every DB-related batch:
425
+ `P编号 | 表 | 字段/索引/数据 | 源码引用 | 总SQL位置 | 开发库状态 | 测试库状态 | 处理结论`.
426
+ - For release SQL closeout, compare three sides: source/Mapper fields,
427
+ development database structure, and `test database current state + version
428
+ summary SQL final state`.
429
+ - For L3/L4 tests, record curl, real request parameters and their source,
430
+ response, assertions, DB evidence, logs, and external request/response when
431
+ relevant in `test-report.md`.
432
+ - For every table field used by filters, status checks, QR scan, order creation,
433
+ startup, payment/refund, notifications, scheduled jobs, or third-party sync,
434
+ `test-report.md` must show the consumer-path evidence. If the team does not
435
+ know which frontend/applet/API entry consumes a field, the batch is `Blocked`,
436
+ not passed.
437
+ - For bug fixes and CR/Px follow-ups, require Red-Green evidence: the exact
438
+ failing curl/test/workflow before the fix, then the same path passing after
439
+ the fix.
440
+ - Do not mark placeholder-only, mock-only, skipped, generic external-failure, or
441
+ missing-test-data cases as passed; report them as blocked or partially
442
+ verified.
443
+ - Do not accept "ask whether to start the app" as a valid closure. If local
444
+ startup or real API integration cannot run, record the exact blocker and mark
445
+ the batch `Blocked` or `Partially verified`.
446
+ - Run or request `openspec validate <change-id> --strict`.
447
+ - Report blockers instead of silently weakening the design.
448
+
449
+ ## Follow-Up CR Rules
450
+
451
+ Use a CR/Px prompt when frontend integration discovers:
452
+
453
+ - missing API
454
+ - missing field
455
+ - page-invisible required field
456
+ - over-designed field
457
+ - wrong enum/status
458
+ - pagination naming mismatch
459
+ - SQL/schema drift
460
+
461
+ CR/Px prompts must include the real frontend payload, screenshot or page path, error response, and validation evidence required after the fix.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "SDD Implement"
3
+ short_description: "生成分批实现 prompt、CR 追加任务与真实验收计划"
4
+ default_prompt: "Use $superflow-implement to create bounded implementation prompts and validation plans from existing SDD docs."