project-discover-modules-contracts
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseproject-discover-modules-contracts(Step4:模块单页 SSOT + 契约段落 + 证据链)
project-discover-modules-contracts (Step 4: Module Single Page SSOT + Contract Paragraph + Evidence Chain)
概览
Overview
模块页是 Discover 的“权威入口”。它的目标不是写全细节,而是让 AI/人能在需要时 快速判断边界与不变量,并且能沿着证据链定位到代码/契约/测试/CI/ops。
开始时宣布:「我正在使用 project-discover-modules-contracts 技能为模块建立单页 SSOT(含契约段落与证据链)。」
The module page is the "authoritative entry" of Discover. Its goal is not to cover all details, but to allow AI/humans to quickly determine boundaries and invariants when needed, and locate code/contract/test/CI/ops along the evidence chain.
Announce at the start: "I am using the project-discover-modules-contracts skill to build a single-page SSOT (including contract paragraphs and evidence chains) for the module."
硬规则(P0 必须满足)
Hard Rules (P0 mandatory)
- 模块页路径固定
.aisdlc/project/components/{module}.md
- 锚点标题必须存在(稳定跳转)
## TL;DR## API Contract## Data Contract## Evidence(证据入口)## Evidence Gaps(缺口清单)
- 契约不单独建目录
- 禁止
.aisdlc/project/contracts/**
- 禁止
- 缺口必须结构化
- 所有缺口只写到 (不允许散落“待补/未发现/TODO”)
## Evidence Gaps(缺口清单)
- 所有缺口只写到
- 禁止“占位句”冒充内容
- 在 /
API Contract/Data Contract等正文里,禁止写“待补齐后填写/待确认/未发现/以后再补”等占位句。Evidence - 如果缺证据或缺结论:只允许写入 ,并保持正文段落简短、可追溯。
## Evidence Gaps(缺口清单)
- 在
- Fixed module page path
.aisdlc/project/components/{module}.md
- Anchor titles must exist (for stable redirection)
## TL;DR## API Contract## Data Contract## Evidence## Evidence Gaps
- No separate directory for contracts
- is prohibited
.aisdlc/project/contracts/**
- Gaps must be structured
- All gaps can only be written in (scattered "to be filled/undiscovered/TODO" is not allowed)
## Evidence Gaps
- All gaps can only be written in
- Prohibit "placeholder sentences" pretending to be content
- In the main content of /
API Contract/Data Contractetc., placeholder sentences such as "to be filled after completion/to be confirmed/undiscovered/fill later" are prohibited.Evidence - If evidence or conclusions are missing: you can only write them into , and keep the main paragraphs short and traceable.
## Evidence Gaps
- In the main content of
模块页 Frontmatter(必填)
Module Page Frontmatter (required)
yaml
---
module: <module-short-name>
priority: P0|P1|P2
change_frequency: high|medium|low
last_verified_at: <YYYY-MM-DD>
source_files:
- <path/to/key/file1>
- <path/to/key/file2>
---提示:可用 git log 的经验判断或简单统计;change_frequency只选“最能代表模块边界/契约/状态机”的关键源文件。source_files
yaml
---
module: <module-short-name>
priority: P0|P1|P2
change_frequency: high|medium|low
last_verified_at: <YYYY-MM-DD>
source_files:
- <path/to/key/file1>
- <path/to/key/file2>
---Tip:can be judged by git log experience or simple statistics;change_frequencyonly select key source files that "best represent module boundaries/contracts/state machines".source_files
模块页推荐结构(最小可用)
Recommended Module Page Structure (minimum viable)
markdown
undefinedmarkdown
undefined<模块中文名>(<module>)
<Chinese module name>(<module>)
TL;DR
TL;DR
<3–5 句话:做什么、边界、关键不变量、最关键的证据入口>
<3–5 sentences: what it does, boundaries, key invariants, most critical evidence entry>
模块定位
Module Positioning
- In:
- Out:
- In:
- Out:
Owner
Owner
- 团队/负责人/值班入口:
- Team/responsible person/on-call entry:
入口
Entries
- 代码入口:
- 运行入口(如有):../ops/...
- Code entry:
- Runtime entry (if any):../ops/...
协作场景(1–2 个)
Collaboration Scenarios (1–2)
- 谁调用谁 + 关键边界(细节时序下沉到 spec)
- Who calls whom + key boundaries (detailed timelines are下沉 to spec)
State Machines & Domain Events
State Machines & Domain Events
- 状态机摘要:
- 领域事件摘要:
- State machine summary:
- Domain event summary:
API Contract
API Contract
- 权威入口(必须可定位):
- 不变量摘要(3–7 条):
- 证据入口(最小粒度):
- Authoritative entry (must be locatable):
- Invariant summary (3–7 items):
- Evidence entry (minimum granularity):
Data Contract
Data Contract
- 数据主责(Ownership):
- 核心对象与主键:
- 权威入口(必须可定位):
- 不变量摘要(3–7 条):
- 证据入口(最小粒度):
- Data Ownership:
- Core objects and primary keys:
- Authoritative entry (must be locatable):
- Invariant summary (3–7 items):
- Evidence entry (minimum granularity):
Evidence(证据入口)
Evidence
- Code:
- Tests:
- CI:
- Ops:
- Code:
- Tests:
- CI:
- Ops:
Evidence Gaps(缺口清单)
Evidence Gaps
- 缺口:
- 期望补齐到的粒度:
- 候选证据位置:
- 影响:
undefined- Gap:
- Expected granularity after filling:
- Candidate evidence location:
- Impact:
undefined契约段落写法(避免“字段大全”)
Contract Paragraph Writing Guide (avoid "full field list")
## API Contract
最小要求(P0)
## API ContractMinimum Requirements for ## API Contract
(P0)
## API Contract- 权威入口(必须可点击/可定位)
- OpenAPI/Proto/Schema 的源文件路径或生成物路径
- 若有生成/校验命令或 CI job,写入口(不写长说明)
- 不变量摘要(3–7 条)
- 例如:鉴权方式、幂等语义、版本策略、错误码族、审计要求、超时/重试策略
- 证据入口(最小粒度)
- 至少 N 个关键 handler/router/controller 文件路径
- 至少 1 个代表性测试入口(没有就进入 Evidence Gaps)
- 至少 1 个 CI job/命令入口(能证明“有没有跑测试/有没有做契约校验”)
- Authoritative entry (must be clickable/locatable)
- Source file path or generated product path of OpenAPI/Proto/Schema
- If there is a generation/verification command or CI job, write the entry (no long explanation)
- Invariant summary (3–7 items)
- E.g.: authentication method, idempotent semantics, version policy, error code family, audit requirements, timeout/retry policy
- Evidence entry (minimum granularity)
- At least N key handler/router/controller file paths
- At least 1 representative test entry (add to Evidence Gaps if none)
- At least 1 CI job/command entry (can prove "whether tests are run/contract verification is done")
## Data Contract
最小要求(P0)
## Data ContractMinimum Requirements for ## Data Contract
(P0)
## Data Contract- 数据主责(Ownership)
- 主写/只读/同步来源(边界明确)
- 核心对象与主键
- 对象名 + 主键/唯一标识 + 生命周期一句话
- 权威入口(必须可定位)
- migrations/DDL/Schema/ORM model 的证据入口
- 不变量摘要(3–7 条)
- 例如:唯一性约束、状态口径、关键枚举、不可变字段、对账口径入口
- 证据入口(最小粒度)
- 关键 repository/mapper/service 路径
- 测试/CI 证据入口(无则进 Evidence Gaps)
- Data Ownership
- Primary writer/read-only/synchronization source (clear boundaries)
- Core objects and primary keys
- Object name + primary key/unique identifier + one-sentence lifecycle description
- Authoritative entry (must be locatable)
- Evidence entry of migrations/DDL/Schema/ORM model
- Invariant summary (3–7 items)
- E.g.: uniqueness constraint, state caliber, key enumeration, immutable fields, reconciliation caliber entry
- Evidence entry (minimum granularity)
- Key repository/mapper/service path
- Test/CI evidence entry (add to Evidence Gaps if none)
Evidence Gaps(缺口清单)模板(强制结构化)
Evidence Gaps Template (mandatory structured)
任何“找不到/不确定/待补”都必须按这个结构写,避免缺口散落导致永远补不齐。特别提醒: 如果你暂时无法给出“3–7 条不变量摘要”,不要在正文里写“待补齐后填写”。 正确做法:在 Evidence Gaps 里新增缺口条目(例如“缺口:未提取 API 不变量摘要”),并写清候选证据位置与影响。 该模块此时不得在索引中打勾。
markdown
undefinedAny "undiscovered/uncertain/to be filled" must be written according to this structure, to avoid scattered gaps that can never be filled.Special reminder: If you can not provide "3–7 invariant summaries" for the time being, do not write "to be filled later" in the main text. Correct practice: Add a new gap entry in Evidence Gaps (e.g. "Gap: API invariant summary not extracted"), and clearly state the candidate evidence location and impact. This module cannot be checked in the index at this time.
markdown
undefinedEvidence Gaps(缺口清单)
Evidence Gaps
- 缺口:未发现 OpenAPI/Proto 权威入口(无法确认接口字段与错误码族)
- 期望补齐到的粒度:定位到具体 schema 文件路径或生成 job 名
- 候选证据位置:、
docs/、api/、CI workflow 中的 build-docs jobopenapi/ - 影响:需求设计与实现阶段会猜接口契约,容易破坏兼容性与回归成本高
undefined- Gap: No OpenAPI/Proto authoritative entry found (unable to confirm interface fields and error code family)
- Expected granularity after filling: Locate specific schema file path or generation job name
- Candidate evidence location: ,
docs/,api/, build-docs job in CI workflowopenapi/ - Impact: Interface contracts will be guessed during requirement design and implementation stages, which is easy to damage compatibility and lead to high regression cost
undefinedP1/P2 的降级规则(避免范围失控)
P1/P2 Downgrade Rules (avoid scope creep)
- P1:模块页必须存在;API 或 Data 允许缺失其一,但必须在 Evidence Gaps 写清缺口与影响
- P2:默认不创建模块页,只在索引占位;需要时再升级到 P1/P0
- P1: Module page must exist; either API or Data contract can be missing, but the gap and impact must be clearly written in Evidence Gaps
- P2: Module page is not created by default, only placeholder in index; upgrade to P1/P0 when needed
红旗清单
Red Flag List
- 契约段落写成字段大全(应改为:权威入口 + 不变量摘要 + 证据入口)
- “缺口”用 TODO/待补散落在正文(必须集中到 Evidence Gaps)
- 在正文里写“待补齐后填写/未发现/以后再补”这种占位句(必须改为 Evidence Gaps)
- 在索引里重复模块页内容(索引只导航)
- Contract paragraphs are written as full field lists (should be changed to: authoritative entry + invariant summary + evidence entry)
- "Gaps" are scattered in the main text as TODO/to be filled (must be centralized to Evidence Gaps)
- Placeholder sentences such as "to be filled later/undiscovered/fill later" are written in the main text (must be changed to Evidence Gaps)
- Module page content is repeated in the index (index only provides navigation)
常见错误
Common Mistakes
- 把“证据入口”写成“你应该怎么做”(要写在哪里、而不是怎么操作)
- 把一次性交付细节写进项目级模块页(应下沉 spec 或外部 runbook)
- Write "evidence entry" as "what you should do" (write where it is, not how to operate)
- Write one-time delivery details into project-level module pages (should be下沉 to spec or external runbook)