spec-design
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesespec-design
spec-design
概览
Overview
本技能用于执行 Spec 级“设计阶段”的 D2:产出可评审的 决策文档(Decision Doc / RFC),并能在执行前自主决策是否需要先做 D0(分流:跳过/不跳过设计)与 D1(research:可选调研)。
核心原则:门禁优先(spec-context)→ 先分流(D0)→ 按需调研(D1)→ 决策落盘(D2)。在任何压力下都禁止猜路径、禁止在缺少 SSOT 时脑补推进。
核心原则:门禁优先(spec-context)→ 先分流(D0)→ 按需调研(D1)→ 决策落盘(D2)。在任何压力下都禁止猜路径、禁止在缺少 SSOT 时脑补推进。
开始时宣布:「我正在使用 spec-design 技能产出设计决策文档(design/design.md / RFC)。」
This skill is used to execute D2 of the Spec-level "design phase": producing a reviewable Decision Doc / RFC, and can independently decide whether to first perform D0 (diversion: skip or not skip design) and D1 (research: optional) before execution.
Core principle: Gatekeeping first (spec-context) → Diversion first (D0) → Research on demand (D1) → Finalize decisions (D2). Under any pressure, guessing paths and proceeding with made-up details without SSOT are strictly prohibited.
Core principle: Gatekeeping first (spec-context) → Diversion first (D0) → Research on demand (D1) → Finalize decisions (D2). Under any pressure, guessing paths and proceeding with made-up details without SSOT are strictly prohibited.
Announce at the start: "I am using the spec-design skill to produce a design decision document (design/design.md / RFC)."
何时使用 / 不使用
When to Use / Not to Use
- 使用时机
- 用户要求产出 (RFC/Decision Doc),或“做设计再进入 implementation”。
design/design.md - 你需要判断“是否可以跳过设计阶段”、以及“是否需要先 research”。
- 你被要求把接口字段/表结构/任务拆分塞进设计文档,担心文档分层被破坏。
- 用户要求产出
- 不要用在
- 需求尚未完成 R1(没有 ):先完成需求澄清与方案决策(见
requirements/solution.md)。spec-product-clarify - 用户明确只要 implementation 计划与任务:直接走 implementation(但仍需 )。
spec-context
- 需求尚未完成 R1(没有
- Use Cases
- Users request to produce (RFC/Decision Doc), or require "completing design before entering implementation".
design/design.md - You need to judge "whether the design phase can be skipped" and "whether research is needed first".
- You are asked to include interface fields/table structures/task breakdowns in the design document and are concerned about breaking document layering.
- Users request to produce
- Do Not Use
- Requirements have not completed R1 (no ): First complete requirement clarification and solution decision-making (see
requirements/solution.md).spec-product-clarify - Users explicitly only need implementation plans and tasks: Proceed directly to implementation (but is still required).
spec-context
- Requirements have not completed R1 (no
快速参考
Quick Reference
-
硬门禁(第一优先级):任何读写之前,必须先执行
{FEATURE_DIR}/design/*.md得到spec-context;失败立刻停止。FEATURE_DIR=... -
最短路径
- 跳过路径:D0 判定跳过 → 不写 → 进入 implementation(
design/*.md补齐最小决策信息)。plan.md - 常规路径:D0(不跳过)→(可选)D1 → D2(写 )→ implementation。
design/design.md
- 跳过路径:D0 判定跳过 → 不写
-
输出位置
- D1(可选):
{FEATURE_DIR}/design/research.md - D2(必做,未跳过时):
{FEATURE_DIR}/design/design.md
- D1(可选):
-
最小化模板
- D1:(复制到
skills/spec-design-research/research-template.md再填写){FEATURE_DIR}/design/research.md - D2:(复制到
skills/spec-design/design-template.md再填写){FEATURE_DIR}/design/design.md
- D1:
-
决策速查表
| 你在判断什么 | 触发信号(任一命中) | 动作 |
|---|---|---|
是否能开始写任何 | 没有 | 停止;先修上下文/补 SSOT |
| D0:是否跳过 design 阶段 | 范围单一、无对外承诺变化、无关键不确定性、验收口径已足够 | 可跳过;改在 implementation |
| D0:是否必须进入 D2 | 对外契约/权限/数据口径变更;数据迁移/回滚;关键不确定性;跨系统影响面大 | 不跳过;进入 D1(按需)→ D2 |
| D1:是否需要 research.md | 方案正确性依赖未知事实;多方案缺证据;高风险点需先验证 | 执行 D1,写 |
| D2:是否允许写实现细节/任务/DDL | 被要求“为了开发方便写进去” | 拒绝混层;只写对外承诺要点 + 追溯链接,细节下沉 contracts/ADR/implementation |
-
Hard Gatekeeping (Top Priority):Before reading or writing any, you must first execute
{FEATURE_DIR}/design/*.mdto obtainspec-context; stop immediately if it fails.FEATURE_DIR=... -
Shortest Path
- Skip Path: D0 decides to skip → Do not write → Enter implementation (fill in minimal decision information in
design/*.md).plan.md - Regular Path: D0 (do not skip) → (Optional) D1 → D2 (write ) → Implementation.
design/design.md
- Skip Path: D0 decides to skip → Do not write
-
Output Locations
- D1 (Optional):
{FEATURE_DIR}/design/research.md - D2 (Mandatory if not skipped):
{FEATURE_DIR}/design/design.md
- D1 (Optional):
-
Minimal Templates
- D1: (Copy to
skills/spec-design-research/research-template.mdbefore filling){FEATURE_DIR}/design/research.md - D2: (Copy to
skills/spec-design/design-template.mdbefore filling){FEATURE_DIR}/design/design.md
- D1:
-
Decision Cheat Sheet
| What You Are Judging | Trigger Signals (Any Hit) | Action |
|---|---|---|
Whether to start writing any | No | Stop; Fix context/supplement SSOT first |
| D0: Whether to skip the design phase | Single scope, no changes to external commitments, no critical uncertainties, acceptance criteria are sufficient | Can skip; Fill in minimal decision information in implementation |
| D0: Whether to must enter D2 | Changes to external contracts/authorizations/data calibers; Data migration/rollback; Critical uncertainties; Wide cross-system impact | Do not skip; Proceed to D1 (on demand) → D2 |
| D1: Whether research.md is needed | Solution correctness depends on unknown facts; Multiple solutions lack evidence; High-risk points need prior verification | Execute D1, write |
| D2: Whether implementation details/tasks/DDL are allowed to be written | Asked to "write them in for development convenience" | Reject layer mixing; Only write key external commitments + traceable links, sink details to contracts/ADR/implementation |
实施步骤(Agent 行为规范)
Implementation Steps (Agent Behavior Specifications)
0) 门禁:定位 {FEATURE_DIR}
(必须)
{FEATURE_DIR}0) Gatekeeping: Locate {FEATURE_DIR}
(Mandatory)
{FEATURE_DIR}红线:不得猜,不得用当前工作目录拼相对路径。.aisdlc/specs/...
powershell
$repoRoot = (git rev-parse --show-toplevel)
. (Join-Path $repoRoot "skills\spec-context\spec-common.ps1")
$context = Get-SpecContext
$FEATURE_DIR = $context.FEATURE_DIR
Write-Host "FEATURE_DIR=$FEATURE_DIR"若上面报错 → 立刻停止(不要生成/写任何 内容)。
design/*.mdRed Line: Do not guess, do not use the current working directory to assemble relative paths..aisdlc/specs/...
powershell
$repoRoot = (git rev-parse --show-toplevel)
. (Join-Path $repoRoot "skills\spec-context\spec-common.ps1")
$context = Get-SpecContext
$FEATURE_DIR = $context.FEATURE_DIR
Write-Host "FEATURE_DIR=$FEATURE_DIR"If an error occurs above → Stop immediately (Do not generate/write any content).
design/*.md1) 读取最小必要输入(缺失则停止)
1) Read Minimal Required Input (Stop if Missing)
- 必读(需求侧 SSOT):
{FEATURE_DIR}/requirements/solution.md - 按需:、
{FEATURE_DIR}/requirements/prd.md{FEATURE_DIR}/requirements/prototype.md - 按需(项目级):、相关
project/memory/*、project/contracts/索引project/adr/ - 若存在:、
{FEATURE_DIR}/design/research.md{FEATURE_DIR}/design/design.md
停止条件(不得脑补继续):
- 找不到或无法读取 。
requirements/solution.md - 需求的 In/Out、验收口径、关键约束无法从输入追溯。
- Mandatory Read (Demand-side SSOT):
{FEATURE_DIR}/requirements/solution.md - On Demand: ,
{FEATURE_DIR}/requirements/prd.md{FEATURE_DIR}/requirements/prototype.md - On Demand (Project-level): , related
project/memory/*,project/contracts/indexesproject/adr/ - If Exists: ,
{FEATURE_DIR}/design/research.md{FEATURE_DIR}/design/design.md
Stop Conditions (Do Not Proceed with Made-up Details):
- Cannot find or read .
requirements/solution.md - The In/Out, acceptance criteria, and key constraints of requirements cannot be traced from the input.
2) D0:分流(是否跳过设计阶段)
2) D0: Diversion (Whether to Skip the Design Phase)
2.1 何时可以“直接跳过 design 阶段”(满足其一即可考虑跳过)
2.1 When to "Skip the Design Phase Directly" (Consider skipping if any condition is met)
- 范围单一、边界清晰:几乎不涉及跨模块协作与系统性风险
- 无对外承诺变化:无新增/变更对外契约(API/事件/权限/数据口径),且无数据迁移
- 无关键技术不确定性:不需要先 research 验证
- 验收口径已足够:验收在 (或
solution.md)已清晰、可测试、可追溯prd.md
- Single scope, clear boundaries: Barely involves cross-module collaboration and systemic risks
- No changes to external commitments: No new/changed external contracts (API/events/authorizations/data calibers), and no data migration
- No critical technical uncertainties: No prior research verification needed
- Acceptance criteria are sufficient: Acceptance criteria are clear, testable, and traceable in (or
solution.md)prd.md
2.2 何时“不要跳过”(任一命中则默认不跳过)
2.2 When to "Not Skip" (Do not skip by default if any condition is hit)
- 新增/变更 对外契约(API/事件/权限/数据口径),或需要更新
project/contracts/ - 存在 数据迁移/回滚 风险,或需要新增/更新 ADR
- 有明确 关键不确定性(性能/安全/一致性/依赖/合规/网关能力/存储策略等)
- 涉及多个系统/团队/上下游,或影响面难以一句话界定
- New/changed external contracts (API/events/authorizations/data calibers), or need to update
project/contracts/ - Risks of data migration/rollback exist, or need to add/update ADRs
- Explicit critical uncertainties (performance/security/consistency/dependencies/compliance/gateway capabilities/storage strategies, etc.)
- Involves multiple systems/teams/upstream-downstream parties, or the impact scope cannot be defined in one sentence
2.3 覆写规则(防止“本可跳过但必须评审”)
2.3 Override Rules (Prevent "Could Skip but Must Review")
即使满足跳过口径,若出现以下之一,仍 不跳过(进入 D2):
- 用户/团队明确要求出 RFC 以便评审对齐
- 近期同类改动频繁返工/事故,需通过决策文档冻结口径
Even if the skip criteria are met, do not skip (proceed to D2) if any of the following occurs:
- Users/teams explicitly require an RFC for review and alignment
- Similar changes have frequently led to rework/incidents recently, requiring decision documents to freeze specifications
2.4 D0 的最小输出(不落盘也可以)
2.4 Minimal Output of D0 (Can be unrecorded)
输出一个可引用的结论段(3–7 条理由以内):
- 结论:跳过 / 不跳过
- 依据:对应上面口径(可追溯到 / 合同/ADR 入口)
solution.md - 若跳过:列出 implementation 的 必补齐的最小决策信息:
plan.md- 目标、范围与边界、关键约束、验收口径、验证清单(Owner/截止/信号/动作)
Output a quotable conclusion paragraph (within 3–7 reasons):
- Conclusion: Skip / Do not skip
- Basis: Corresponding to the above criteria (traceable to / contract/ADR entry)
solution.md - If skipped: List the minimal decision information that must be filled in implementation :
plan.md- Objectives, scope and boundaries, key constraints, acceptance criteria, verification checklist (Owner/Deadline/Signals/Actions)
3) D1:research(可选调研;只在需要时做)
3) D1: Research (Optional; Only Perform When Needed)
3.1 触发 D1 的信号(命中任一则做)
3.1 Signals to Trigger D1 (Perform if any is hit)
- 方案正确性依赖未知事实(“如果 X 不成立,方案会推倒重来”)
- 存在多个可行方向,且缺少证据支撑取舍
- 对外契约/迁移/安全/性能/一致性存在高风险点,需要先验证
- Solution correctness depends on unknown facts ("If X is not true, the solution will be completely overturned")
- Multiple feasible directions exist, but lack evidence to support trade-offs
- High-risk points exist in external contracts/migration/security/performance/consistency, requiring prior verification
3.2 何时跳过 D1
3.2 When to Skip D1
- 不确定性已在输入中被证据化(/已有
solution.md已覆盖关键风险与验证清单)research.md - 本次 D2 仅是低风险的小范围变更,且无关键未知
- Uncertainties have been evidenced in the input (key risks and verification checklists are already covered in /existing
solution.md)research.md - This D2 is only a low-risk small-scale change with no critical unknowns
3.3 design/research.md
最小结构(写结论,不写问题清单)
design/research.md3.3 Minimal Structure of design/research.md
(Write conclusions, not problem lists)
design/research.md红线:不要留下“待确认问题清单 / TODO 列表”。未知统一用“假设 + 验证清单”承接。
- TL;DR(3–7 行):现状 + 最大风险 + 推荐方向
- 现状与问题域
- 范围边界与不变量
- 关键约束
- 风险与验证清单(必填):风险/假设 → 验证方式 → 成功/失败信号 → Owner → 截止 → 下一步动作
- 备选与权衡(可选)
Red Line: Do not leave behind "To-Confirm Problem Lists / TODO Lists". Unknowns must be handled uniformly with "Assumptions + Verification Checklists".
- TL;DR (3–7 lines): Current status + Highest risk + Recommended direction
- Current Status and Problem Domain
- Scope Boundaries and Invariants
- Key Constraints
- Risks and Verification Checklist (Mandatory): Risk/Assumption → Verification Method → Success/Failure Signals → Owner → Deadline → Next Actions
- Alternatives and Trade-offs (Optional)
4) D2:design(决策文档 / RFC;未跳过时必做)
4) D2: Design (Decision Doc / RFC; Mandatory if not skipped)
4.1 D2 的定位(写“决策”,不写“实现”)
4.1 Positioning of D2 (Write "Decisions", not "Implementations")
- 只写:为什么这样做、边界怎么裁切、方案与权衡、对外承诺要点、怎么验证、影响与迁移/回滚要点。
- 不写:实现步骤、任务拆分、代码级细节、接口字段逐一罗列、DDL 细节。
- 若必须对外承诺字段/兼容性:在本文写“要点 + 追溯链接”,细节下沉到 或 ADR。
project/contracts/
- 若必须对外承诺字段/兼容性:在本文写“要点 + 追溯链接”,细节下沉到
- Only write: Why it is done this way, how boundaries are defined, solutions and trade-offs, key external commitments, how to verify, impact and migration/rollback key points.
- Do not write: Implementation steps, task breakdowns, code-level details, itemized interface fields, DDL specifics.
- If external commitments on fields/compatibility must be included: Write "key points + traceable links" in this document, and sink details to or ADRs.
project/contracts/
- If external commitments on fields/compatibility must be included: Write "key points + traceable links" in this document, and sink details to
4.2 design/design.md
建议最小结构(模板)
design/design.md4.2 Recommended Minimal Structure of design/design.md
(Template)
design/design.md必须使用最小化模板生成 design.md(避免结构漂移):
- 复制 的内容
skills/spec-design/design-template.md - 粘贴到
{FEATURE_DIR}/design/design.md - 按模板把占位符补齐(尤其是 C4 L1–L3、备选方案、风险与验证清单、追溯链接)
写作约束:只保留支撑决策/验收/演进的最小信息;不要新增“待确认问题/TODO”章节;不要写实现细节/任务拆分/字段清单/DDL。
Must use the minimal template to generate design.md (avoid structural drift):
- Copy the content of
skills/spec-design/design-template.md - Paste it to
{FEATURE_DIR}/design/design.md - Fill in the placeholders according to the template (especially C4 L1–L3, alternative solutions, risks and verification checklist, traceable links)
Writing Constraints: Only retain minimal information that supports decision-making/acceptance/evolution; Do not add "To-Confirm Problems/TODO" sections; Do not write implementation details/task breakdowns/field lists/DDL.
4.3 D2-DoD(缺一不可)
4.3 D2-DoD (All items are mandatory)
- In/Out 明确,且能追溯到
solution.md - 推荐方案用 C4 L1+L2+L3 说清楚,层次可追溯
- 关键决策说明“为什么选它/备选为何不选”
- 不确定性已收敛:未知全部进入“假设 + 验证清单”(Owner/截止/动作明确)
- In/Out are clear and traceable to
solution.md - Recommended solution is clearly explained with C4 L1+L2+L3, with traceable layers
- Key decisions explain "why this is chosen/why alternatives are rejected"
- Uncertainties have been converged: All unknowns are included in "Assumptions + Verification Checklist" (Owner/Deadline/Actions are clear)
红旗(出现任一即停止并纠偏)
Red Flags (Stop and correct immediately if any occurs)
- 没有先拿到 就开始写
FEATURE_DIR=...design/*.md - 找不到 还继续写设计(=脑补)
requirements/solution.md - 用“待确认问题清单 / TODO”悬空未知(应改为“假设 + 验证清单”)
- 把 D2 写成实现规格:任务拆分、实现步骤、字段/DDL 细节
- 缺少备选方案或缺少验证清单(导致无法评审/无法落地)
- Start writing without first obtaining
design/*.mdFEATURE_DIR=... - Continue writing design when cannot be found (= making up details)
requirements/solution.md - Leave unknowns hanging with "To-Confirm Problem Lists / TODO" (Should be changed to "Assumptions + Verification Checklist")
- Write D2 as implementation specifications: Task breakdowns, implementation steps, field/DDL details
- Missing alternative solutions or verification checklists (resulting in inability to review/implement)
压力下的反合理化(常见借口 → 对应动作)
Anti-Rationalization Under Pressure (Common Excuses → Corresponding Actions)
| 常见借口 | 对应规则 / 动作 |
|---|---|
“先随便写到 | 禁止猜路径:先 |
| “信息不全也能先出初稿,后面再补” | 禁止脑补:缺 |
| “主管/PM 说不要门禁/不要查文档” | 门禁是硬规则: |
| “为了开发快,把任务/DDL/字段都写进设计” | 拒绝混层:D2 只写决策与对外承诺要点 + 追溯链接;细节进 contracts/ADR/implementation |
| “没时间做备选/验证清单” | 备选与验证是 D2-DoD:缺失会导致无法评审/返工;宁可缩短正文也不删 DoD 项 |
| Common Excuses | Corresponding Rules / Actions |
|---|---|
"Just write something in | Path guessing is prohibited: First obtain |
| "We can produce a draft first even with incomplete information, and fill it in later" | Making up details is prohibited: Stop if |
| "Supervisor/PM said no gatekeeping/no need to check documents" | Gatekeeping is a hard rule: Stop if |
| "To speed up development, write tasks/DDL/fields into the design" | Layer mixing is rejected: D2 only writes decisions and key external commitments + traceable links; Sink details to contracts/ADR/implementation |
| "No time to prepare alternatives/verification checklists" | Alternatives and verification are part of D2-DoD: Missing them will lead to inability to review/rework; Shorten the main text rather than delete DoD items |
常见错误(以及修复)
Common Mistakes (and Fixes)
- 错误:在压力下“先写了再说”,先生成文档再补输入。
修复:先过与spec-context门禁;缺失就停止,写清楚阻塞项。solution.md - 错误:把 research 当成“查资料”,写了很多背景但没有验证清单。
修复:把未知全部转成“风险/假设 → 验证方式 → 信号 → Owner/截止/动作”。 - 错误:PM 要求把任务/接口/表结构写进设计,于是混层。
修复:设计文档只保留“对外承诺要点 + 追溯链接”;实现细节移入 implementation 或 contracts/ADR。
- Mistake: Under pressure, "write first and ask questions later", generating documents first then supplementing input.
Fix: Pass theandspec-contextgatekeeping first; Stop if missing, and clearly write down blocking items.solution.md - Mistake: Treat research as "looking up information", writing a lot of background but no verification checklist.
Fix: Convert all unknowns into "Risk/Assumption → Verification Method → Signals → Owner/Deadline/Actions". - Mistake: PM requires writing tasks/interfaces/table structures into the design, resulting in layer mixing.
Fix: Only retain "key external commitments + traceable links" in the design document; Move implementation details to implementation or contracts/ADRs.