@tanlinfeng/project-docs-workflow 0.0.0-stage → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +52 -0
  3. package/README.md +162 -2
  4. package/bin/install.js +695 -0
  5. package/package.json +20 -4
  6. package/skills/deepwork/SKILL.md +15 -0
  7. package/skills/doc-opt/EXAMPLES.md +77 -0
  8. package/skills/doc-opt/SKILL.md +83 -0
  9. package/skills/doc-opt/agents/openai.yaml +5 -0
  10. package/skills/domain-modeling/SKILL.md +83 -0
  11. package/skills/domain-modeling/agents/openai.yaml +3 -0
  12. package/skills/grill-me/SKILL.md +13 -0
  13. package/skills/grill-with-docs/SKILL.md +18 -0
  14. package/skills/grilling/SKILL.md +46 -0
  15. package/skills/grilling/agents/openai.yaml +3 -0
  16. package/skills/improve-codebase-architecture/SKILL.md +15 -0
  17. package/skills/project-docs-workflow/SKILL.md +108 -0
  18. package/skills/project-docs-workflow/agents/openai.yaml +5 -0
  19. package/skills/project-docs-workflow/assets/templates/entries/adr-entry.md +27 -0
  20. package/skills/project-docs-workflow/assets/templates/entries/issue-entry.md +28 -0
  21. package/skills/project-docs-workflow/assets/templates/entries/pdr-current.md +19 -0
  22. package/skills/project-docs-workflow/assets/templates/entries/pdr-interfaces.md +28 -0
  23. package/skills/project-docs-workflow/assets/templates/entries/pdr-module-readme.md +34 -0
  24. package/skills/project-docs-workflow/assets/templates/entries/pdr-nfr.md +22 -0
  25. package/skills/project-docs-workflow/assets/templates/entries/pdr-spec.md +20 -0
  26. package/skills/project-docs-workflow/assets/templates/entries/term-entry.md +22 -0
  27. package/skills/project-docs-workflow/assets/templates/project/adr-readme.md +31 -0
  28. package/skills/project-docs-workflow/assets/templates/project/agents-block.md +15 -0
  29. package/skills/project-docs-workflow/assets/templates/project/agents-domain.md +44 -0
  30. package/skills/project-docs-workflow/assets/templates/project/agents-issues.md +65 -0
  31. package/skills/project-docs-workflow/assets/templates/project/agents-workflow.md +61 -0
  32. package/skills/project-docs-workflow/assets/templates/project/context.md +21 -0
  33. package/skills/project-docs-workflow/assets/templates/project/pdr-00-readme.md +36 -0
  34. package/skills/project-docs-workflow/references/adr.md +53 -0
  35. package/skills/project-docs-workflow/references/coexistence.md +49 -0
  36. package/skills/project-docs-workflow/references/deps/boundaries.md +29 -0
  37. package/skills/project-docs-workflow/references/deps/doc-opt.md +17 -0
  38. package/skills/project-docs-workflow/references/deps/domain-modeling.md +51 -0
  39. package/skills/project-docs-workflow/references/deps/grilling.md +31 -0
  40. package/skills/project-docs-workflow/references/deps/tdd.md +35 -0
  41. package/skills/project-docs-workflow/references/issues.md +51 -0
  42. package/skills/project-docs-workflow/references/pdr.md +33 -0
  43. package/skills/project-docs-workflow/references/terminology.md +21 -0
  44. package/skills/project-docs-workflow/references/workflow.md +45 -0
  45. package/skills/retro/SKILL.md +19 -0
  46. package/skills/tdd/SKILL.md +50 -0
  47. package/skills/tdd/agents/openai.yaml +3 -0
package/package.json CHANGED
@@ -1,6 +1,22 @@
1
1
  {
2
2
  "name": "@tanlinfeng/project-docs-workflow",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "2.1.0",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "description": "项目文档工作流 skill 包:提供 issue tracker / ADR / PDR / 术语表与工作流约定,自带轻量依赖 skill 与 ref 兜底,可独立分发。",
8
+ "license": "MIT",
9
+ "bin": {
10
+ "project-docs-workflow": "bin/install.js"
11
+ },
12
+ "files": [
13
+ "bin",
14
+ "skills",
15
+ "LICENSE",
16
+ "NOTICE",
17
+ "README.md"
18
+ ],
19
+ "engines": {
20
+ "node": ">=18"
21
+ }
22
+ }
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: deepwork
3
+ description: 高成本、多阶段、高风险深度工作会议的边界占位;与五步流程互斥,需要完整工作流时请另行安装。
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Deepwork(边界占位)
8
+
9
+ 本 skill 只界定边界,不含完整流程;需要完整的 deepwork 工作流时请单独安装。
10
+
11
+ - **适用**:成本高、风险大、需跨多个阶段推进的整块工作。
12
+ - **互斥**:与 `project-docs-workflow` 的五步流程(规划 / 骨架 / 细节 / 异常 / 回顾)互斥——同一个 effort 只能选一个,绝不叠加。
13
+ - **无完整 deepwork 时**:退回一个最小的分阶段计划,每个阶段设评审闸门:计划 → 实现 → 评审,逐阶段推进。
14
+
15
+ 术语或 ADR 需求交给 `domain-modeling`。
@@ -0,0 +1,77 @@
1
+ # Doc Opt — Examples
2
+
3
+ Behavioral anchors for the rules in `SKILL.md`. Each pair shows one rule applied.
4
+
5
+ ## Style — 中文
6
+
7
+ **Before**
8
+
9
+ > 其实呢,这个模块的性能问题,说白了主要就是每次请求都重新创建连接。值得注意的是,换成连接池之后,其实功能不会有太大影响,但是速度会快很多。
10
+
11
+ **After**
12
+
13
+ > 性能瓶颈来自每次请求重建连接。改用连接池,功能不变,延迟显著下降。
14
+
15
+ Removed: 其实呢 / 说白了 / 主要就是 / 值得注意的是 / 其实 / "不会有太大影响"(模糊)→ 功能不变 / "会快很多"(模糊)→ 延迟显著下降。
16
+
17
+ ## Style — English
18
+
19
+ **Before**
20
+
21
+ > Basically, it's worth noting that the retry logic just retries forever, which is, of course, a problem. Simply add a cap and you're good to go.
22
+
23
+ **After**
24
+
25
+ > The retry logic loops forever. Cap the retry count.
26
+
27
+ Removed: Basically / it's worth noting / just / of course / Simply / you're good to go.
28
+
29
+ ## Diagram — ASCII to mermaid
30
+
31
+ **Before**
32
+
33
+ ```text
34
+ +--------+ +---------+ +---------+
35
+ | Client | --> | Gateway | --> | Service |
36
+ +--------+ +---------+ +---------+
37
+ ```
38
+
39
+ **After**
40
+
41
+ ```mermaid
42
+ flowchart LR
43
+ client[Client] --> gateway[Gateway] --> service[Service]
44
+ ```
45
+
46
+ The mapping is lossless: same nodes, same order, same direction. When an annotation has no mermaid equivalent, ask before converting.
47
+
48
+ ## Citations — rejected and accepted forms
49
+
50
+ **Rejected (bare numbers)**
51
+
52
+ > Batched requests cut per-call overhead in half [2]. The gateway supports HTTP/2 [1].
53
+
54
+ **Accepted (jumpable)**
55
+
56
+ > Batched requests cut per-call overhead in half ([MCP spec — Batching](https://modelcontextprotocol.io/specification/2025-06-18#batching)). The gateway supports HTTP/2 ([RFC 9113](https://www.rfc-editor.org/rfc/rfc9113)).
57
+
58
+ **Accepted (self-contained, no stable target)**
59
+
60
+ > Per the MCP specification, batching cuts per-call overhead.
61
+
62
+ **Unknown source — move to the end**
63
+
64
+ ```markdown
65
+ ## 待补充来源
66
+
67
+ - 吞吐提升数据(原文 [3]):来源不明,待补。
68
+ ```
69
+
70
+ ## mermaid vs SVG
71
+
72
+ | Situation | Use |
73
+ | --- | --- |
74
+ | Flow, sequence, state, class, ER, gantt, pie | mermaid |
75
+ | Annotated architecture, custom positioning, layout mermaid misrepresents | svg |
76
+ | Diagram too large or reused across documents | sibling `.svg` file, linked |
77
+ | ASCII art or image explicitly requested by the user | keep as asked |
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: doc-opt
3
+ description: "Tersely professionalize documents: strip filler, use mermaid/SVG diagrams, make citations jumpable."
4
+ disable-model-invocation: true
5
+ argument-hint: "Files or paths to optimize"
6
+ ---
7
+
8
+ # Doc Opt
9
+
10
+ Optimize named markdown documents in place. Default targets: `.md` / `.mdx`. Other formats only when named.
11
+
12
+ ## Contract
13
+
14
+ - Touch the named files; never sweep the repo.
15
+ - Compression removes redundancy, never facts.
16
+ - Code fences, frontmatter, commands, and quoted output stay byte-identical.
17
+ - Structural moves (delete a section, reorder, merge diagrams) get a plan first, edits second.
18
+ - End with a change report: files, change categories, `待补充来源`, self-check evidence.
19
+
20
+ ## Style (L2 by default)
21
+
22
+ L1 strips filler only; L3 goes telegraphic. Move up or down only when the user names the level.
23
+
24
+ - Delete words that carry no information: filler, hedging, throat-clearing.
25
+ - Short declarative sentences. Active voice. Verbs over nominalizations.
26
+ - Lists and tables when the content enumerates.
27
+ - Keep technical terms exact; keep headings unless the heading is the problem.
28
+
29
+ Filler to cut on sight:
30
+
31
+ | ZH | EN |
32
+ | --- | --- |
33
+ | 其实、值得注意的是、让我们来看看、不得不说、说白了、众所周知 | basically, actually, of course, it's worth noting, let's dive in |
34
+
35
+ `just` and `其实` get judged per sentence: they stay only when literal ("only") or when they mark a real contrast.
36
+
37
+ ## Diagrams
38
+
39
+ Default: mermaid. Match the type to the relation: flowchart, sequence, state, class, ER, gantt, pie.
40
+
41
+ SVG covers what mermaid cannot express or where layout needs control — annotated architecture, custom positioning. Inline SVG for small diagrams; a sibling `.svg` file plus a link for large or reused ones.
42
+
43
+ ASCII art and image diagrams appear only when the user explicitly asks. Existing ASCII diagrams convert to mermaid/SVG when the mapping is lossless; ambiguous semantics get a question first. Screenshots stay: add a caption and a jumpable citation.
44
+
45
+ ## Citations
46
+
47
+ A bare number (`[1]`) is not a citation. Every reference is jumpable or self-contained:
48
+
49
+ | Target | Form |
50
+ | --- | --- |
51
+ | Section of the same document | `[label](#anchor)` |
52
+ | File elsewhere in the repo | `[label](relative/path.md#anchor)` |
53
+ | External source | `[label](https://full-url)` |
54
+
55
+ Without a stable target, carry the source inside the sentence ("per the MCP spec, ..."). A source that cannot be identified goes into a `待补充来源` list at the document end and into the change report.
56
+
57
+ ## Workflow
58
+
59
+ 1. Read the targets whole. Mark frontmatter and code that must not move.
60
+ 2. Plan structural changes; wait for confirmation.
61
+ 3. Rewrite: style, then diagrams, then citations.
62
+ 4. Run the self-check.
63
+ 5. Report files, change categories, `待补充来源`, self-check evidence.
64
+
65
+ ## Self-check
66
+
67
+ Run before reporting; put evidence in the report. Substitute the target paths for `<files>`; ignore hits inside code fences.
68
+
69
+ ```bash
70
+ # filler survivors — expect no hits
71
+ rg -n "其实|值得注意的是|让我们来看看|说白了|basically|actually|of course|worth noting" <files>
72
+
73
+ # bare numeric citations — expect no hits
74
+ rg -n '\[\d+\]' <files>
75
+
76
+ # ASCII diagrams — expect no hits unless the user asked for them
77
+ rg -n '[┌┐└┘├┤│─]|\+--' <files>
78
+
79
+ # mermaid fences — count them; each needs a declaration line and a closing fence
80
+ rg -n '^```mermaid' <files>
81
+ ```
82
+
83
+ `EXAMPLES.md` holds before/after pairs: style (ZH/EN), ASCII→mermaid, citation forms, mermaid vs SVG selection.
@@ -0,0 +1,5 @@
1
+ interface:
2
+ display_name: "Doc Opt"
3
+ short_description: "Terse professional docs with real diagrams"
4
+ policy:
5
+ allow_implicit_invocation: false
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: domain-modeling
3
+ description: 构建并打磨项目的领域模型与术语。当讨论代码库术语、编写或修改 CONTEXT.md、或记录/编辑 ADR 时使用。
4
+ ---
5
+
6
+ # Domain Modeling(领域建模)
7
+
8
+ > 轻量精简版,裁剪自 [mattpocock/skills](https://github.com/mattpocock/skills) 的 domain-modeling(MIT License, Copyright (c) 2026 Matt Pocock)。若环境已安装同名完整 skill,请优先使用完整版。
9
+
10
+ 在设计的同时**主动**构建并打磨项目的领域模型。这是主动的纪律:质疑术语、构造边界场景、在术语和决策成型的那一刻就把它们写下来。(只是为查词而读 `CONTEXT.md` 不算本 skill——那是任何 skill 都能做的一行习惯;本 skill 用于**修改**模型,而不只是消费它。)
11
+
12
+ ## 文件结构
13
+
14
+ 多数仓库只有一个上下文:
15
+
16
+ ```
17
+ /
18
+ ├── CONTEXT.md
19
+ ├── docs/
20
+ │ └── adr/
21
+ │ ├── 0001-event-sourced-orders.md
22
+ │ └── 0002-postgres-for-write-model.md
23
+ └── src/
24
+ ```
25
+
26
+ 若根目录存在 `CONTEXT-MAP.md`,说明仓库有多个上下文,由它指向每个上下文的位置。
27
+
28
+ **惰性创建**:只在有内容可写时才建文件。没有 `CONTEXT.md`,就在第一个术语确定时创建;没有 `docs/adr/`,就在需要第一条 ADR 时创建。
29
+
30
+ ## 会话中的动作
31
+
32
+ - **对照词汇表质疑**:用户用词与 `CONTEXT.md` 冲突时立刻指出。「你的词汇表把 cancellation 定义为 X,但你说的似乎是 Y,到底是哪个?」
33
+ - **锐化模糊表达**:用户用含糊或一词多义的词时,提出精确的规范术语。「你说的 account 是指 Customer 还是 User?这是两回事。」
34
+ - **讨论具体场景**:讨论领域关系时用具体场景压力测试,逼用户把概念边界说清楚。
35
+ - **与代码交叉验证**:用户描述某处如何工作时,核对代码是否一致;矛盾要当面提出。「你的代码取消整个 Order,但你刚说可以部分取消,哪个对?」
36
+ - **立即更新 CONTEXT.md**:术语一确定就当场写入,不要攒批。
37
+
38
+ `CONTEXT.md` 必须完全不含实现细节:它是词汇表,不是 spec、草稿本或实现决策仓库。
39
+
40
+ ## CONTEXT.md 格式
41
+
42
+ ```md
43
+ # {上下文名称}
44
+
45
+ {一两句话说明这是什么上下文、为什么存在。}
46
+
47
+ ## Language
48
+
49
+ **Order**:
50
+ {一或两句话的术语描述}
51
+ _Avoid_: Purchase, transaction
52
+ ```
53
+
54
+ 规则:
55
+
56
+ - **有主见**:同一概念有多个词时,选最好的一个,其余列入 `_Avoid_`。
57
+ - **定义紧致**:最多一两句,定义它**是什么**,不是**做什么**。
58
+ - **只收本项目特有概念**:通用编程概念(超时、错误类型、工具模式)不进,哪怕项目大量使用它们。
59
+ - **自然成簇时可分子标题**;单一内聚领域用平铺列表即可。
60
+
61
+ ## ADR
62
+
63
+ ADRs 放在 `docs/adr/`,顺序编号:`0001-slug.md`、`0002-slug.md`。编号时扫描现有文件取最大号加一。
64
+
65
+ **模板极简**(一条 ADR 可以只有一段):
66
+
67
+ ```md
68
+ # {决策的简短标题}
69
+
70
+ {1-3 句:背景是什么、决定了什么、为什么。}
71
+ ```
72
+
73
+ 价值在于记录**做过这个决策**及其**原因**,而非填满小节。可选小节仅在确有价值时加:`Status` frontmatter(`proposed | accepted | deprecated | superseded by ADR-NNNN`)、Considered Options、Consequences。
74
+
75
+ **仅当以下三条同时成立才提议写 ADR**:
76
+
77
+ 1. **难以逆转**:以后改主意的代价可观。
78
+ 2. **无背景会令人意外**:未来的读者会想「当初为什么这么做?」
79
+ 3. **是真实取舍的结果**:确有替代方案,且有特定理由选中这一个。
80
+
81
+ 缺任何一条就跳过——容易反悔的将来直接反悔即可;不意外的没人会问;没有替代方案的记下来也只是「我们做了显而易见的事」。
82
+
83
+ 典型合格情形:架构形态;上下文间的集成模式;带锁定的技术选型(数据库、消息总线、认证、部署目标);边界与范围决策(显式的「不做」同样有价值);刻意偏离常规路径的做法;代码里看不见的约束;拒绝理由非显然的替代方案。
@@ -0,0 +1,3 @@
1
+ interface:
2
+ display_name: "Domain Modeling"
3
+ short_description: "Build and sharpen a domain model"
@@ -0,0 +1,13 @@
1
+ ---
2
+ name: grill-me
3
+ description: 追问式访谈(grilling)的入口别名,用于把计划或设计压到没有含糊之处。
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Grill Me
8
+
9
+ > 轻量精简版,裁剪自 [mattpocock/skills](https://github.com/mattpocock/skills) 的 grill-me(MIT License, Copyright (c) 2026 Matt Pocock)。若环境已安装同名完整 skill,请优先使用完整版。
10
+
11
+ `grill-me` 只是 `grilling` 的入口别名,本身不含流程。
12
+
13
+ 请改调用 `grilling` skill;若环境未安装,按 `project-docs-workflow/references/deps/grilling.md` 执行。
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: grill-with-docs
3
+ description: 追问式访谈的同时产出文档(ADR 与术语表)。
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Grill with Docs
8
+
9
+ > 轻量精简版,裁剪自 [mattpocock/skills](https://github.com/mattpocock/skills) 的 grill-with-docs(MIT License, Copyright (c) 2026 Matt Pocock)。若环境已安装同名完整 skill,请优先使用完整版。
10
+
11
+ `grill-with-docs` 是一个包装器:把 `grilling` 与 `domain-modeling` 一起跑。
12
+
13
+ - 用 `grilling` 推进设计树、逐轮追问,直到达成共同理解。
14
+ - 同时用 `domain-modeling`:术语确定时当场写入 `CONTEXT.md`;决策满足「难以逆转 / 无背景会意外 / 真实取舍」三条时记录 ADR。
15
+
16
+ 两个流程交织进行:每轮追问中浮现的术语与决策,立刻落成文档。
17
+
18
+ 若环境未安装,按 `project-docs-workflow/references/deps/grilling.md` 与 `project-docs-workflow/references/deps/domain-modeling.md` 执行。
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: grilling
3
+ description: 追问式访谈,把计划、决策或想法压到没有含糊之处。当用户想压力测试自己的思路、或说出任何 "grill" 触发短语时使用。
4
+ ---
5
+
6
+ # Grilling(追问式访谈)
7
+
8
+ > 轻量精简版,裁剪自 [mattpocock/skills](https://github.com/mattpocock/skills) 的 grilling(MIT License, Copyright (c) 2026 Matt Pocock)。若环境已安装同名完整 skill,请优先使用完整版。
9
+
10
+ 持续追问用户,直到双方对方案达成共同理解。把这次访谈建模成一棵**设计树(design tree)**:每个决策都会分叉出依赖它的子决策。
11
+
12
+ ## 按轮次推进
13
+
14
+ **frontier(前沿)** = 所有前置条件已确定的决策:也就是你现在就能问、不必臆测尚未听到的答案的问题。
15
+
16
+ 1. 一轮处理当前 frontier:把 frontier 上的问题**一次性全部提出**。
17
+ 2. 每个问题**编号**,并给出**你推荐的答案**。
18
+ 3. 等用户回答后,再进入下一轮。
19
+
20
+ 轮次格式:
21
+
22
+ ```
23
+ ❓ **Q1** - **<问题标题>**:<问题正文,可多段,可含多选项>
24
+
25
+ ➡️ <你推荐的答案>
26
+
27
+ ---
28
+
29
+ ❓ **Q2** - **<问题标题>**:<问题正文>
30
+
31
+ ➡️ <你推荐的答案>
32
+ ```
33
+
34
+ 用户每一轮的回答会重塑整棵树:已确定的决策把 frontier 向外推,解锁依赖它们的问题。每轮结束都**重新计算 frontier**,再问下一轮。若某问题的答案依赖本轮尚未解决的另一个问题,它属于**后面的轮次**,不属于本轮。
35
+
36
+ ## 事实 vs 决策
37
+
38
+ - **事实是 agent 的活,永远不要问用户。** 当某个 frontier 问题需要环境中的事实(文件系统、工具、外部文档等),派子 agent 去查,不要问用户你本可以自己查的东西。
39
+ - **不要因此阻塞**:一个还在跑的探查本身就是一个未确定的前置条件,所以只有它下游的问题需要等子 agent 回报;frontier 上其余问题现在就问。
40
+ - **决策是用户的活。** 每个决策都摆到用户面前并等待回答,绝不替用户拍板。
41
+
42
+ ## 完成条件
43
+
44
+ 当 frontier 为空——设计树每个分支都走过、没有任何东西被默默假设——本次访谈结束。
45
+
46
+ **在用户确认你们达成了共同理解之前,不要动手实施。**
@@ -0,0 +1,3 @@
1
+ interface:
2
+ display_name: "Grilling"
3
+ short_description: "Stress-test thinking a round of questions at a time"
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: improve-codebase-architecture
3
+ description: 代码库架构改进路线的占位;需要术语或 ADR 支持时转 domain-modeling。
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Improve Codebase Architecture(路径占位)
8
+
9
+ > 轻量精简版,裁剪自 [mattpocock/skills](https://github.com/mattpocock/skills) 的 improve-codebase-architecture(MIT License, Copyright (c) 2026 Matt Pocock)。若环境已安装同名完整 skill,请优先使用完整版。
10
+
11
+ 本 skill 只标出代码库架构改进的路线,不含完整流程。
12
+
13
+ - **目标**:找出「深化模块」的机会(把浅模块变深),提升可测试性与 AI 可导航性。
14
+ - **基础**:建立在领域模型与共享架构词汇(module / interface / depth / seam / adapter / leverage / locality)之上;领域术语来自 `CONTEXT.md`,决策记录在 `docs/adr/`。
15
+ - **无完整流程时**:本技能包不提供扫描与 HTML 报告流程。若环境未安装完整 skill,而你需要术语或 ADR 支持,转 `domain-modeling`(未安装则见 `project-docs-workflow/references/deps/domain-modeling.md`)。
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: project-docs-workflow
3
+ description: Initialize or align a project's documentation workflow — issue tracker, ADRs, PDR product specs (goal/current), recommended five-step development workflow, and domain terminology. Run manually once per project (idempotent); creates missing files and reports alignment without overwriting.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Project Docs Workflow
8
+
9
+ Scaffold and align a project's documentation system: issue tracker, ADRs, PDR product specs, domain terminology, and a recommended five-step development workflow. The skill is the canonical source; init materializes the rules into the target project so agents read them at runtime.
10
+
11
+ Run it manually, once per project — on adoption, or again after the skill's templates evolve to check alignment. Re-runs are idempotent: they create what is missing and report drift, never rewrite existing content.
12
+
13
+ ## Ownership model
14
+
15
+ - **Canonical**: this skill holds the rules (`references/`) and templates (`assets/templates/`).
16
+ - **Materialized**: init copies rules into the target project. Those copies are the runtime source agents read; the skill does not auto-load.
17
+ - **Overrides are legitimate**: projects edit their copies to fit local reality. Init reports the diff, it does not enforce or revert.
18
+ - **Language**: templates default to Chinese; for non-Chinese projects, translate the materialized copies — overrides are legitimate.
19
+ - **Never overwrite**: existing content is compared, never rewritten (one additive exception: the missing `AGENTS.md` block — see checklist).
20
+
21
+ ## 依赖解析(两级)
22
+
23
+ External skill references resolve in two levels:
24
+
25
+ 1. **Invoke the skill by name** — the user has the full version installed, or the bundled lite version ships with the package (canonical names: `grilling`, `domain-modeling`, `tdd`, `deepwork`, `retro`, `doc-opt`, `improve-codebase-architecture`; the full version wins when present).
26
+ 2. **Fallback** — if that skill is absent, follow `references/deps/<name>.md`; `deepwork` / `retro` / `improve-codebase-architecture` share `references/deps/boundaries.md`.
27
+
28
+ Canonical wording (templates use the same line with the deps path parameterized): 调用 `<skill>`(未安装则按 `<deps 路径>/<file>.md` 执行)— skill-internal docs use `references/deps/<file>.md`, materialized project files use `docs/agents/deps/<file>.md`.
29
+
30
+ ## Init procedure
31
+
32
+ Run from the target project root (`cwd`).
33
+
34
+ 1. **Inventory** every artifact in the checklist below. Classify each as *missing* or *existing*. Done when every row has a classification.
35
+ 2. **Create missing** files from their template, and create the issue directory tree.
36
+ 2b. **Fill placeholders**: fill only obvious, determinable *fill-in* placeholders (e.g. project name from the repo/directory name); list every remaining fill-in placeholder under `Next:` in the report. Format notation such as `<标题>` is documentation, not a placeholder — skip it.
37
+ 3. **Compare existing** files against their template: classify *aligned*, or *diff* with the specific differences listed.
38
+ 4. **Report** using the format below.
39
+
40
+ ### Artifact checklist
41
+
42
+ | Artifact | Template |
43
+ | :--- | :--- |
44
+ | `AGENTS.md` → `## Agent skills` block | `assets/templates/project/agents-block.md` |
45
+ | `docs/agents/issues.md` | `assets/templates/project/agents-issues.md` |
46
+ | `docs/agents/domain.md` | `assets/templates/project/agents-domain.md` |
47
+ | `docs/agents/workflow.md` | `assets/templates/project/agents-workflow.md` |
48
+ | `docs/agents/deps/` | `references/deps/*`(整目录复制,不改内容) |
49
+ | `docs/issues/` directory tree | none — create dirs (below) |
50
+ | `docs/adr/README.md` | `assets/templates/project/adr-readme.md` |
51
+ | `docs/pdr/00-README.md` | `assets/templates/project/pdr-00-readme.md` |
52
+ | `CONTEXT.md` | `assets/templates/project/context.md` |
53
+
54
+ - Create `AGENTS.md` only if missing — its whole content is this block; a file containing only this section is intentional (projects add their own guidance around it). If `AGENTS.md` exists: heading `## Agent skills` present → compare the block in place (never edit); absent → append the block at end of file, separated by one blank line. Only `AGENTS.md` is touched, never `CLAUDE.md`.
55
+ - The provenance line sits immediately under the `## Agent skills` heading and is intentional — keep it (it identifies materialized files and their generation).
56
+ - Issue tree: `bug/{human,agent,history}`, `feature/{human,agent,history}`, `chore/{human,agent,history}`, `suggestion/{human,agent}`; add a `.gitkeep` to each leaf directory (one containing no files). Do not run `git init`.
57
+ - Dep fallbacks: init copies `references/deps/*` into the project's `docs/agents/deps/` as a whole-directory copy (content unchanged), so target projects are self-sufficient even without this skill installed.
58
+ - Domain glossaries (e.g. `docs/common/glossary.md`) are **not** scaffolded; the rules cover them and projects create them on demand.
59
+
60
+ ### Alignment comparison (existing files)
61
+
62
+ Compare **rules, not bytes**. An existing file is **aligned** when every required rule/section below is present in recognizable form — wording, language, ordering, formatting and filled-in project content may all differ. Project additions are always fine, never a diff.
63
+
64
+ **diff** = a required rule/section is missing, or a default rule is contradicted. Diffs are informational; init never auto-fixes. One bullet per file: `- <file>: <missing or contradicted rule>`.
65
+
66
+ Ignore in every comparison: the provenance line; filled placeholders; index/table rows; module/term/entry names; language; extra content.
67
+
68
+ Required elements per artifact:
69
+
70
+ - `AGENTS.md` block: `## Agent skills` heading + three subsections (`### Issue tracker`, `### Domain docs`, `### Development workflow`).
71
+ - `docs/agents/issues.md`: directory contract; human/agent responsibility; entry format (`Status:` line, `## 完成判据`, `## 步骤`, `## Log`; the `## 结果` section itself is optional); archiving suffixes (`-done`/`-drop`); suggestion routing.
72
+ - `docs/agents/domain.md`: read CONTEXT.md + docs/adr before exploring; silently continue if missing; glossary vocabulary rule; ADR-conflict flagging.
73
+ - `docs/agents/workflow.md`: recommended five-step flow (规划 / 骨架 / 细节 / 异常 / 回顾 with 回顾 = docs-sync wrap-up); align-before-build ordering; conversational alignment (no freeze); elastic granularity suggestion (≈0.5 人天 heuristic); issue `## 步骤` tracking + resume anchor; PDR goal/current gap→issue derivation; boundaries (deepwork / tdd / retro / grilling 调用 + 兜底指针).
74
+ - `docs/adr/README.md`: lifecycle rules (edit+Log, delete→tombstone stub, no renumber); catalog table present.
75
+ - `docs/pdr/00-README.md`: purpose; 最终目标 / 当前进展 overview sections; module index; reading order.
76
+ - `CONTEXT.md`: glossary structure (term blocks with `_Avoid_`).
77
+ - `docs/issues/` tree: leaf directories exist (`.gitkeep` may be checked); extras informational only.
78
+ - `docs/agents/deps/`: leaf files exist (`grilling.md`, `domain-modeling.md`, `tdd.md`, `doc-opt.md`, `boundaries.md`); extras informational only.
79
+
80
+ ### Report format
81
+
82
+ Write the report in the project's documentation language (default: Chinese, matching the templates).
83
+
84
+ ```
85
+ ## Init report
86
+ - Created: …
87
+ - Aligned: …
88
+ - Diff: one bullet per file: `- <file>: <missing or contradicted rule>`(仅供参考,不自动改;multi-file → multiple bullets)
89
+ - Next: remaining placeholders plus a one-line "do this first".
90
+ ```
91
+
92
+ ## References
93
+
94
+ Rules carry the detail; read the one you need.
95
+
96
+ - `references/issues.md` — issue tracker directory contract, entry format, `suggestion` routing.
97
+ - `references/adr.md` — ADR lifecycle (edit + Log, delete → tombstone stub, reference sweep, catalog index), body shape.
98
+ - `references/pdr.md` — PDR product-spec structure (`00-README` / `01-spec` / `02-interfaces` / `03-nfr` / `04-current` + `design/`), the goal/current & gap→issues layer, PDR↔ADR boundary.
99
+ - `references/terminology.md` — `CONTEXT.md` primary glossary, domain glossary, usage rules.
100
+ - `references/workflow.md` — recommended single-issue development flow (five steps, alignment, granularity, tracking, docs-sync hooks, skill boundaries).
101
+ - `references/coexistence.md` — how this profile sits beside `domain-modeling`, `grilling`, `deepwork`, `tdd`, `retro`, and the bundled `doc-opt`; and how its docs/issues conventions supersede older `.scratch`-style trackers.
102
+ - `references/deps/` — fallback procedures for the two-level resolution: `grilling` / `domain-modeling` / `tdd` / `doc-opt` / `boundaries` (`deepwork` / `retro` / `improve-codebase-architecture` share `boundaries.md`).
103
+
104
+ ## Templates
105
+
106
+ - `assets/templates/project/*` — the files init materializes (Chinese). They carry the provenance marker (current generation: `v2`; in `agents-block.md` it sits just under the `## Agent skills` heading) — keep it; future generations update the marker so stale copies are detectable.
107
+ - `references/deps/*` — fallback procedures when an external skill is absent. init copies the whole directory as-is into the project's `docs/agents/deps/`; they are not materialized templates and carry no provenance marker.
108
+ - `assets/templates/entries/*` — day-to-day authoring aids used when this skill is at hand (copy the skeleton when creating a new entry). NOT materialized by init; the rule docs are self-sufficient without them; materialized docs may reference their path opportunistically.
@@ -0,0 +1,5 @@
1
+ interface:
2
+ display_name: "Project Docs Workflow"
3
+ short_description: "Initialize or align a project's docs workflow"
4
+ policy:
5
+ allow_implicit_invocation: false
@@ -0,0 +1,27 @@
1
+ <!-- 文件名:NNNN-slug.md(4 位零填充,编号永不复用;标题写在下方 H1)。语义修改就地改并在 ## Log 追加一行;删除 = 墓碑桩化。见 docs/adr/README.md。 -->
2
+
3
+ # <决策短标题>
4
+
5
+ <!-- 活跃条目无状态标注。失效时在 H1 之后仅用下列既定集合的标注行,每个退役事件一行、可叠加(不允许自由文本注记;示例,按需替换 XXXX / 日期 / 原因):
6
+ > 已被 ADR-XXXX 取代(2026-10-08):原因
7
+ > 经 ADR-XXXX 修订(2026-10-08):说明
8
+ > 已废弃(2026-10-08):原因
9
+ > 已删除(2026-10-08):原因
10
+ -->
11
+
12
+ <1–3 句:背景是什么、决定了什么、为什么。>
13
+
14
+ 代价:<这次选择付出了什么、放弃了什么;若只是自然选择可省略。>
15
+
16
+ ## Log
17
+
18
+ - YYYY-MM-DD <一句话原因>
19
+
20
+ <!-- 仅语义修改时追加一行;非语义修改(错字 / 格式 / 链接)直接改、无需 Log。无记录可删除本节。 -->
21
+
22
+ <!-- 以下小节仅在有真实价值时保留。 -->
23
+
24
+ ## Considered Options
25
+
26
+ - **<备选 A>**:<为何未选>
27
+ - **<备选 B>**:<为何未选>
@@ -0,0 +1,28 @@
1
+ <!-- 文件名:<项目语言短标题>.md,无编号。归档时改为 …-done.md(完成)/ …-drop.md(放弃)。步骤见 docs/agents/workflow.md。 -->
2
+
3
+ # <短标题>
4
+
5
+ > Status: open|doing|blocked | 责任: human|agent | 创建: YYYY-MM-DD | 关联: ADR-XXXX / 其他条目
6
+
7
+ <背景与目标:问题是什么、为什么要做、预期结果。>
8
+
9
+ ## 完成判据
10
+
11
+ - <可判定的完成条件 1>
12
+ - <可判定的完成条件 2>
13
+
14
+ ## 步骤
15
+
16
+ - [ ] 规划(完成判据与方案已对齐)
17
+ - [ ] 骨架(最小可运行切片 + 证据;纯修复可跳过并注明理由)
18
+ - [ ] 细节(主路径实现与质量)
19
+ - [ ] 异常(失败路径、边界与稳定性)
20
+ - [ ] 回顾(收尾回顾:文档同步)
21
+
22
+ ## 结果(完成后填写,可选)
23
+
24
+ <完成后填写:做了什么、结论、遗留。未完成时可删本节。>
25
+
26
+ ## Log
27
+
28
+ - YYYY-MM-DD <动作 / 进展 / 决定>
@@ -0,0 +1,19 @@
1
+ <!-- 文件名:04-current.md,位于模块根;现状快照(对照 01-spec.md 目标),收尾回顾时更新;≤1 页,只记结论与差距,不写流水账。 -->
2
+
3
+ # <模块> 现状(Current)
4
+
5
+ > 更新:YYYY-MM-DD | 对照:01-spec.md
6
+
7
+ ## 进展概览
8
+
9
+ - 已实现:<FR 或功能块,只记结论>
10
+ - 部分实现:<…>
11
+ - 未实现:<…>
12
+
13
+ ## 与目标的差距
14
+
15
+ - <差距要点(对应 FR-<模块>-NN)>
16
+
17
+ ## 关键结论与已知问题
18
+
19
+ - <结论 / 遗留;指向相关 issue / ADR>
@@ -0,0 +1,28 @@
1
+ <!-- 本模块是这些接口的提供方;消费方引用本文件,不复制定义。权威定义(接口定义文件 / schema / 源)在此登记指针。 -->
2
+
3
+ # <模块> 接口面
4
+
5
+ > 定位:<模块> 对外提供的接口与契约。
6
+
7
+ ## 1. <接口面 / 服务分组>
8
+
9
+ <一句话说明该接口面的职责与边界。>
10
+
11
+ | 方法 / 接口 | 用途 |
12
+ | :--- | :--- |
13
+ | `<Name>` | <用途> |
14
+ | `<Name>` | <用途> |
15
+
16
+ - 关键契约:<幂等、版本、错误语义、鉴权等。>
17
+ - 权威定义:<接口定义文件 / schema / 代码路径>。
18
+ - 待决:<尚未定的点,建议转 issues。>
19
+
20
+ ## 2. <另一接口面>
21
+
22
+ <职责与边界。>
23
+
24
+ | 方法 / 接口 | 用途 |
25
+ | :--- | :--- |
26
+ | … | … |
27
+
28
+ <!-- 只写对外契约,不写内部实现;接口一旦落地,实现变更不得改变此处语义。 -->