domain-modeling
Domain Modeling
Section titled “Domain Modeling”在设计过程中,主动建立并打磨项目的领域模型。这是一项主动实践:质疑术语、构造边界情境,并在想法刚明确时就把术语和决策写下来。(只为借用词汇而阅读 GLOSSARY.md 不算这项 skill:任何 skill 都能顺手做这件事。这项 skill 适用于你正在改变模型的情况。)
大多数仓库只有一个上下文:
/├── GLOSSARY.md├── docs/│ └── adr/│ ├── 0001-event-sourced-orders.md│ └── 0002-postgres-for-write-model.md└── src/如果根目录有 GLOSSARY-MAP.md,说明仓库有多个上下文。映射文件会标出每个上下文的位置:
/├── GLOSSARY-MAP.md├── docs/│ └── adr/ ← 系统范围的决策├── src/│ ├── ordering/│ │ ├── GLOSSARY.md│ │ └── docs/adr/ ← 上下文范围的决策│ └── billing/│ ├── GLOSSARY.md│ └── docs/adr/按需创建文件:只有有内容可写时才创建。如果还没有 GLOSSARY.md,就在第一个术语确定时创建。如果还没有 docs/adr/,就在第一个 ADR 需要记录时创建。
对照术语表提出问题
Section titled “对照术语表提出问题”如果用户使用的术语和现有 GLOSSARY.md 不一致,马上指出来。「术语表把 ‘cancellation’ 定义为 X,但你似乎指的是 Y。你想表达哪一个?」
把模糊说法说清楚
Section titled “把模糊说法说清楚”用户用了模糊或一词多义的说法时,提出一个准确的标准术语。「你说的 ‘account’ 是 Customer 还是 User?它们是两个不同的概念。」
讨论具体情境
Section titled “讨论具体情境”讨论领域关系时,用具体情境检验它们。构造能探出边界的情境,让概念之间的界限变得明确。
用户说明系统如何运作时,检查代码是否一致。如果发现矛盾,就指出来:「你的代码会取消整个 Order,但你刚才说可以部分取消。哪种说法才对?」
当场更新 GLOSSARY.md
Section titled “当场更新 GLOSSARY.md”术语一旦确定,就在当下更新 GLOSSARY.md。不要留到最后一起整理。格式见 GLOSSARY-FORMAT.md。
GLOSSARY.md 里不能有实现细节。不要把它当作规格、草稿本或记录实现决策的地方。它只是一份术语表。
谨慎提出 ADR
Section titled “谨慎提出 ADR”只有以下三点都成立时,才提出创建 ADR:
- 难以撤回:以后改变决定的成本很高
- 没有背景就会让人意外:未来的读者会想知道「为什么要这么做?」
- 确实做过取舍:存在真实的备选方案,并且因为具体原因选定其中一个
少一条都不要写 ADR。格式见 ADR-FORMAT.md。
原文链接和 commit
Section titled “原文链接和 commit”读者可以点名用它,模型也可以自己调用它。它在 Claude Code 插件里。
在设计中澄清领域术语、检验概念边界并对照代码。确定的术语当场写入术语表;ADR 只记录同时满足三项条件的架构取舍。
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.- 仓库 mattpocock/skills
- 文件
skills/engineering/domain-modeling/SKILL.md - 提交
d81f3a1 - 说明页
docs/engineering/domain-modeling.md - 同目录文件
skills/engineering/domain-modeling/ADR-FORMAT.md - 同目录文件
skills/engineering/domain-modeling/agents/openai.yaml - 同目录文件
skills/engineering/domain-modeling/GLOSSARY-FORMAT.md
英文 SKILL.md
---name: domain-modelingdescription: Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.---
# Domain Modeling
Actively build and sharpen the project's domain model as you design. This is the *active* discipline: challenging terms, inventing edge-case scenarios, and writing the glossary and decisions down the moment they crystallise. (Merely *reading* `GLOSSARY.md` for vocabulary is not this skill: that's a one-line habit any skill can do. This skill is for when you're changing the model, not just consuming it.)
## File structure
Most repos have a single context:
```/├── GLOSSARY.md├── docs/│ └── adr/│ ├── 0001-event-sourced-orders.md│ └── 0002-postgres-for-write-model.md└── src/```
If a `GLOSSARY-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:
```/├── GLOSSARY-MAP.md├── docs/│ └── adr/ ← system-wide decisions├── src/│ ├── ordering/│ │ ├── GLOSSARY.md│ │ └── docs/adr/ ← context-specific decisions│ └── billing/│ ├── GLOSSARY.md│ └── docs/adr/```
Create files lazily: only when you have something to write. If no `GLOSSARY.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.
## During the session
### Challenge against the glossary
When the user uses a term that conflicts with the existing language in `GLOSSARY.md`, call it out immediately. "Your glossary defines 'cancellation' as X, but you seem to mean Y. Which is it?"
### Sharpen fuzzy language
When the user uses vague or overloaded terms, propose a precise canonical term. "You're saying 'account': do you mean the Customer or the User? Those are different things."
### Discuss concrete scenarios
When domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts.
### Cross-reference with code
When the user states how something works, check whether the code agrees. If you find a contradiction, surface it: "Your code cancels entire Orders, but you just said partial cancellation is possible. Which is right?"
### Update GLOSSARY.md inline
When a term is resolved, update `GLOSSARY.md` right there. Don't batch these up: capture them as they happen. Use the format in [GLOSSARY-FORMAT.md](./GLOSSARY-FORMAT.md).
`GLOSSARY.md` should be totally devoid of implementation details. Do not treat `GLOSSARY.md` as a spec, a scratch pad, or a repository for implementation decisions. It is a glossary and nothing else.
### Offer ADRs sparingly
Only offer to create an ADR when all three are true:
1. **Hard to reverse**: the cost of changing your mind later is meaningful2. **Surprising without context**: a future reader will wonder "why did they do it this way?"3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons
If any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).非官方学习站,与 Matt Pocock 和 AI Hero 没有隶属关系。本站不提供可安装的中文技能包。
技能原文采用 MIT 许可。Copyright (c) 2026 Matt Pocock