@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,83 @@
1
+ ---
2
+ name: superflow-design
3
+ description: Use when SDD/OpenSpec contract docs exist and source-level technical design, reverse impact analysis, TDD strategy, or Superpowers design handoff must be produced before implementation prompts.
4
+ ---
5
+
6
+ # SDD Design
7
+
8
+ Use this after `$superflow-docs` has produced the OpenSpec/SDD contract documents and
9
+ before `$superflow-implement` creates implementation prompts. This phase lets
10
+ Superpowers own source-level HOW without weakening OpenSpec/SDD contracts.
11
+
12
+ ## Ownership
13
+
14
+ - OpenSpec/SDD owns WHAT and contracts: requirements, API, DB, SQL, field
15
+ semantics, tests, real-entry acceptance, and quality gates.
16
+ - Superpowers owns HOW: source-level technical design, reverse impact analysis,
17
+ TDD/RED order, Worker/Tester/Reviewer split, worktree/port plan, and
18
+ implementation risk.
19
+ - If HOW conflicts with WHAT, stop and return to `$superflow-docs`; do not carry the
20
+ conflict into prompts.
21
+
22
+ ## Preconditions
23
+
24
+ - `proposal.md`, `api.md`, `design.md`, `tasks.md`, `tests.md`,
25
+ `traceability-matrix.md`, `sdd-quality-gate.md`, and `test-report.md` exist.
26
+ - `.sdd/state.yaml` exists and is in `phase: design`. If still `docs`, run:
27
+ ```bash
28
+ ../superflow-pipeline/scripts/superflow-yaml-validate.sh <change-dir>
29
+ ../superflow-pipeline/scripts/superflow-guard.sh <change-dir> docs --apply
30
+ ```
31
+ - `.sdd/handoff/sdd-context.md`, `.json`, and `.sha256` exist and match current
32
+ docs. If docs changed, rerun:
33
+ ```bash
34
+ ../superflow-pipeline/scripts/superflow-handoff.sh <change-dir> --refresh
35
+ ```
36
+
37
+ ## Procedure
38
+
39
+ 1. Read `.sdd/handoff/sdd-context.md` plus original `api.md`, `design.md`,
40
+ `tasks.md`, and `tests.md`.
41
+ 2. If design discussion is still evolving, maintain
42
+ `.sdd/handoff/brainstorm-summary.md` with confirmed, candidate, pending, and
43
+ rejected items. Do not create final technical design from memory only.
44
+ 3. Use Superpowers `brainstorming` or equivalent deep design reasoning to
45
+ decide source-level HOW.
46
+ 4. Write:
47
+ `docs/superpowers/specs/YYYY-MM-DD-<change-id>-technical-design.md`
48
+ using `../superflow-pipeline/references/superpower-technical-design-template.md`.
49
+ 5. For cross-repository, service-to-service, SDK, MQ, scheduler, device,
50
+ callback, third-party, mini-program, gateway, or adapter changes, include
51
+ `Architecture Boundary And Call Direction`. Prove owner module, call
52
+ direction, existing entry/exit points, proposed entry/exit points, evidence
53
+ anchors, and forbidden shortcuts. If the proposed HOW turns an outbound
54
+ adapter/protocol translator/device gateway into a business-entry
55
+ orchestrator, stop and return to `$superflow-docs` unless the OpenSpec/SDD
56
+ contract explicitly grants that ownership with approval evidence.
57
+ 6. For field/status/enum/sync changes, include `Field And Status Reverse
58
+ Impact` and prove writers, readers, filters, derived sync paths, consumers,
59
+ and tests. Direct setter-only design is blocked.
60
+ 7. Record state:
61
+ ```bash
62
+ ../superflow-pipeline/scripts/superflow-state.sh set <change-dir> technical_design docs/superpowers/specs/YYYY-MM-DD-<change-id>-technical-design.md
63
+ ../superflow-pipeline/scripts/superflow-state.sh set <change-dir> design_doc design.md
64
+ ```
65
+ 8. Update `design.md` with `Superpowers Technical Design Handoff`, update
66
+ `sdd-quality-gate.md` with the technical design path and hash, then run
67
+ `../superflow-pipeline/scripts/superflow-handoff.sh <change-dir> --refresh`.
68
+ If the guard reports a stale or missing hash, record the printed hash in
69
+ `design.md`, `sdd-quality-gate.md`, prompts, and `test-report.md`, then run
70
+ `--refresh` again. Do not set `design_doc` to the Superpowers document;
71
+ `design_doc` is the OpenSpec/SDD contract design, while `technical_design`
72
+ is the Superpowers HOW document.
73
+ 9. Run:
74
+ ```bash
75
+ ../superflow-pipeline/scripts/superflow-yaml-validate.sh <change-dir>
76
+ ../superflow-pipeline/scripts/superflow-guard.sh <change-dir> design --apply
77
+ ```
78
+
79
+ ## Completion
80
+
81
+ Do not continue to `$superflow-implement` until the design guard passes. The next
82
+ phase may generate prompts, but this phase must not skip any required SDD
83
+ contract document or replace API/DB/tests with Superpowers prose.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "SDD Design"
3
+ short_description: "用 Superpowers 生成源码级技术详设和反向影响面分析"
4
+ default_prompt: "Use $superflow-design to create the Superpowers technical design after SDD contract docs are complete."
@@ -0,0 +1,316 @@
1
+ ---
2
+ name: superflow-docs
3
+ description: Use when confirmed OpenSpec artifacts need SDD contract docs such as API-first checks, traceability, quality gates, tests, mock docs, review checklist, test-report skeleton, and handoff before Superpowers technical design.
4
+ ---
5
+
6
+ # SDD Docs
7
+
8
+ Use this skill after a feature is frozen or after `$openspec-propose` has
9
+ created the base OpenSpec artifacts. This skill is an SDD contract-doc wrapper;
10
+ it must not replace the installed OpenSpec skills for core artifact generation
11
+ and must not generate implementation prompts.
12
+
13
+ ## OpenSpec First
14
+
15
+ For new OpenSpec document generation, invoke `$openspec-propose` first. The
16
+ OpenSpec skill must drive:
17
+
18
+ - `openspec new change "<name>"`
19
+ - `openspec status --change "<name>" --json`
20
+ - `openspec instructions <artifact-id> --change "<name>" --json`
21
+ - artifact creation in the dependency order returned by the OpenSpec CLI
22
+
23
+ Only after the OpenSpec artifacts exist should this skill add or refine SDD
24
+ quality artifacts such as API contract details, traceability, quality gates,
25
+ mock/test strategy, review checklist, and test-report skeleton.
26
+
27
+ Do not hand-write fixed OpenSpec templates when `openspec instructions` can
28
+ provide the schema-specific template, rules, dependencies, and output path.
29
+ Do not invent new fields or requirements.
30
+
31
+ ## Preconditions
32
+
33
+ For complex requirements, verify these before writing docs:
34
+
35
+ - `source-ingestion.md`, `feature-inventory.md`, and `feature-gates.md` prove
36
+ that the original PRD/Lark/Feishu/screenshots were processed section by
37
+ section, not summarized into tasks in one whole-document pass. Each feature
38
+ used by docs must have a source range/page/screenshot reference and a frozen
39
+ or explicitly blocked gate. If this evidence is missing for a long or mixed
40
+ requirement source, stop and return to `$superflow-clarify`.
41
+ - The OpenSpec/SDD docs include platform-level impact discovery evidence.
42
+ Prefer understand-anything artifacts when present, but treat them only as
43
+ locator evidence. If missing, stale, incomplete, or unavailable, the docs must
44
+ show the downgrade path: `rg`, source reading, Mapper/XML, configuration,
45
+ database table names, log templates, and sibling-repo search. Do not stop only
46
+ because understand-anything is missing; stop when no platform impact discovery
47
+ evidence exists.
48
+ - The docs record: discovery method, understand-anything index status when
49
+ available, analyzed platform scope, impacted modules/interfaces/tables,
50
+ sibling repo or SDK implications, regression risks, source/DB/API
51
+ confirmation evidence, and validation approach.
52
+ - For cross-repository, service-to-service, SDK, MQ, scheduler, device,
53
+ callback, third-party, mini-program, gateway, or adapter designs, the docs
54
+ include a module responsibility and call-direction judgment before freezing
55
+ API/tasks/tests. The judgment must identify the business-entry owner, outbound
56
+ adapter owner, existing entry/exit points, proposed entry/exit points, and
57
+ forbidden shortcuts. If the design would route a business entry through an
58
+ outbound adapter/protocol translator/device gateway, stop and return to
59
+ `$superflow-clarify` unless owner approval is explicitly recorded.
60
+ - For any design that depends on existing source behavior, table relationships,
61
+ data permissions, field ownership, status derivation, external parameters, or
62
+ upstream/downstream calls, the docs include a verified evidence chain:
63
+ platform impact discovery scope, source/Mapper/XML anchors, and read-only DB
64
+ checks when source is insufficient. Graph output or chat explanation alone is
65
+ not sufficient. If this evidence is missing and the relationship affects
66
+ design, stop and return to `$superflow-clarify`.
67
+ - For any database-backed design, the docs include table-to-code reverse impact
68
+ evidence: every affected table/field, all writers/readers/filters, sibling
69
+ repo or third-party consumers, real user-facing endpoints, reverse-state
70
+ scenarios, and validation cases. If the docs only describe the write/sync
71
+ path and do not prove consumers, stop and return to `$superflow-clarify`. Use
72
+ `$superflow-table-impact-analysis` when available.
73
+ - For any status, enum, sync, derived, default, or compatibility behavior, the
74
+ docs include business semantic evidence:
75
+ `真源字段 | 真源枚举 | 目标字段 | 目标枚举 | 消费方解释 | 业务依据 | 不确定项`.
76
+ If the docs only prove that a value exists, is non-null, or lets the request
77
+ succeed, stop and return to `$superflow-clarify`. If fallback/default/keep-old-value
78
+ behavior is proposed without explicit requirement or owner approval, stop.
79
+ - For low-freedom implementation handoff, docs include the five hard gates:
80
+ field semantic contract, write-through persistence closure, real-entry call
81
+ chain, no-fallback/no-guessing boundary, and pre-coding agent self-check. If
82
+ any gate is missing from `design.md`, `tests.md`, or quality gate, stop and
83
+ complete the docs first.
84
+ - `design.md` stays the OpenSpec/SDD design contract: requirement mapping,
85
+ API/DB/field semantics, source facts, real-entry call chain, no-fallback
86
+ boundary, risks, and acceptance hooks. It must not try to own all source-level
87
+ implementation choreography.
88
+ - `design.md` includes a "Superpowers Technical Design Handoff" placeholder
89
+ that states the boundary and target path for the later `$superflow-design` phase:
90
+ OpenSpec/SDD owns WHAT/contracts, Superpowers owns source-level HOW. Do not
91
+ write the final technical design in `$superflow-docs`.
92
+ - `.sdd/handoff/sdd-context.md`, `.sdd/handoff/sdd-context.json`, and
93
+ `.sdd/handoff/sdd-context.sha256` exist for the change/task. Generate them
94
+ with `../superflow-pipeline/scripts/superflow-handoff.sh <change-dir> --refresh`
95
+ after core OpenSpec/SDD docs are written and before `$superflow-design` or
96
+ implementation prompt generation. Also initialize
97
+ `.sdd/state.yaml` with
98
+ `../superflow-pipeline/scripts/superflow-state.sh init <change-dir> docs`.
99
+ - `sdd-quality-gate.md` records the handoff command, context hash, and
100
+ `../superflow-pipeline/scripts/superflow-guard.sh <change-dir> docs` result.
101
+ Missing handoff/state evidence is `Blocked for context drift guard`.
102
+ - `.sdd/state.yaml` records `phase: docs`, `workflow`, `handoff_context`,
103
+ `handoff_hash`, `context_compression`, and any known `build_command` /
104
+ `verify_command`.
105
+ Do not manually edit phase. When docs are complete, run
106
+ `../superflow-pipeline/scripts/superflow-yaml-validate.sh <change-dir>` and
107
+ `../superflow-pipeline/scripts/superflow-guard.sh <change-dir> docs --apply`; the
108
+ guard must advance state through `docs-complete` into `phase: design` for
109
+ full workflow and print the deterministic next step.
110
+ - For very large requirements, multi-agent handoff, or repeated context
111
+ compression risk, create project `.sdd/config.yaml` or
112
+ `<change-dir>/.sdd/config.yaml` with `context_compression: beta` before
113
+ running `superflow-handoff.sh --refresh`. See
114
+ `../superflow-pipeline/references/project-config.md`.
115
+ - If docs hit a real decision point, use
116
+ `../superflow-pipeline/references/decision-point.md` and record the decision
117
+ in `design.md` or `sdd-quality-gate.md` before regenerating handoff.
118
+ - `tests.md` can freeze executable tests before implementation. For each
119
+ scenario/API/database-backed path, it must include concrete test data source,
120
+ automation command, assertion, RED expected failure, GREEN expected pass,
121
+ DB/log evidence, and matching `test-report.md` section. If test data,
122
+ token, device, third-party dependency, or environment is unavailable, mark
123
+ that case `Blocked`/`Partially verified`; do not leave it as an open TODO.
124
+ - `feature-gates.md` exists and the current feature is `已冻结`.
125
+ - `ui-contract.md` contains page-to-API/DTO/DB mapping.
126
+ - `gap-analysis.md` has no unresolved blocker for the current feature.
127
+ - A precise `api.md` section exists or can be generated from the confirmed API draft.
128
+
129
+ If any precondition fails, stop and return to `$superflow-clarify`.
130
+ If the base OpenSpec change does not exist, stop and invoke `$openspec-propose`.
131
+
132
+ ## Required Documents
133
+
134
+ Generate or update through OpenSpec instructions first, then SDD checks as
135
+ applicable:
136
+
137
+ - `proposal.md`
138
+ - `bug-fix-plan.md` for bug fixes, production/test incident reports, root-cause
139
+ reports, CR/Px fixes, and report-driven corrections
140
+ - `api.md`
141
+ - `specs/<capability>/spec.md`
142
+ - `design.md`
143
+ - `tasks.md`
144
+ - `tests.md`
145
+ - `test-report.md` skeleton
146
+ - `sdd-quality-gate.md`
147
+ - `traceability-matrix.md` when tasks are split
148
+ - `mock.md` when external dependencies exist
149
+ - `review-checklist.md` when implementation will be split
150
+ - `.sdd/state.yaml`
151
+ - `.sdd/handoff/sdd-context.md`
152
+ - `.sdd/handoff/sdd-context.json`
153
+ - `.sdd/handoff/sdd-context.sha256`
154
+ - `.sdd/config.yaml` when context compression mode differs from default
155
+
156
+ For every embedded P/CR/bug-fix/follow-up task, create the same document set
157
+ inside that task directory before updating aggregate/root documents:
158
+
159
+ - `.openspec.yaml`
160
+ - `proposal.md`
161
+ - `bug-fix-plan.md` when applicable
162
+ - `api.md`
163
+ - `spec.md` or `specs/<capability>/spec.md`
164
+ - `design.md`
165
+ - `tasks.md`
166
+ - `tests.md`
167
+ - `traceability-matrix.md`
168
+ - `review-checklist.md`
169
+ - `sdd-quality-gate.md`
170
+ - `test-report.md`
171
+
172
+ Then update root `tasks.md`, root `tests.md`, root `traceability-matrix.md`,
173
+ root `sdd-quality-gate.md`, and root `test-report.md`. Missing any task-local
174
+ required document or root cross-link is `Blocked for docs`; do not proceed to
175
+ `$superflow-design`.
176
+
177
+ Use references only as needed:
178
+
179
+ - `../superflow-pipeline/references/openspec-format.md`
180
+ - `../superflow-pipeline/references/document-templates.md`
181
+ - `../superflow-pipeline/references/api-design-template.md`
182
+ - `../superflow-pipeline/references/quality-standards.md`
183
+ - `../superflow-pipeline/references/quality-gate.md`
184
+ - `../superflow-pipeline/references/traceability-matrix.md`
185
+ - `../superflow-pipeline/references/mock-strategy-guide.md`
186
+ - `../superflow-pipeline/references/test-execution-template.md`
187
+ - `../superflow-pipeline/references/test-guide.md`
188
+ - `../superflow-pipeline/references/validation-integrity.md`
189
+ - `../superflow-pipeline/references/decision-point.md`
190
+ - `../superflow-pipeline/references/dirty-worktree.md`
191
+ - `../superflow-pipeline/references/project-config.md`
192
+
193
+ ## Rules
194
+
195
+ - API is design input, not post-implementation documentation.
196
+ - New requirements and bug fixes must include platform-level impact discovery
197
+ before finalizing design/tasks/tests. Use understand-anything as a locator
198
+ when available, but do not use it as the design authority. Do not rely only
199
+ on the current service's local design; verify whether sibling repos, shared
200
+ SDKs, common DTOs, shared database tables, scheduled jobs, callbacks, external
201
+ platform adapters, or configuration consumers are affected.
202
+ - Do not freeze cross-module design from "this module can technically call it"
203
+ evidence. `design.md` or `traceability-matrix.md` must include:
204
+ `链路步骤 | 调用方向 | 业务入口 owner | 出口/适配 owner | 既有入口/出口 |
205
+ 拟新增入口/出口 | 是否符合职责 | 证据锚点 | 禁止绕路`.
206
+ Outbound adapters, protocol translators, MQ notification consumers, and
207
+ device gateways must not be promoted into business-entry orchestrators unless
208
+ the contract says they own that entry and records approval.
209
+ - Do not finalize a design by guessing existing relationships from names. For
210
+ existing-code-backed decisions, start with platform impact discovery, then
211
+ verify with source/Mapper/XML anchors, then database checks if source is not conclusive.
212
+ If the relation is still unclear, write a blocker and ask the user; do not
213
+ turn an assumption into a requirement, table design, API contract, or prompt.
214
+ - Do not finalize database-backed design from a forward-only flow. For each
215
+ affected table/field, `design.md` or `traceability-matrix.md` must include:
216
+ `表/字段 | 写入方 | 读取/过滤方 | 跨仓/外部消费方 | 真实入口 | 反向状态场景 | 必测用例`.
217
+ Status fields must include recovery scenarios such as offline -> online,
218
+ deleted -> restored, missing -> reappearing, and old invalid value -> valid
219
+ after an upstream omission.
220
+ - Do not finalize status/enum/sync/default design from "has a value" evidence.
221
+ `design.md` or `traceability-matrix.md` must include:
222
+ `真源字段 | 真源枚举 | 目标字段 | 目标枚举 | 消费方解释 | 业务依据 | 不确定项`.
223
+ Default values, fallback values, null-to-available conversions, old-value
224
+ retention, and alternative-field substitution are forbidden unless explicitly
225
+ required for dirty historical data or uncontrollable external input. Approved
226
+ compatibility must document:
227
+ `兜底触发条件 | 业务依据 | 会掩盖的异常 | 监控/告警/暴露方式 | 移除条件 | owner确认`.
228
+ - `design.md`, `tests.md`, `sdd-quality-gate.md`, or `test-report.md` must name
229
+ the relationship judgment as `确定/部分确定/不确定` when a bug fix hinges on
230
+ existing data or call-chain behavior.
231
+ - `design.md` must reference the frozen `api.md` fields and errors.
232
+ - `design.md` must include a "字段语义合同" table for every risky field:
233
+ `字段 | 来源表/DTO/事件 | 真实语义 | 目标字段 | 目标语义 | 是否可等价 |
234
+ 证据锚点 | 禁止用法 | 不确定项/owner`.
235
+ - `design.md` or `traceability-matrix.md` must include a "写入闭环" table for
236
+ every persisted or synchronized value:
237
+ `业务动作 | Java setter/赋值点 | Converter/DTO 映射 | Mapper insert/update |
238
+ DB column | 后续读取方 | 消费入口 | 验证 SQL | 测试用例`.
239
+ - `design.md` must include a "真实入口调用链" table:
240
+ `用户/外部动作 | 上游服务/接口 | 本仓入口 | MQ/异步回调 | 关键字段变化 |
241
+ DB 状态 | 结算/通知/展示消费点 | 真实验证方式`.
242
+ - `design.md` or `sdd-quality-gate.md` must include a "禁止 fallback 与猜测实现"
243
+ section. It must explicitly list forbidden defaults, fallback queries,
244
+ substitute fields, keep-old-value behavior, null conversion, and downstream
245
+ compensation. Approved compatibility must include owner confirmation and
246
+ exposure/removal rules.
247
+ - `design.md` must include a "Superpowers Technical Design Handoff" placeholder
248
+ after the OpenSpec/SDD contract decisions are written. It records
249
+ `handoff_hash`, the intended technical design path, and states:
250
+ OpenSpec/SDD owns WHAT/API/DB/tests/gates; Superpowers owns source-level HOW,
251
+ TDD/RED order, team split, worktree/port plan, and verification choreography.
252
+ The final technical design is created by `$superflow-design`, not `$superflow-docs`.
253
+ - `test-report.md` skeleton must include an "Agent 执行前自检" section with:
254
+ `真实入口已定位 | 字段语义合同已核对 | 写入闭环已核对 |
255
+ 禁止兜底边界已确认 | RED 测试已执行 | 允许修改文件 | 禁止修改文件 |
256
+ 阻塞项`.
257
+ - `tasks.md`, `tests.md`, and later prompts must use the same field names as `api.md`.
258
+ - `tests.md` is a pre-implementation contract. It must not be a vague checklist.
259
+ Every case must include:
260
+ `用例ID | 需求/Scenario | 层级L1/L2/L3/L4 | 前置数据 | 操作步骤 |
261
+ 自动化命令 | 响应断言 | DB断言 | 日志断言 | RED预期失败 | GREEN预期通过 |
262
+ test-report证据位置`.
263
+ - Each visible UI field, button action, list column, dropdown, and enum must map to API/DTO/DB/tests or be explicitly out of scope.
264
+ - Every spec scenario must have at least one test case.
265
+ - Every implementation batch must have at least one test that can fail before
266
+ code changes. For new behavior this is the new API/service/mapper/unit test;
267
+ for bug fixes this is the reported failure path. If the behavior cannot be
268
+ executed before implementation, write the blocker and required data instead
269
+ of pretending RED is complete.
270
+ - Any page-invisible required field is a blocker unless marked backend default or backend-derived.
271
+ - For every L3/L4, frontend payload, dropdown, enum, external dependency, export,
272
+ import, or cross-system case, `tests.md` must name the real test data source
273
+ and exact evidence required in `test-report.md`; placeholder data cannot prove
274
+ real integration.
275
+ - For every API case, `tests.md` must include an executable interface command
276
+ (`curl`, Postman/Newman, pytest, RestAssured, or project-native test command),
277
+ token/cookie setup, request payload, expected response fields and business
278
+ assertions. It must also list the DB SELECT and log keywords that prove the
279
+ request changed or read the correct state.
280
+ - For every affected table/field, `tests.md` must include at least one consumer
281
+ test against a real business entry point, not only a table write or sync-task
282
+ assertion. If a field participates in filtering, startup checks, QR scan,
283
+ order creation, payment/refund, notification, scheduled jobs, or third-party
284
+ adapters, those consuming paths must be listed as required validation or
285
+ explicitly blocked.
286
+ - For every status/enum/sync field, `tests.md` must assert the consumer-facing
287
+ business meaning of each involved value. Non-null checks, HTTP 200, successful
288
+ sync-task execution, or "field exists" assertions are insufficient.
289
+ - `test-report.md` skeleton must include Red-Green evidence for bug fixes and
290
+ CR/Px follow-ups: failing evidence before the fix, then the same path passing
291
+ after the fix.
292
+ - `test-report.md` skeleton must include these sections before implementation:
293
+ `RED 失败证据`, `GREEN 通过证据`, `接口自动化证据`, `DB 核查证据`,
294
+ `日志核查证据`, `未自动化/阻塞用例`, and `Partially verified 边界`.
295
+ Each section must reference concrete `tests.md` case IDs.
296
+ - `sdd-quality-gate.md` must include blocking checks for:
297
+ executable tests frozen, RED/GREEN expectations present, interface automation
298
+ commands present, DB/log assertions present, and mock/skipped cases excluded
299
+ from Passed.
300
+ - `sdd-quality-gate.md` must include a blocking check that
301
+ `.sdd/handoff/sdd-context.*` exists, the hash is recorded, and
302
+ `../superflow-pipeline/scripts/superflow-guard.sh <change-dir> docs` passes.
303
+ - `sdd-quality-gate.md` must include a state-machine check:
304
+ `.sdd/state.yaml` exists, `phase: docs` before docs completion, and
305
+ `superflow-state.sh next <change-dir>` / `recover <change-dir>` have clear output.
306
+ - External dependency failures must be modeled as blocked, partially verified,
307
+ or real integration passed. A generic fallback error is not a pass unless the
308
+ requirement explicitly says so.
309
+ - Do not proceed to `$superflow-design` until quality gates pass.
310
+ - Do not mark document completeness as passed unless `sdd-quality-gate.md`
311
+ lists the actual task-local required files and root cross-links.
312
+
313
+ ## Handoff
314
+
315
+ When SDD docs pass quality gates, continue with `$superflow-design` for Superpowers
316
+ technical design before prompt splitting or coding orchestration.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "SDD Docs"
3
+ short_description: "基于冻结功能点生成 API 先行的完整 SDD 文档集"
4
+ default_prompt: "Use $superflow-docs to generate API-first OpenSpec SDD documents from the confirmed feature."
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: superflow-hotfix
3
+ description: Use when an SDD task is a small bug fix or urgent behavior repair that may use a lighter path unless API, database, cross-repo, status, SQL, SDK, or real-entry gates are involved.
4
+ ---
5
+
6
+ # SDD Hotfix
7
+
8
+ Hotfix is a preset workflow, not a bypass. It keeps SDD state and verification,
9
+ but skips heavy design expansion only when the repair is genuinely small.
10
+
11
+ ## Allowed Scope
12
+
13
+ Use hotfix only when all are true:
14
+
15
+ - Existing behavior is broken and the intended behavior is already clear.
16
+ - No new capability design is needed.
17
+ - No API contract change.
18
+ - No SQL/schema/table/status/enum/cross-repo/SDK change.
19
+ - No third-party or real-entry contract ambiguity.
20
+
21
+ If any condition fails, set `workflow: full` and return to full SDD docs.
22
+
23
+ ## Procedure
24
+
25
+ 1. Initialize or update state:
26
+ ```bash
27
+ ~/.codex/skills/superflow-pipeline/scripts/superflow-state.sh init <change-dir> hotfix docs
28
+ ```
29
+ 2. Create the minimum SDD docs needed to freeze the fix:
30
+ `proposal.md`, `api.md` when an interface is touched, `design.md`,
31
+ `tasks.md`, `tests.md`, `sdd-quality-gate.md`, `test-report.md`, and
32
+ prompt.
33
+ 3. Generate handoff and run docs guard.
34
+ 4. Set implementation decisions:
35
+ ```bash
36
+ ~/.codex/skills/superflow-pipeline/scripts/superflow-state.sh set <change-dir> build_mode team-prompt
37
+ ~/.codex/skills/superflow-pipeline/scripts/superflow-state.sh set <change-dir> isolation worktree
38
+ ~/.codex/skills/superflow-pipeline/scripts/superflow-state.sh set <change-dir> tdd_mode direct
39
+ ~/.codex/skills/superflow-pipeline/scripts/superflow-state.sh set <change-dir> review_mode off
40
+ ```
41
+ 5. Run implement and verify guards. If `scale` reports `full`, upgrade to full.
42
+
43
+ ## Upgrade Conditions
44
+
45
+ Upgrade to full SDD when the fix touches API, DB, SQL, Mapper/XML,
46
+ cross-repo consumers, status/enum semantics, SDK versions, real entry points,
47
+ third-party integration, payment/refund/device/MQ/scheduler flows, or when the
48
+ root cause is not yet proven.