@seanyao/roll 3.610.1 → 3.610.2

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 (73) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +5 -5
  3. package/dist/roll.mjs +9115 -11282
  4. package/package.json +3 -1
  5. package/skills/README.md +14 -1
  6. package/skills/docs/skill-authoring.md +66 -0
  7. package/skills/reports/skill-audit-summary.md +53 -0
  8. package/skills/roll-.changelog/SKILL.md +25 -443
  9. package/skills/roll-.changelog/references/full-contract.md +462 -0
  10. package/skills/roll-.clarify/SKILL.md +6 -4
  11. package/skills/roll-.dream/SKILL.md +26 -353
  12. package/skills/roll-.dream/references/full-contract.md +365 -0
  13. package/skills/roll-.echo/SKILL.md +6 -4
  14. package/skills/roll-.qa/SKILL.md +25 -236
  15. package/skills/roll-.qa/references/full-contract.md +256 -0
  16. package/skills/roll-.review/SKILL.md +6 -2
  17. package/skills/roll-brief/SKILL.md +6 -8
  18. package/skills/roll-build/SKILL.md +28 -864
  19. package/skills/roll-build/references/full-contract.md +883 -0
  20. package/skills/roll-debug/SKILL.md +26 -585
  21. package/skills/roll-debug/references/full-contract.md +607 -0
  22. package/skills/roll-design/SKILL.md +28 -903
  23. package/skills/roll-design/references/full-contract.md +923 -0
  24. package/skills/roll-doc/SKILL.md +25 -574
  25. package/skills/roll-doc/references/full-contract.md +594 -0
  26. package/skills/roll-doctor/SKILL.md +21 -2
  27. package/skills/roll-fix/SKILL.md +28 -621
  28. package/skills/roll-fix/references/full-contract.md +640 -0
  29. package/skills/roll-idea/SKILL.md +6 -2
  30. package/skills/roll-loop/SKILL.md +27 -543
  31. package/skills/roll-loop/references/full-contract.md +555 -0
  32. package/skills/roll-notes/SKILL.md +6 -2
  33. package/skills/roll-onboard/SKILL.md +6 -2
  34. package/skills/roll-peer/SKILL.md +27 -316
  35. package/skills/roll-peer/references/full-contract.md +329 -0
  36. package/skills/roll-propose/SKILL.md +6 -8
  37. package/skills/roll-review-pr/SKILL.md +6 -2
  38. package/skills/roll-sentinel/SKILL.md +26 -344
  39. package/skills/roll-sentinel/references/full-contract.md +363 -0
  40. package/skills/roll-spar/SKILL.md +27 -269
  41. package/skills/roll-spar/references/full-contract.md +288 -0
  42. package/skills/route-cases/skills.json +235 -0
  43. package/skills/scripts/audit-skills.mjs +272 -0
  44. package/skills/scripts/test-audit-skills.mjs +39 -0
  45. package/skills/tests/fixtures/skill-audit/block-skill/SKILL.md +12 -0
  46. package/skills/tests/fixtures/skill-audit/minimal-skill/SKILL.md +8 -0
  47. package/skills/tests/fixtures/skill-audit/quoted-skill/SKILL.md +10 -0
  48. package/skills/tests/fixtures/skill-audit/route-cases.json +21 -0
  49. package/skills/tests/fixtures/skill-audit/spoke-skill/SKILL.md +12 -0
  50. package/skills/tests/fixtures/skill-audit/spoke-skill/references/runbook.md +3 -0
  51. package/lib/i18n/slides.sh +0 -3
  52. package/lib/i18n/slides_build.sh +0 -38
  53. package/lib/i18n/slides_delete.sh +0 -19
  54. package/lib/i18n/slides_list.sh +0 -14
  55. package/lib/i18n/slides_logs.sh +0 -12
  56. package/lib/i18n/slides_new.sh +0 -15
  57. package/lib/i18n/slides_preview.sh +0 -14
  58. package/lib/i18n/slides_templates.sh +0 -7
  59. package/lib/slides/components/README.md +0 -123
  60. package/lib/slides/components/cards-2.html +0 -9
  61. package/lib/slides/components/cards-3.html +0 -9
  62. package/lib/slides/components/cards-4.html +0 -9
  63. package/lib/slides/components/compare.html +0 -22
  64. package/lib/slides/components/highlight.html +0 -9
  65. package/lib/slides/components/pipeline.html +0 -12
  66. package/lib/slides/components/plain.html +0 -7
  67. package/lib/slides/components/quote.html +0 -4
  68. package/lib/slides/components/timeline.html +0 -9
  69. package/lib/slides/templates/introduction-v3.html +0 -571
  70. package/lib/slides/templates/pitch.html +0 -0
  71. package/skills/roll-deck/SKILL.md +0 -296
  72. /package/skills/roll-debug/{injectable-bb.js → assets/injectable-bb.js} +0 -0
  73. /package/skills/roll-design/{ENGINEERING_CHECKLIST.md → references/engineering-checklist.md} +0 -0
@@ -2,923 +2,48 @@
2
2
  name: roll-design
3
3
  license: MIT
4
4
  allowed-tools: "Read, Edit, Write, Glob, Grep, Bash(git:*), WebSearch, WebFetch, Skill"
5
- description: Unified entry for discussion, design and planning. Explores options when uncertain, designs solutions with DDD modeling, splits into INVEST-compliant user stories, and writes to .roll/backlog.md. Use when user wants to discuss approaches, design solutions, plan features, or create stories.
5
+ description: "Load when the user wants to discuss approaches, design a solution, model domains, split work into INVEST stories, or write backlog/spec artifacts without coding."
6
6
  ---
7
+ # Roll Design
7
8
 
8
- # Design
9
+ This hub keeps the routing boundary, hard gates, and execution skeleton in the initial context. Load the heavier runbook only when the task actually needs the detailed contract.
9
10
 
10
- > Follows the Architecture Constraints, Development Discipline, and Engineering Common Sense defined in the project AGENTS.md.
11
+ ## Load
11
12
 
12
- Discuss approaches, design architecture, plan requirements, and write to `.roll/backlog.md`. DDD modeling depth scales automatically with input scope.
13
-
14
- ## When to Use
15
-
16
- - Requirements or approach are uncertain and multiple options need to be compared
17
- - Requirements have not yet entered the backlog
18
- - A solution needs to be designed before splitting into Stories
19
- - An existing plan needs to be written into `.roll/backlog.md`
20
-
21
- > **Doc-refresh discipline**: When splitting stories that change user-visible behavior, always append a closing "doc-refresh" story.
22
- > **文档刷新纪律**:拆出的 story 只要改变了用户可见行为,最后必须追加一张"文档刷新"收尾 story。
23
- > See [Doc Update Discipline](#doc-update-discipline) at the bottom of this file for the full rule.
24
-
25
- ## Use This Skill For
26
-
27
- - Approach exploration and comparison (discuss phase)
28
- - New project domain modeling (Event Storming → Context Map → Tactical Model)
29
- - New requirement planning with domain context
30
- - Solution design
31
- - Splitting into Stories
32
- - Creating US / FIX entries
13
+ Load when the user wants to discuss approaches, design a solution, model domains, split work into INVEST stories, or write backlog/spec artifacts without coding.
33
14
 
34
15
  ## When Not to Use
35
16
 
36
- - One-liner capture of ideas or bugs (use `$roll-idea`)
37
- - Executing an already-split US-XXX (use `$roll-build`)
38
- - Fixing a well-defined FIX-XXX (use `$roll-fix`)
39
-
40
- ## Quick Start
41
-
42
- ```bash
43
- # New project from scratch → full DDD modeling
44
- $roll-design "design an e-commerce order system from scratch"
45
-
46
- # Approach is uncertain → discuss first, then plan
47
- $roll-design "What approach should we use for search? Postgres FTS or Meilisearch?"
48
-
49
- # Plan new requirement → domain slice + Stories → write to BACKLOG
50
- $roll-design "user system design"
51
-
52
- # Split Stories from an existing Plan
53
- $roll-design --from-plan .roll/features/auth-plan.md
54
-
55
- # Directly create a Story (auto-detected as User Story → Slice DDD)
56
- $roll-design "user login feature"
57
-
58
- # Non-interactive: read structured input file, skip Clarify/Discuss, write BACKLOG
59
- $roll-design --from-file docs/requirements/auth-req.md
60
-
61
- # Promote IDEA to Story: read BACKLOG IDEA-NNN, produce US-XXX, annotate IDEA
62
- $roll-design --from-idea IDEA-009
63
- ```
64
-
65
- ## DDD Depth Scale
66
-
67
- DDD modeling depth is determined automatically. It is not a switch — it is a dial.
68
-
69
- ```
70
- 输入范围 DDD 深度 产出物
71
- ─────────────────────────────────────────────────────────────
72
- 新项目 / greenfield Full Event Storming (对话引导)
73
- Context Map + UL 词汇表
74
- 每个 Context 的 Tactical Model
75
- → .roll/domain/
76
-
77
- User Story / 新特性 Slice 定位所属 Bounded Context
78
- 关键 Aggregate + 触碰的 Entity/VO
79
- 触发的 Domain Event + 跨域影响
80
- → 写入 US 的 Domain Model 段
81
-
82
- Bug Fix Tag Context > Aggregate > Entity 定位
83
- → 写入 FIX 描述行
84
- ```
85
-
86
- **深度自动判断逻辑**(在 Step 2 Analyze 阶段评估):
87
-
88
- ```
89
- Greenfield 信号(满足任意一条):
90
- - 无 .roll/backlog.md / .roll/domain/ 目录
91
- - 输入含 "从零" / "新项目" / "建模" / "设计整个系统" 关键词
92
- - complexity = large AND 无已有 Bounded Context 文档
93
-
94
- User Story 信号:
95
- - 输入是功能需求 / US-XXX 引用
96
- - complexity = medium or small AND 业务逻辑可见
97
-
98
- Bug Fix 信号:
99
- - 输入是 FIX-XXX / 错误描述 / 明确的问题定位
100
- - 无需建模,只需定位上下文
101
- ```
102
-
103
- ## Workspace Configuration
104
-
105
- Document structure (story-first layout, US-META-005):
106
-
107
- ```
108
- .roll/backlog.md # story index (status + one-liner)
109
- .roll/features/
110
- <epic>/ # epic folder
111
- <feature>.md # feature design doc (optional, multi-story overview)
112
- <feature>-plan.md # design plan (optional)
113
- <story>/ # individual story folder (one per card)
114
- spec.md # story definition (AC, depends-on, etc.)
115
- index.html # auto-generated story portal
116
- delivery/ # attest evidence (auto-generated on Done)
117
- .roll/domain/ # DDD domain model
118
- context-map.md
119
- ubiquitous-language.md
120
- ```
121
-
122
- **Important rules:**
123
- 1. **Every story card gets its own folder**: `features/<epic>/<story>/`
124
- 2. **spec.md is the single definition file** — contains full AC, Files, Dependencies
125
- 3. **FIX / IDEA / US all follow the same folder layout** — `features/<epic>/FIX-097/spec.md`
126
- 4. **Feature design docs stay at epic root** — `<feature>.md` and `<feature>-plan.md` are optional, multi-story design overviews
127
- 5. **index.html is auto-generated** by `roll idea` (skeleton) and updated by `roll attest` (delivery section)
128
- 6. **delivery/ is auto-created** by `roll attest` on Done — do not create manually
129
- 7. .roll/backlog.md only contains index rows (one row per story), **do not write** AC / Files there
130
- 8. Domain model files go in `.roll/domain/`
131
- 9. **Do not** write to `~/.kimi/`, `~/.kimi-code/`, or any global config directory
132
-
133
- **File path resolution:**
134
- 1. Determine epic from story ID prefix (e.g., US-META-* → backlog-lifecycle, FIX-* → query index.json)
135
- 2. Mint the card via the single channel (US-META-009 — never hand-create the folder):
136
- `roll story new <ID> --title "<one-line title>" --epic <epic>`
137
- 3. Then EDIT the minted spec.md to add the full AC / Files / Dependencies / Agent profile
138
- 4. Backlog row links to: `.roll/features/<epic>/<story>/spec.md`
139
- 5. Design / plan docs (when needed): `.roll/features/<epic>/<feature>.md` + `<feature>-plan.md`
140
-
141
- ## Non-Interactive Mode
142
-
143
- Activated by explicit flags or auto-detected high-confidence input. Skips Clarify and Discuss, writes stories directly to BACKLOG as `📋 Todo`, no confirm gate.
144
-
145
- ### `--from-file <path>`
146
-
147
- ```
148
- Input: structured requirement file (plain text or markdown)
149
-
150
- Expected file contents (minimum viable):
151
- - Description: what to build (1–3 sentences)
152
- - Expected AC: measurable outcomes (bullet list)
153
- - [Optional] Domain hint, priority, dependencies
154
-
155
- Execution path:
156
- [Read file] → [Analyze] → [DDD Slice] → [Solution Design] → [Split Stories]
157
- → [Write BACKLOG 📋 Todo] → Done (no Clarify, no Discuss, no confirm gate)
158
- ```
159
-
160
- Input file example (`docs/requirements/auth-req.md`):
161
- ```markdown
162
- ## Requirement: session timeout warning
163
-
164
- Description: Show a countdown modal 60 seconds before session expires.
165
- Users can click "Stay logged in" to extend, or let it expire naturally.
166
-
167
- Expected AC:
168
- - Modal appears at T-60s with countdown timer
169
- - "Stay logged in" sends a keepalive and dismisses modal
170
- - Expiry after countdown logs user out and redirects to /login
171
- - Works across all authenticated pages
172
- ```
173
-
174
- ### `--from-idea IDEA-NNN`
175
-
176
- ```
177
- Input: IDEA-NNN identifier from .roll/backlog.md
178
-
179
- Execution path:
180
- [Read .roll/backlog.md IDEA-NNN row] → [Analyze] → [DDD Slice] → [Split Stories]
181
- → [Write BACKLOG 📋 Todo] → [Annotate IDEA row: → US-XXX] → Done
182
-
183
- IDEA annotation: append `→ US-XXX` to the IDEA row's Description column.
184
- Example: | IDEA-009 | ... | ✅ Done → US-AUTO-021 |
185
- ```
186
-
187
- ### High-Confidence Auto-Detection
188
-
189
- When input is not a flag-based mode but already contains all three of: **clear verb**, **explicit scope**, and **verifiable acceptance signal**, skip Clarify automatically. At most retain Discuss (only if approach has genuine divergence).
190
-
191
- High-confidence signals (all three must be present):
192
- - Clear verb: add / remove / fix / rename / migrate / split / extract / support ...
193
- - Explicit scope: named file, command, module, endpoint, or UI element
194
- - Acceptance signal: "so that X", "when Y then Z", measurable outcome described
195
-
196
- Examples:
197
- ```bash
198
- # High confidence — skip Clarify:
199
- $roll-design "add --dry-run flag to roll loop on that prints plist without installing"
200
- $roll-design "rename cmd_status() to cmd_overview() in bin/roll and update all callers"
201
-
202
- # Low confidence — enter Clarify:
203
- $roll-design "improve the status command"
204
- $roll-design "make loop better"
205
- ```
206
-
207
- ---
208
-
209
- ## Workflow
210
-
211
- ```
212
- User Input
213
-
214
- ├── --from-file <path> ──→ [Read file] → Step 2 (Analyze) → Steps 3–5 → BACKLOG 📋 → Done
215
- ├── --from-idea IDEA-N ──→ [Read BACKLOG IDEA] → Step 2 → Steps 3–5 → BACKLOG 📋 → Annotate IDEA → Done
216
- ├── high-confidence str ──→ Step 2 (Analyze) directly (skip Clarify, keep Discuss if divergence)
217
-
218
-
219
- ┌─────────────────────────────┐
220
- │ 0. Clarify (when vague) │ ← Automatically triggered when input is under-specified
221
- │ - Summarize intent │
222
- │ - Assess complexity │
223
- │ - Ask 3–5 targeted Qs │
224
- │ - Wait for user reply │
225
- └─────────────┬───────────────┘
226
- │ Intent clear
227
-
228
- ┌─────────────────────────────┐
229
- │ 1. Discuss (when uncertain) │ ← Automatically triggered when approach is uncertain
230
- │ - List 2-4 viable options │
231
- │ - Each: approach + pros/cons │
232
- │ - Comparison matrix │
233
- │ - Recommendation + rationale │
234
- │ - Human makes final decision │
235
- └─────────────┬───────────────┘
236
- │ Approach confirmed
237
-
238
- ┌─────────────────────────────┐
239
- │ [peer] Direction Review │ ← if complexity=medium/large or cross-context; 10s opt-out
240
- │ Skill("roll-peer", │
241
- │ tag="architecture") │
242
- └─────────────┬───────────────┘
243
- │ AGREE / skipped
244
-
245
- ┌─────────────────────────────┐
246
- │ 2. Analyze + DDD Depth │ ← Detect scope: Greenfield / Story / Fix
247
- │ - Requirement analysis │
248
- │ - Feasibility assessment │
249
- │ - DDD depth determination │
250
- └──────┬──────────────────────┘
251
-
252
- ├── Greenfield ──→ ┌─────────────────────────────┐
253
- │ │ 2a. Event Storming (对话引导) │
254
- │ │ Big Picture: │
255
- │ │ - 发现 Domain Events │
256
- │ │ - 识别 Actors / Commands │
257
- │ │ - 标记 Hot Spots │
258
- │ │ Process Level: │
259
- │ │ - Command→Event→Policy 链 │
260
- │ │ - 识别 Bounded Context 边界│
261
- │ │ Design Level: │
262
- │ │ - Aggregate 候选 │
263
- │ │ - Entity vs Value Object │
264
- │ └──────────────┬──────────────┘
265
- │ │
266
- │ ┌──────────────▼──────────────┐
267
- │ │ 2b. Strategic Design │
268
- │ │ - Bounded Contexts 定义 │
269
- │ │ - Context Map (关系类型) │
270
- │ │ - Ubiquitous Language 词汇表│
271
- │ │ → .roll/domain/context-map.md│
272
- │ │ → .roll/domain/ubiquitous- │
273
- │ │ language.md │
274
- │ └──────────────┬──────────────┘
275
- │ │
276
- ├── User Story ──→ ┌──────────────▼──────────────┐
277
- │ │ 2c. Domain Slice │
278
- │ │ - 定位所属 Bounded Context │
279
- │ │ - 识别关键 Aggregate │
280
- │ │ - 触碰的 Entity / VO │
281
- │ │ - 触发的 Domain Events │
282
- │ │ - 跨域影响(如有) │
283
- │ └──────────────┬──────────────┘
284
- │ │
285
- └── Bug Fix ─────→ ┌──────────────▼──────────────┐
286
- │ 2d. Domain Tag │
287
- │ - Context > Aggregate > │
288
- │ Entity 定位 │
289
- └──────────────┬──────────────┘
290
-
291
-
292
- ┌─────────────────────────────────────────┐
293
- │ 3. Solution Design │
294
- │ - Architecture design │
295
- │ - Module decomposition │
296
- │ - Dependency analysis │
297
- │ [Greenfield] Tactical Model per Context:
298
- │ - Aggregate Root + Entities + VOs │
299
- │ - Invariants (业务不变式) │
300
- │ - Domain Events (触发条件 + 消费方) │
301
- │ - Repository interfaces │
302
- │ - Domain Services (跨 Aggregate) │
303
- │ → .roll/features/<feature>-plan.md │
304
- │ [Greenfield] → .roll/domain/<ctx>- │
305
- │ model.md │
306
- └──────────────────┬──────────────────────┘
307
-
308
-
309
- ┌─────────────────────────────────────────┐
310
- │ [peer] Plan Review │ ← if complexity=medium/large; 10s opt-out
311
- │ Skill("roll-peer", tag="architecture")│
312
- └──────────────────┬──────────────────────┘
313
- │ AGREE / skipped
314
-
315
- ┌─────────────────────────────────────────┐
316
- │ 4. Split into Stories │
317
- │ - INVEST principles │
318
- │ - Bounded Context → US domain prefix │
319
- │ - Priority ordering │
320
- │ - **强制检查**: 若本批次任一 US 改了 │
321
- │ 用户可见行为(CLI 输出 / 命令参数 / │
322
- │ 状态语义 / 错误提示),必须在末尾追加 │
323
- │ 一张 doc-refresh 收尾 story │
324
- │ (详见 Doc Update Discipline 一节)│
325
- └──────────────────┬──────────────────────┘
326
-
327
-
328
- ┌─────────────────────────────────────────┐
329
- │ 5. Write to .roll/backlog.md │
330
- │ - Create US-XXX │
331
- │ - Define AC │
332
- │ - Link design documents │
333
- └──────────────────┬──────────────────────┘
334
-
335
-
336
- "Confirm and execute?"
337
-
338
- ├── Yes ──→ $roll-build US-XXX
339
-
340
- └── No ──→ Story 已写入 BACKLOG 为 📋 Todo
341
- loop 下轮将自动执行
342
- (选 No 仅跳过立即执行)
343
- ```
344
-
345
- **Gate 语义澄清**:选 `No` 不是放弃,story 已经入 BACKLOG,下轮 loop 会自动 pickup
346
- (次日 / `roll loop now`)。若想完全搁置,请显式把状态改为 🚫 Hold。
347
-
348
- ---
349
-
350
- ## DDD Output Formats
351
-
352
- ### Event Storming — Big Picture (对话引导)
353
-
354
- AI 扮演引导人,按顺序提问,不跳步骤:
355
-
356
- ```
357
- Step 1 - 发现 Domain Events:
358
- "请描述这个系统里会发生的重要事情,用过去式动词短语
359
- (例如:订单已创建、支付已完成、库存已扣减)"
360
-
361
- Step 2 - 识别触发者:
362
- "每个事件是谁/什么触发的?
363
- (用户操作 / 系统自动 / 定时任务 / 外部系统)"
364
-
365
- Step 3 - 标记 Hot Spots:
366
- "哪些地方你还不确定?有哪些业务规则有争议?
367
- (标记为 ⚠️ Hot Spot,后续重点讨论)"
368
- ```
369
-
370
- 输出格式(Big Picture 阶段结果):
371
-
372
- ```
373
- Domain Events discovered:
374
- [OrderPlaced] ← Customer (user action)
375
- [PaymentCompleted] ← Payment Gateway (external)
376
- [InventoryReserved] ← System (automatic, after OrderPlaced)
377
- [OrderShipped] ← Warehouse Staff (user action)
378
-
379
- Hot Spots ⚠️:
380
- - 支付失败后如何回滚库存预留?
381
- - 同一商品多仓库时库存扣减策略?
382
- ```
383
-
384
- ### Event Storming — Process Level
385
-
386
- ```
387
- Step 4 - Command→Event 链:
388
- "把事件串成流程:什么命令触发了它?
389
- 触发后系统自动做什么(Policy)?"
390
-
391
- Step 5 - 识别 Bounded Context 边界:
392
- "哪些事件自然聚集在一起?
393
- 哪些事件之间有明显的组织边界或团队边界?"
394
- ```
395
-
396
- 输出格式(Process Level 阶段结果):
397
-
398
- ```
399
- Flow: Order Lifecycle
400
- [PlaceOrder] ──→ (Order) ──→ [OrderPlaced]
401
- │ Policy: reserve inventory
402
-
403
- (Inventory) ──→ [InventoryReserved]
404
- │ Policy: request payment
405
-
406
- (Payment) ──→ [PaymentCompleted]
407
-
408
- Candidate Bounded Contexts:
409
- - Order Context (OrderPlaced, OrderShipped, OrderCancelled)
410
- - Inventory Context (InventoryReserved, InventoryReleased)
411
- - Payment Context (PaymentCompleted, PaymentFailed)
412
- ```
413
-
414
- ### Strategic Design Output
415
-
416
- 写入 `.roll/domain/context-map.md`:
417
-
418
- ```markdown
419
- ## Bounded Contexts
420
-
421
- | Context | 职责边界 | 核心概念 |
422
- |---------|---------|---------|
423
- | Order | 订单生命周期管理 | Order, OrderItem, Customer |
424
- | Inventory | 库存预留与释放 | Stock, Reservation, Warehouse |
425
- | Payment | 支付处理与退款 | Payment, Refund, Transaction |
426
-
427
- ## Context Map
428
-
429
- Order ═══U/D═══→ Inventory (Customer-Supplier: Order 下游消费库存事件)
430
- Order ═══U/D═══→ Payment (Customer-Supplier: Order 发起支付请求)
431
- Payment ──ACL──→ Alipay (Anti-Corruption Layer: 防腐层隔离第三方)
432
- ```
433
-
434
- 写入 `.roll/domain/ubiquitous-language.md`:
435
-
436
- ```markdown
437
- | 术语 | 定义 | 所属 Context | 注意事项 |
438
- |-----|------|-------------|---------|
439
- | Order | 买家提交的购买意向,包含商品列表和配送信息 | Order | 不等于"交易",交易在 Payment Context |
440
- | Reservation | 为订单锁定的库存数量,有时效 | Inventory | 区别于 Allocation(正式分配) |
441
- ```
442
-
443
- Context Map 关系类型说明:
444
-
445
- ```
446
- ═══U/D═══→ Customer-Supplier (上下游依赖)
447
- ───ACL───→ Anti-Corruption Layer (防腐层)
448
- ═══PL════ Partnership (平等协作)
449
- ───SK─── Shared Kernel (共享内核)
450
- ───CF───→ Conformist (顺从者)
451
- ───OHS──→ Open Host Service (开放主机)
452
- ```
453
-
454
- ### Tactical Model Output
455
-
456
- 写入 `.roll/domain/<context>-model.md`:
457
-
458
- ```markdown
459
- ## Tactical Model: Order Context
460
-
461
- ### Aggregates
462
-
463
- **Order** (Aggregate Root)
464
- Entities: OrderItem
465
- Value Objects: Address, Money, OrderStatus
466
- Invariants:
467
- - 订单金额 = sum(OrderItem.price × quantity)
468
- - 已支付订单不可修改商品列表
469
- - OrderItem 数量必须 > 0
470
-
471
- ### Domain Events
472
-
473
- | Event | 触发条件 | 消费方 | Payload |
474
- |-------|---------|-------|---------|
475
- | OrderPlaced | Order.place() 成功 | Inventory Context | orderId, items, customerId |
476
- | OrderCancelled | Order.cancel() | Inventory Context, Payment Context | orderId, reason |
477
-
478
- ### Repository Interfaces
479
-
480
- IOrderRepository:
481
- - findById(orderId): Order
482
- - save(order): void
483
- - findByCustomer(customerId, page): Order[]
484
-
485
- ### Domain Services
486
-
487
- OrderPricingService:
488
- - 职责: 跨 PriceRule Aggregate 计算最终价格(含优惠券、会员折扣)
489
- - 原因: 定价逻辑跨越多个 Aggregate,不归属任何单一 Root
490
- ```
491
-
492
- ### Domain Slice Output(User Story 级别)
493
-
494
- 插入 US 的 Domain Model 段(见 Story Format):
495
-
496
- ```markdown
497
- **Domain Model:**
498
- - Context: Order
499
- - Aggregate: Order (Root) owns [OrderItem, Address]
500
- - Entities touched: OrderItem (新增/修改)
501
- - Events raised: [OrderItemUpdated] → Inventory Context
502
- - Cross-context: Inventory Context 需同步更新预留数量
503
- ```
504
-
505
- ### Domain Tag Output(Bug Fix 级别)
506
-
507
- 写入 FIX 描述的第一行:
508
-
509
- ```
510
- Domain: Order Context > Order Aggregate > OrderItem Entity
511
- ```
512
-
513
- ### AGENTS.md Where to Look — 指针维护
514
-
515
- After completing any Domain Slice (User Story level), check if the project's `AGENTS.md` has a `## Where to Look` section with a `.roll/domain/` pointer. If missing, append one line:
516
-
517
- ```markdown
518
- - **Domain model**: `.roll/domain/context-map.md` — Bounded Contexts and relationships
519
- ```
520
-
521
- Rules:
522
- - Idempotent: only append if the pointer line is not already present
523
- - Do not modify any other content in AGENTS.md
524
- - Skip silently if `.roll/domain/` does not yet exist for this project
525
-
526
- ---
527
-
528
- ## Clarify Phase
529
-
530
- **Skip conditions** — silently skip Clarify when any of these hold:
531
- - Input uses `--from-file` or `--from-idea` flag (non-interactive mode)
532
- - Input is high-confidence (clear verb + explicit scope + acceptance signal — see Non-Interactive Mode)
533
-
534
- **Trigger conditions** — automatically enters if none of the skip conditions hold AND any of these are met:
535
- - Input is a single vague sentence without clear scope
536
- - Missing clear boundaries (what / who / when / where)
537
- - Contains ambiguous terms like "优化一下", "改一下", "加个东西", "做个设计"
538
- - Could be interpreted in multiple ways
539
-
540
- **Pre-Clarify: three-step product localization (always run first, silently)**
17
+ - Existing US implementation; load roll-build.
18
+ - Narrow bug repair; load roll-fix.
541
19
 
542
- Before listing questions, internally determine:
543
- 1. **产品端 (product end)**: web / mobile / API / CLI / other — which surface does this touch?
544
- 2. **角色 (role)**: who initiates this action? (end user / admin / system / external)
545
- 3. **业务域 (domain)**: which business domain does this belong to?
20
+ ## Read On Demand
546
21
 
547
- Already-localized dimensions become context prefix in the output, not open questions.
22
+ - Read [the full contract](references/full-contract.md) before executing the workflow end to end, recovering from failures, or checking exact output templates.
23
+ - Read [engineering checklist](references/engineering-checklist.md) when validating design output quality.
24
+ - Keep this hub in context for trigger boundaries and hard gates.
548
25
 
549
- **Output format:**
550
-
551
- ```
552
- 🎯 Clarified Intent: {1-2 sentences}
553
- 🗺 Context: {product end} · {role} · {domain} ← omit if all three are unknown
554
-
555
- 📏 Complexity: {small|medium|large}
556
-
557
- ❓ Open Questions:
558
- 1. {question 1}
559
- 2. {question 2}
560
- 3. {question 3}
561
- ...
562
-
563
- ➡️ Please answer the questions above and I'll proceed to design.
564
- ```
565
-
566
- **Rules:**
567
- - Do **not** start designing until the user replies.
568
- - Never announce "I'm using clarify." Just do it naturally.
569
- - If the input is already clear enough, skip silently and proceed to Discuss or Analyze.
570
-
571
- ---
572
-
573
- ## Discuss Phase
574
-
575
- **Trigger conditions** — automatically enters if any of these are met:
576
- - User is explicitly asking "how to choose" or "what approach to use"
577
- - More than 2 viable technical paths exist
578
- - Requirement involves an unfamiliar tech stack or new domain
579
-
580
- ### How to Conduct the Discussion
581
-
582
- Discuss is **multi-turn by default**. The goal is to reach clarity together, not to produce a complete comparison matrix in one shot.
583
-
584
- **Step 1 — Understand before proposing**
585
-
586
- Before listing options, make sure the core problem is clear. If context is thin, ask 1–2 focused questions first:
587
-
588
- ```
589
- Before I lay out the options — can you tell me [specific constraint / scale / existing system boundary]?
590
- ```
591
-
592
- Only skip this if the context is already rich enough to reason from.
593
-
594
- **Step 2 — Offer an opinionated starting point, not a menu**
595
-
596
- Don't dump 4 options at once. Lead with a concrete recommendation and the key tradeoff:
597
-
598
- ```
599
- My read: go with X. The main tradeoff is [Y vs Z]. Want me to walk through why, or should I compare against [alternative] first?
600
- ```
601
-
602
- Then wait. Let the user redirect.
603
-
604
- **Step 3 — Follow the thread**
605
-
606
- If the user wants to dig into a specific option or challenge an assumption, stay on that thread. Don't pivot back to the full comparison until the current thread is resolved.
607
-
608
- **Step 4 — Surface hidden assumptions explicitly**
609
-
610
- When a direction starts to crystallize, name the assumptions holding it up:
611
-
612
- ```
613
- This only holds if [assumption]. Is that true for your situation?
614
- ```
615
-
616
- **Step 5 — Name convergence before triggering the gate**
617
-
618
- When the discussion reaches a clear conclusion, summarize it explicitly before asking to proceed:
619
-
620
- ```
621
- Looks like we've landed on: [decision]. The key reasons: [1–2 points].
622
- ```
623
-
624
- Then trigger the gate.
625
-
626
- **Gate rule** — after convergence is named, always end with this explicit prompt and **wait for user reply before proceeding**:
627
-
628
- ```
629
- ➡️ Continue to solution design, or keep exploring?
630
- ```
631
-
632
- Do **not** infer "approach confirmed" from the user's reaction to the comparison. Only proceed to Step 2 (Analyze) when the user explicitly says to continue (e.g., "yes", "proceed", "go ahead", "design it").
633
-
634
- **Can stop at any time** — if after discussion the user says "let's not do it" or "let me think about it", there's no need to continue to the planning phase.
635
-
636
- ---
637
-
638
- ## Operation Sequence for Creating a New Story
639
-
640
- ```bash
641
- # 1. Determine Feature ownership (e.g., compiler / ingest / qa)
642
- FEATURE="compiler"
643
-
644
- # 2. Write Plan document (if there is a solution design)
645
- PLAN_FILE=".roll/features/${EPIC}/${FEATURE}-plan.md"
646
-
647
- # 3. Write story spec: .roll/features/<epic>/<story>/spec.md (full AC)
648
- # Story specs: .roll/features/<epic>/<story>/spec.md
649
-
650
- # 4. Append index row under the corresponding Epic > Feature group in .roll/backlog.md
651
- # | [US-XXX](.roll/features/compiler.md#us-xxx) | One-line description | 📋 Todo |
652
-
653
- # 5. [Greenfield only] Write domain model files
654
- DOMAIN_DIR=".roll/domain/"
655
- # .roll/domain/context-map.md
656
- # .roll/domain/ubiquitous-language.md
657
- # .roll/domain/<context>-model.md
658
- ```
659
-
660
- ---
661
-
662
- ## Story Format
663
-
664
- **.roll/backlog.md index row (only write this one line):**
665
-
666
- ```markdown
667
- | [US-{DOMAIN}-{N}](.roll/features/<epic>/US-{DOMAIN}-{N}/spec.md) | {one-line description} | 📋 Todo |
668
- ```
669
-
670
- `{one-line description}` 写法:用户能读懂的一句话,说清楚"能做什么"或"解决了什么麻烦"。不写实现细节、文件路径、函数名。细节和 AC 写在 `.roll/features/` 里。写好了可以直接当 CHANGELOG 条目用。
671
-
672
- Note: `{DOMAIN}` maps to the Bounded Context name identified in DDD analysis.
673
-
674
- **US section in .roll/features/\<feature\>.md (full details):**
675
-
676
- ```markdown
677
- <a id="us-{domain}-{n}"></a>
678
- ## US-{DOMAIN}-{N} {Story Title} 📋
679
-
680
- **Created**: {YYYY-MM-DD}
681
- **Plan**: [{feature}-plan.md]({feature}-plan.md) ← if a design document exists
682
-
683
- - As a {role}
684
- - I want {action}
685
- - So that {benefit}
686
-
687
- **Domain Model:**
688
- - Context: {Bounded Context name}
689
- - Aggregate: {Root} owns [{entities}]
690
- - Events raised: [{EventName}] → {consumer context}
691
- - Cross-context: {if touches another context, otherwise omit}
692
-
693
- **Agent profile:**
694
- - est_min: {1-30 整数;一个 Story ≈ 一个 AI cycle 闭环,目标 5-10 min。这是**唯一的 loop 路由输入**——`lib/loop_pick_agent.py` 把 est_min 映射到复杂度档:≤8 → easy,8<x≤20 → default,>20 → hard;缺失/非法值 → default。est > ~15 是"再拆"信号——除非原子不可分(见 INVEST 的 S/I 校准)}
695
- - risk_zone: {low / medium / high — 改文档 low,改用户可见行为 medium,改 loop infra 或安全/隔离基建 high。**不参与 loop 路由**(路由只看 est_min);仅供 roll-build / roll-fix 的 pre-flight 自评(US-AGENT-007)做能力匹配参考}
696
- - chain_depth: 0 {若是自降级产出的子 story 则 +1,累计 ≥2 时第 3 次拒拆}
697
-
698
- **AC:**
699
- - [ ] {measurable criteria 1}
700
- - [ ] {measurable criteria 2}
701
- - [ ] {measurable criteria 3}
702
-
703
- **Files:**
704
- - `{file1}`
705
- - `{file2}`
706
-
707
- **Dependencies:**
708
- - Depends on: {prerequisite US-XXX}
709
- - Depended on by: {subsequent US-XXX}
710
-
711
- **Data Flow (if applicable):**
712
- - Producer: {which module writes data}
713
- - Consumer: {which module reads data}
714
- - Integration test: `tests/integration/{flow}.test.ts`
715
- ```
716
-
717
- > **强制规则 — Agent profile 必须填**:Split into Stories 步骤产出的每个 US 都必须带 `**Agent profile:**` 子段。`est_min` 是 **loop 路由唯一输入**(`lib/loop_pick_agent.py` 的四槽复杂度路由 easy/default/hard/fallback,按 est_min 单轴决档;缺失/非法 → default 档)——务必填准。`risk_zone` 仍要填,但**不参与路由**,只供 roll-build / roll-fix 的 pre-flight 自评(US-AGENT-007)参考;`chain_depth` 默认 0。历史 US 不强制回填。
718
- >
719
- > **MUST fill** the `**Agent profile:**` block on every newly split US. `est_min` is the **sole loop-routing input** — `lib/loop_pick_agent.py` maps it onto a four-slot complexity tier (easy/default/hard/fallback) on the est_min axis alone (missing/illegal → default). Fill `risk_zone` too, but note it does NOT feed routing; it only informs the roll-build / roll-fix pre-flight self-eval (US-AGENT-007).
720
-
721
- ### Closing Doc-Refresh Story Template — Phase N.M 收尾文档
722
-
723
- When any preceding US in the batch changes user-visible behavior, append this template story at the end of the batch. Wire it as `depends-on:` against every preceding user-facing US so it runs last.
724
-
725
- ```markdown
726
- <a id="us-{domain}-{n}"></a>
727
- ## US-{DOMAIN}-{N} Phase {N.M} 用户文档刷新(中英双轨) 📋
728
-
729
- **Created**: {YYYY-MM-DD}
730
-
731
- - As a roll user reading the docs
732
- - I want the user-facing documentation to match the new behavior shipped in this Phase
733
- - So that the next person reading the guide / README / `--help` does not hit a stale version
734
-
735
- **AC:**
736
- - [ ] Update each affected doc file listed below; **English line and Chinese line on separate lines**, never inline
737
- - [ ] `roll <cmd> --help` output reflects new flags / commands / status semantics (paste verified output)
738
- - [ ] README index links to any new guide pages
739
- - [ ] Error-message changes are mirrored in troubleshooting / FAQ sections
740
- - [ ] Verified: no doc page still describes the pre-Phase behavior
741
-
742
- **Files:**
743
- - `guide/en/{topic}.md`
744
- - `guide/zh/{topic}.md`
745
- - `README.md` (index entry)
746
- - `{any other user-facing doc touched by the Phase}`
747
-
748
- **Dependencies:**
749
- - Depends on: {every preceding user-facing US in this batch}
750
- - Worked example: 参考 `features/authoring/slide-deck-generator.md` 的 US-DECK-015 ——
751
- roll slides Phase 1.5 把 6 张 user-visible US 末尾合并成一张 doc-refresh story 的范例。
752
- ```
753
-
754
- ---
755
-
756
- ## INVEST Principles
757
-
758
- > **颗粒度校准(按 AI cycle 量纲)**:Roll 的 Story 不是"几天的活",而是
759
- > **一个 AI cycle 闭环(目标 5–10 min)**。下面的 S 和 I 按这个量纲重定义,
760
- > 别套用传统敏捷"一个 sprint 装几个 story"的尺度。
761
-
762
- Each story must be:
763
- - **Independent**: 不强求完全独立。有先后依赖就用 `depends-on:` 串成链(配合
764
- `chain_depth ≤ 2` 防无限套娃)。真正要避免的是"改同一文件的并行冲突",
765
- 而不是"禁止依赖"——为追求独立硬把一个 cycle 的活摊成几个反而更糟。
766
- - **Negotiable**: Scope is negotiable
767
- - **Valuable**: Provides value to the user
768
- - **Estimable**: Effort can be estimated
769
- - **Small**: **一个 Story ≈ 一个 AI cycle 闭环(目标 5–10 min)**。S 是 cycle 量纲,
770
- 装不进一个 cycle 就拆;`est_min > ~15` 是"再拆"信号——除非原子不可分。
771
- - **Testable**: Can be tested and verified
772
-
773
- ## Backlog Structure
774
-
775
- ```markdown
776
- # Project Backlog
777
-
778
- ## Epic Name
779
- ### Feature Name
780
- | Story | Description | Status |
781
- |-------|-------------|--------|
782
- | [US-XXX](.roll/features/<epic>/<story>/spec.md#us-xxx) | One-line description | 📋 Todo |
783
- | [US-YYY](.roll/features/<epic>/<story>/spec.md#us-yyy) | One-line description | ✅ Done |
784
- ```
785
-
786
- **Note**: .roll/backlog.md only contains index rows; full AC / Files / Dependencies go in `.roll/features/<epic>/<story>/spec.md`.
787
-
788
- ---
789
-
790
- ## Self-score (US-SKILL-010 / 013)
791
-
792
- After Step 5 (Write to BACKLOG) completes — i.e. once the new US rows are
793
- landed and the user has either confirmed or chosen `No` (story still
794
- queued) — write a single self-score note covering the design session:
795
-
796
- ```bash
797
- bash -c 'source "$(command -v roll)"; \
798
- _skill_write_self_score roll-design US-XXX-NNN <score 1..10> <good|ok|regression> "<rationale>"'
799
- ```
800
-
801
- Use the **first** US-id of the batch as the story handle (or the
802
- representative story when splitting). The note lands under
803
- `.roll/notes/<date>-roll-design-<id>-<epoch>.md` so US-SKILL-014 can
804
- read trend data.
805
-
806
- Score guidance for design quality (integer 1..10):
807
- - **9..10** — clean split: every US is INVEST-compliant, profile
808
- (est_min / risk_zone / chain_depth) filled, doc-refresh closer wired
809
- when user-visible behaviour changed, peer-review unnecessary or
810
- reached AGREE quickly.
811
- - **6..8** — split shipped but with caveats: one US borderline on
812
- INVEST (e.g. shared file conflict), or Discuss had ESCALATE before
813
- settling, or profile was partial.
814
- - **1..5** — split shipped but rough: missing doc-refresh closer,
815
- profile fields skipped, USer story too coarse for AI cycle; flag a
816
- follow-up `roll-design` pass.
817
-
818
- Verdict values:
819
- - `good` — design + split are clean.
820
- - `ok` — design is acceptable with one or two trade-offs noted.
821
- - `regression` — the split visibly broke something earlier (rare; e.g.
822
- invalidated a previously-stable depends-on chain).
823
-
824
- ---
825
-
826
- ## Integration
827
-
828
- ### With roll-build
829
-
830
- ```
831
- $roll-design "login feature" → Create US-AUTH-001
832
- User: "Execute US-AUTH-001"
833
-
834
- $roll-build US-AUTH-001 → TCR → CI/CD → Deploy
835
- ```
836
-
837
- ### With roll-fix
838
-
839
- ```
840
- $roll-debug discovers issue → Suggest creating FIX
841
- $roll-design "fix login API 404" → Create FIX-AUTH-001 ← auto-detected as Bug Fix
842
- $roll-fix FIX-AUTH-001 → Quick fix
843
- ```
844
-
845
- ### With roll-peer
846
-
847
- Two checkpoints, both with 10s opt-out:
848
-
849
- ```
850
- 1. After Discuss — Direction Review
851
- Approach confirmed → [peer, tag=architecture] → challenge the direction before DDD
852
- Trigger: complexity=medium OR complexity=large OR requirement touches multiple Bounded Contexts
853
-
854
- 2. After Solution Design — Plan Review
855
- Plan written → [peer, tag=architecture] → full plan review before story split
856
- Trigger: complexity=medium OR complexity=large (greenfield always qualifies)
857
- ```
858
-
859
- Rationale (US-SKILL-018): medium-complexity designs also routinely carry
860
- direction/plan risks worth one independent challenge before story split — the
861
- cost of one bounded peer pass is small next to reworking a misaimed design after
862
- it ships. So peer now triggers at medium as well as large; the 10s opt-out
863
- stays, so you can always skip when you're confident.
864
-
865
- On AGREE or user skip → continue to the next step normally.
866
- On REFINE/OBJECT → incorporate feedback, regenerate the relevant output, re-trigger peer.
867
- On ESCALATE → present both proposals to user for final call.
868
-
869
- ---
870
-
871
- ## Project Context Rule
872
-
873
- Before creating any file or directory:
874
-
875
- 1. **Read existing project structure** — check for `package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`, existing `src/`, `api/`, `cmd/` directories
876
- 2. **Check existing domain model** — if `.roll/domain/` exists, read `context-map.md` before adding new Bounded Contexts
877
- 3. **Infer conventions from evidence** — don't assume a project type; observe what already exists
878
- 4. **Follow what already exists** — introduce new patterns only when the current structure has no precedent
879
-
880
- > `roll init` no longer asks for project type. Skills are responsible for reading context and acting accordingly.
881
-
882
- ---
26
+ ## Workflow Skeleton
883
27
 
884
- <a id="doc-update-discipline"></a>
885
- ## Doc Update Discipline
28
+ 1. Clarify only when intent or boundaries are unclear.
29
+ 2. Model domain depth proportional to risk and novelty.
30
+ 3. Split into INVEST stories with acceptance criteria and dependencies.
31
+ 4. Write specs through roll story new and update backlog.
32
+ 5. Self-score the design quality.
886
33
 
887
- When `$roll-design` splits a feature into stories, **the closing tasking step is
888
- always a doc-refresh story whenever any preceding US changes user-visible
889
- behavior**. This is mandatory, not optional — without it, code ships and the
890
- docs silently drift to the previous version, and only the next user to read the
891
- guide notices.
34
+ ## Hard Gates
892
35
 
893
- **When a separate doc-refresh story IS required (任一为真即触发):**
894
- - 任一 US 改了 **CLI 输出**(新增/修改输出行、表头、颜色、emoji 语义)
895
- - 任一 US 改了 **命令参数**(新增/重命名 flag、改变 default、收紧/放宽校验)
896
- - 任一 US 改了 **状态语义**(backlog 状态、cycle 状态机、退出码含义)
897
- - 任一 US 改了 **错误提示** / 用户可读日志文案
898
- - 任一 US 新增/删除/重命名一个用户能直接调用的命令
36
+ - Do not start implementation from this skill.
37
+ - Backlog rows and spec files must stay consistent.
38
+ - Peer review gates apply only when explicitly available/requested.
899
39
 
900
- **When it can be skipped (纯内部变更,用户感知不到):**
901
- - 纯内部重构(内部函数改名、模块边界调整、测试沙箱化)
902
- - CI / hooks / 工具链修复
903
- - 安全 / 隔离基础设施(沙箱配置、权限矩阵内部调整)
904
- - 测试基础设施 / fixture 数据更新
40
+ ## Gotchas
905
41
 
906
- **Checklist for the doc-refresh story (中英双语必需):**
907
- - [ ] `guide/en/<topic>.md` English guide updated
908
- - [ ] `guide/zh/<topic>.md` — Chinese guide updated
909
- - [ ] `README.md` index links to any new doc page
910
- - [ ] `--help` output snapshot matches new flags / commands / status semantics
911
- - [ ] Error-message strings reflected in troubleshooting / FAQ
912
- - [ ] **Bilingual rule**: English and Chinese on **separate lines**, never inline
913
- (遵循 project CLAUDE.md 中 Bilingual Output Convention)
42
+ - Design writes backlog/spec artifacts; it must not quietly start code implementation.
43
+ - Use roll story new for story directories; do not hand-create backlog rows without matching dossier structure.
914
44
 
915
- **How to wire the doc-refresh story:**
916
- 1. Place it **last** in the batch
917
- 2. `depends-on:` lists **every** preceding user-facing US in the batch
918
- 3. Title 用 "Phase N.M 用户文档刷新(中英双轨)" 模板(见 [Story Format](#story-format) 中的模板)
919
- 4. Cite a worked example in its Dependencies note — current best reference is
920
- `features/authoring/slide-deck-generator.md` US-DECK-015 (roll slides Phase 1.5)
45
+ ## Maintenance
921
46
 
922
- > Self-validation: this very skill was strengthened via US-SKILL-009; the
923
- > roll slides Phase 1.5 tasking (US-DECK-015) is the canonical worked example
924
- > of the discipline in action.
47
+ - Description changes require updates in `route-cases/skills.json`.
48
+ - New observed failures should add a gotcha and the matching positive or negative route case.
49
+ - Heavy examples, templates, recovery paths, and deterministic snippets belong in `references/`, `assets/`, or `scripts/`, not in this hub.