← 技能图谱 · domain-modeling

CONTEXT.md Format

CONTEXT.md 的格式规范 — 属于 domain-modeling 技能

Structure

Structure

结构

# {Context Name}

{One or two sentence description of what this context is and why it exists.}

## Language

**Order**:
{A one or two sentence description of the term}
_Avoid_: Purchase, transaction

**Invoice**:
A request for payment sent to a customer after delivery.
_Avoid_: Bill, payment request

**Customer**:
A person or organization that places orders.
_Avoid_: Client, buyer, account
# {上下文名称}

{一两句话描述该上下文的含义及其存在理由。}

## Language

**Order**:
{对术语的一两句描述}
_Avoid_: Purchase, transaction

**Invoice**:
向客户发送的付款请求,在交付之后发出。
_Avoid_: Bill, payment request

**Customer**:
下单的个人或组织。
_Avoid_: Client, buyer, account
Rules

Rules

规则

  • Be opinionated. When multiple words exist for the same concept, pick the best one and list the others under _Avoid_.
  • 要有主见。 当一个概念存在多个词时,选出最佳的一个,把其余列在 _Avoid_ 下。
  • Keep definitions tight. One or two sentences max. Define what it IS, not what it does.
  • 定义要精炼。 最多一两句话。定义它是什么,而不是它做什么。
  • Only include terms specific to this project's context. General programming concepts (timeouts, error types, utility patterns) don't belong even if the project uses them extensively. Before adding a term, ask: is this a concept unique to this context, or a general programming concept? Only the former belongs.
  • 只包含本项目上下文特有的术语。 通用编程概念(超时、错误类型、工具模式)即使项目广泛使用也不应收录。添加术语前问自己:这是该上下文独有的概念,还是通用编程概念?只有前者才属于这里。
  • Group terms under subheadings when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.
  • 术语可按子标题分组,当自然形成聚类时。如果所有术语都属于同一个连贯领域,平铺列表即可。
Single vs multi-context repos

Single vs multi-context repos

单上下文 vs 多上下文仓库

Single context (most repos): One CONTEXT.md at the repo root.

单上下文(大部分仓库): 一个 CONTEXT.md 放在仓库根目录。

Multiple contexts: A CONTEXT-MAP.md at the repo root lists the contexts, where they live, and how they relate to each other:

多上下文: CONTEXT-MAP.md 放在仓库根目录,列出各上下文的位置及其相互关系:

# Context Map

## Contexts

- [Ordering](./src/ordering/CONTEXT.md) — receives and tracks customer orders
- [Billing](./src/billing/CONTEXT.md) — generates invoices and processes payments
- [Fulfillment](./src/fulfillment/CONTEXT.md) — manages warehouse picking and shipping

## Relationships

- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking
- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices
- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`
# Context Map

## Contexts

- [Ordering](./src/ordering/CONTEXT.md) — 接收和跟踪客户订单
- [Billing](./src/billing/CONTEXT.md) — 生成发票和处理付款
- [Fulfillment](./src/fulfillment/CONTEXT.md) — 管理仓库拣货和发货

## Relationships

- **Ordering → Fulfillment**: Ordering 发出 `OrderPlaced` 事件;Fulfillment 消费后开始拣货
- **Fulfillment → Billing**: Fulfillment 发出 `ShipmentDispatched` 事件;Billing 消费后生成发票
- **Ordering ↔ Billing**: 共享 `CustomerId` 和 `Money` 类型

The skill infers which structure applies:

  • If CONTEXT-MAP.md exists, read it to find contexts
  • If only a root CONTEXT.md exists, single context
  • If neither exists, create a root CONTEXT.md lazily when the first term is resolved

技能自动推断适用哪种结构:

  • 如果存在 CONTEXT-MAP.md,读取它来查找上下文
  • 如果只有根目录的 CONTEXT.md,则是单上下文
  • 如果两者都不存在,在第一个术语确定时惰性创建根 CONTEXT.md

When multiple contexts exist, infer which one the current topic relates to. If unclear, ask.

存在多个上下文时,推断当前话题属于哪一个。如果不确定,就问用户。