$npx -y skills add BlueprintOS/analysis-to-delivery --skill domain-modeling梳理领域模型 — 来自 superpowers 体系。本 skill 是桥接层,完整纪律见 <SUPERPOWERS_SKILL_ROOT>/domain-modeling/。
| 1 | # Domain-Modeling(桥接到 superpowers) |
| 2 | |
| 3 | ## Contract |
| 4 | |
| 5 | - Inputs: design spec, terminology, entities, business rules |
| 6 | - Outputs: domain model diagram and entity list |
| 7 | - Gates: user agrees canonical terms and relationships |
| 8 | - Required disciplines: `stage-gate` |
| 9 | - Next: `/writing-plans` |
| 10 | |
| 11 | > **本仓库不维护此 skill 的内容**。完整纪律请读: |
| 12 | > `<SUPERPOWERS_SKILL_ROOT>/domain-modeling/SKILL.md` |
| 13 | |
| 14 | ## 何时调 |
| 15 | |
| 16 | - brainstorming / design-an-interface 之后 |
| 17 | - 需要定义实体、值对象、聚合根 |
| 18 | |
| 19 | ## 衔接点 |
| 20 | |
| 21 | - **产出**:领域模型图 + 实体清单 |
| 22 | - **下一步**:`/writing-plans` |
| 23 | - **门控**:`disciplines/stage-gate` 第 2 层 |
| 24 | |
| 25 | ## 降级方案(superpowers 未装时) |
| 26 | |
| 27 | 如果 `<SUPERPOWERS_SKILL_ROOT>/domain-modeling/` 不存在,按以下 4 步产出领域模型: |
| 28 | |
| 29 | ### 1. 列实体 |
| 30 | |
| 31 | 从 brainstorming 设计稿提取名词,过滤出**实体**(有生命周期、有 ID)与**值对象**(无 ID、不可变): |
| 32 | |
| 33 | | 类型 | 例子 | 判别 | |
| 34 | |---|---|---| |
| 35 | | 实体 | ASN / LPN / 波次 | 有 `*_ID`,状态会变 | |
| 36 | | 值对象 | 收货地址 / 计量单位 | 无 ID,只描述属性 | |
| 37 | | 聚合根 | ASN(含 LPN 列表) | 一致性边界 | |
| 38 | |
| 39 | ### 2. 画 ASCII 关系图 |
| 40 | |
| 41 | 参考 `disciplines/ascii-flowchart` 用 ASCII 画实体关系图,严禁 Mermaid: |
| 42 | |
| 43 | ``` |
| 44 | [ASN] -- 1..N --> [ASN_DTL] -- 1..N --> [LPN] |
| 45 | | | |
| 46 | +-- 1..1 --> [收货地址(值对象)] |
| 47 | ``` |
| 48 | |
| 49 | ### 3. 字段对齐验证 |
| 50 | |
| 51 | 每个实体字段必须与知识库核对(`disciplines/no-field-guessing`): |
| 52 | |
| 53 | - 已有表 → 直接用现有字段(走 `field-alignment-check.py`) |
| 54 | - 新增字段 → 标记 `EXTEND` 且写扩展理由 |
| 55 | |
| 56 | ### 4. 输出 + 签字 |
| 57 | |
| 58 | 写到 `docs/superpowers/specs/<topic>-domain.md`,末尾 `## Sign-off` 等用户白名单签字(4 句之一)。 |
| 59 | |
| 60 | ### 最小纪律摘要 |
| 61 | |
| 62 | - **名词 ≠ 实体**:不是所有名词都是实体,看 ID 与状态 |
| 63 | - **ASCII 不用 Mermaid**:与全局 `ascii-flowchart` 纪律冲突 |
| 64 | - **字段不靠记忆**:严禁自创字段名(`no-field-guessing` + `no-self-invent`) |
| 65 | - **聚合根边界 = 事务边界**:不能跨聚合根强一致 |
| 66 | |
| 67 | ### 安装提示 |
| 68 | |
| 69 | ```bash |
| 70 | npx skills@latest add obra/superpowers-domain-modeling |
| 71 | ``` |