ubiquitous-language
- 信任分
- 88/100
- 兼容 Agent
- 1
- 领域
- 工程开发
- 兼容 Agent
- Claude Code
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @mattpocock · 未声明 license
- 安装命令数
- 1 条
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
想读作者英文原文? ↓ 滚到正文区切换 · 在 GitHub 查看 ↗
ubiquitous-language 把当前对话里出现的领域名词、动词、概念抽出来,整理成一份统一术语表写到 UBIQUITOUS_LANGUAGE.md。它解决一个具体痛点:同名异义与异名同义——同一词被当成两个概念用、同一概念却有 N 种说法。
设计思路
作者借的是 DDD 里 ubiquitous language 的概念:人、代码、文档要用同一组词,否则 review、PRD、triage 全在浪费精力翻译。技能不替你创造领域,而是把已经在对话里浮现的术语钉死:选一个 canonical、列被禁的同义词、给清晰定义、再把关系画出来。
工作流
① Scan:扫对话里所有领域相关的名词 / 动词 / 概念;② 识别问题:同词不同义(ambiguity)/ 不同词同义(synonyms)/ 模糊或负载过重的术语;③ 提议 canonical 词典——有主见地选一个;④ 写到 UBIQUITOUS_LANGUAGE.md;⑤ 在对话里给一段摘要。
输出格式
按主题分组(Order lifecycle / People / Relationships…),每组一张三列表:Term(粗体)/ Definition / Aliases to avoid。再补 ## Relationships("An Invoice belongs to exactly one Customer")和 ## Example dialogue(用 canonical 术语写一段对话演示)+ ## Flagged ambiguities(点名歧义来源——"account" 既被当成 Customer 又当成 User)。
例子
作者给的样本:
- Order(A customer's request to purchase one or more items)—— Aliases to avoid: Purchase, transaction
- Invoice(A request for payment sent to a customer after delivery)—— Aliases to avoid: Bill, payment request
- Customer vs User:前者下单、后者只是认证身份
规则
Be opinionated —— 不要把所有同义词都列成可用,挑一个、其他列入 "avoid";定义写"系统视角下的可观察 behavior",不写"前端怎么 render"。
适合谁
- 跨 PRD / refactor RFC / triage 复用术语的项目
- 多 agent 协作,需要把同一组词钉死
- 团队新人 onboarding 的术语速查
何时不要用
- 项目仅有少量术语 / 一周内的小项目:维护成本高于收益
- 已有公司级数据字典:直接 import 那个
配套
grill-with-docs(基于本词典做 PRD review 与领域语言锚定)、to-prd(PRD 里强制使用本词典词汇)、to-issues(issue 标题与描述用本词典)、triage(triage 时用统一词汇评估 issue)。
Ubiquitous Language
Extract and formalize domain terminology from the current conversation into a consistent glossary, saved to a local file.
Process
- Scan the conversation for domain-relevant nouns, verbs, and concepts
- Identify problems:
- Same word used for different concepts (ambiguity)
- Different words used for the same concept (synonyms)
- Vague or overloaded terms
- Propose a canonical glossary with opinionated term choices
- Write to
UBIQUITOUS_LANGUAGE.mdin the working directory using the format below - Output a summary inline in the conversation
Output Format
Write a UBIQUITOUS_LANGUAGE.md file with this structure:
# Ubiquitous Language
## Order lifecycle
| Term | Definition | Aliases to avoid |
| ----------- | ------------------------------------------------------- | --------------------- |
| **Order** | A customer's request to purchase one or more items | Purchase, transaction |
| **Invoice** | A request for payment sent to a customer after delivery | Bill, payment request |
## People
| Term | Definition | Aliases to avoid |
| ------------ | ------------------------------------------- | ---------------------- |
| **Customer** | A person or organization that places orders | Client, buyer, account |
| **User** | An authentication identity in the system | Login, account |
## Relationships
- An **Invoice** belongs to exactly one **Customer**
- An **Order** produces one or more **Invoices**
## Example dialogue
> **Dev:** "When a **Customer** places an **Order**, do we create the **Invoice** immediately?"
> **Domain expert:** "No — an **Invoice** is only generated once a **Fulfillment** is confirmed. A single **Order** can produce multiple **Invoices** if items ship in separate **Shipments**."
> **Dev:** "So if a **Shipment** is cancelled before dispatch, no **Invoice** exists for it?"
> **Domain expert:** "Exactly. The **Invoice** lifecycle is tied to the **Fulfillment**, not the **Order**."
## Flagged ambiguities
- "account" was used to mean both **Customer** and **User** — these are distinct concepts: a **Customer** places orders, while a **User** is an authentication identity that may or may not represent a **Customer**.
Rules
- Be opinionated. When multiple words exist for the same concept, pick the best one and list the others as aliases to avoid.
- Flag conflicts explicitly. If a term is used ambiguously in the conversation, call it out in the "Flagged ambiguities" section with a clear recommendation.
- Only include terms relevant for domain experts. Skip the names of modules or classes unless they have meaning in the domain language.
- Keep definitions tight. One sentence max. Define what it IS, not what it does.
- Show relationships. Use bold term names and express cardinality where obvious.
- Only include domain terms. Skip generic programming concepts (array, function, endpoint) unless they have domain-specific meaning.
- Group terms into multiple tables when natural clusters emerge (e.g. by subdomain, lifecycle, or actor). Each group gets its own heading and table. If all terms belong to a single cohesive domain, one table is fine — don't force groupings.
- Write an example dialogue. A short conversation (3-5 exchanges) between a dev and a domain expert that demonstrates how the terms interact naturally. The dialogue should clarify boundaries between related concepts and show terms being used precisely.
Example dialogue
Dev: "How do I test the sync service without Docker?"
Domain expert: "Provide the filesystem layer instead of the Docker layer. It implements the same Sandbox service interface but uses a local directory as the sandbox."
Dev: "So sync-in still creates a bundle and unpacks it?"
Domain expert: "Exactly. The sync service doesn't know which layer it's talking to. It calls
execandcopyIn— the filesystem layer just runs those as local shell commands."
Re-running
When invoked again in the same conversation:
- Read the existing
UBIQUITOUS_LANGUAGE.md - Incorporate any new terms from subsequent discussion
- Update definitions if understanding has evolved
- Re-flag any new ambiguities
- Rewrite the example dialogue to incorporate new terms