domain-modeling

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

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
CONTEXT.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.)
在设计过程中主动构建并完善项目的领域模型。这是一项主动实践:质疑术语、设计边界场景,并在术语和决策明确的第一时间记录到术语表中。(仅仅为了查阅词汇而阅读
CONTEXT.md
不属于这项技能:那是任何技能都能做到的基础习惯。这项技能适用于你需要调整模型,而非只是使用模型的场景。)

File structure

文件结构

Most repos have a single context:
/
├── CONTEXT.md
└── src/
Create files lazily: only when you have something to write. If no
CONTEXT.md
exists, create one when the first term is resolved.## During the session
大多数代码仓库只有单一上下文:
/
├── CONTEXT.md
└── src/
按需创建文件:仅当有内容需要记录时才创建。如果不存在
CONTEXT.md
,在第一个术语被确定时再创建。

Challenge against the glossary

会话期间

—

指出术语冲突

When the user uses a term that conflicts with the existing language in
CONTEXT.md
, call it out immediately. "Your glossary defines 'cancellation' as X, but you seem to mean Y. Which is it?"
当用户使用的术语与
CONTEXT.md
中的现有定义冲突时,立即指出。例如:「你的术语表中定义的‘取消’是X,但你这里的意思似乎是Y。到底是哪个?」

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."
当用户使用模糊或多义的术语时,提出精准的规范术语。例如:「你说的‘账户’是指Customer还是User?这两者是不同的概念。」

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?"
当用户描述某功能的工作方式时,检查代码是否与之相符。如果发现矛盾,直接指出:「你的代码是取消整个Order,但你刚才说可以部分取消。哪个才是对的?」

Update CONTEXT.md inline

即时更新CONTEXT.md

When a term is resolved, update
CONTEXT.md
right there. Don't batch these up: capture them as they happen. Use the format in CONTEXT-FORMAT.md.
CONTEXT.md
should be totally devoid of implementation details. Do not treat
CONTEXT.md
as a spec, a scratch pad, or a repository for implementation decisions. It is a glossary and nothing else.
当一个术语被确定后,立即更新
CONTEXT.md
。不要批量处理:在术语确定的当下就记录。使用CONTEXT-FORMAT.md中规定的格式。
CONTEXT.md
应完全不包含实现细节。不要将
CONTEXT.md
当作规格说明书、草稿纸或实现决策的存储库。它只是一个术语表,仅此而已。