dflow-sdd-ddd 0.12.0 → 0.14.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 (42) hide show
  1. package/CHANGELOG.md +155 -0
  2. package/CONTRIBUTING.md +6 -9
  3. package/README.en.md +117 -40
  4. package/README.md +47 -15
  5. package/TEMPLATE-COVERAGE.md +3 -2
  6. package/bin/dflow.js +80 -3
  7. package/docs/evaluating-dflow.en.md +21 -2
  8. package/docs/evaluating-dflow.md +17 -3
  9. package/docs/npm-publish-checklist.md +3 -1
  10. package/docs/release-versioning-policy.md +3 -2
  11. package/docs/using-with-claude-code.en.md +35 -22
  12. package/docs/using-with-claude-code.md +27 -17
  13. package/docs/using-with-codex.en.md +20 -10
  14. package/docs/using-with-codex.md +13 -8
  15. package/docs/using-with-github-copilot.en.md +20 -9
  16. package/docs/using-with-github-copilot.md +14 -7
  17. package/lib/doctor-checks.js +178 -0
  18. package/lib/init.js +894 -36
  19. package/lib/render.js +1263 -0
  20. package/package.json +5 -2
  21. package/templates/brownfield/references/init-project-flow.md +46 -2
  22. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +13 -1
  23. package/templates/brownfield/templates/_index.md +2 -0
  24. package/templates/brownfield/templates/context-definition.md +2 -0
  25. package/templates/brownfield/templates/context-map.md +1 -0
  26. package/templates/brownfield/templates/glossary.md +1 -0
  27. package/templates/brownfield/templates/models.md +1 -0
  28. package/templates/brownfield/templates/phase-spec.md +2 -0
  29. package/templates/brownfield/templates/rules.md +1 -0
  30. package/templates/brownfield/templates/tech-debt.md +1 -0
  31. package/templates/greenfield/references/init-project-flow.md +48 -6
  32. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +13 -1
  33. package/templates/greenfield/templates/_index.md +2 -0
  34. package/templates/greenfield/templates/aggregate-design.md +2 -0
  35. package/templates/greenfield/templates/context-definition.md +2 -0
  36. package/templates/greenfield/templates/context-map.md +1 -0
  37. package/templates/greenfield/templates/events.md +1 -0
  38. package/templates/greenfield/templates/glossary.md +1 -0
  39. package/templates/greenfield/templates/models.md +1 -0
  40. package/templates/greenfield/templates/phase-spec.md +2 -0
  41. package/templates/greenfield/templates/rules.md +1 -0
  42. package/templates/greenfield/templates/tech-debt.md +1 -0
package/bin/dflow.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  const { runConfigureAgents, runDoctor, runInit } = require('../lib/init');
4
+ const { runRender } = require('../lib/render');
4
5
  const pkg = require('../package.json');
5
6
 
6
7
  const args = process.argv.slice(2);
@@ -12,6 +13,7 @@ Usage:
12
13
  dflow init Initialize Dflow specs in the current project
13
14
  dflow configure-agents Add or update AI agent instruction shims
14
15
  dflow doctor Read-only project health check
16
+ dflow render Render the specs Markdown tree to browsable HTML
15
17
  dflow --help Show this help
16
18
  dflow --version Show the CLI version
17
19
  `);
@@ -24,7 +26,11 @@ function printInitHelp() {
24
26
  Initializes Dflow project specs under dflow/specs/.
25
27
  The command prompts for project type, tech stack, migration context, prose
26
28
  language, Git policy, AI commit marker, optional starter files, and AI coding
27
- agents before showing a full file preview.
29
+ agents, then — when agents were selected on an interactive terminal — whether
30
+ to install the project-level Dflow skill (default yes), before showing a full
31
+ file preview. Non-interactive runs never read an extra stdin answer for the
32
+ skill question: existing scripted answer sequences run unchanged, and the
33
+ skill is installed by default for the selected agents.
28
34
  `);
29
35
  }
30
36
 
@@ -39,7 +45,51 @@ dflow/specs/shared/AI-AGENT-GUIDE.md file.
39
45
 
40
46
  Options:
41
47
  --command-adapters Also generate tool-native thin wrappers for supported tools.
42
- --skills Also generate project-level skill adapters for supported tools (Claude Code, Codex, and GitHub Copilot), restoring natural-language auto-trigger.
48
+ --skills Regenerate project-level skill adapters for all selected supported tools (Claude Code, Codex, and GitHub Copilot), restoring natural-language auto-trigger.
49
+
50
+ Without --skills, selecting an agent that has no project-level skill yet
51
+ prompts to install it (default yes) on an interactive terminal; non-interactive
52
+ runs install it by default without reading an extra stdin answer. Agents whose
53
+ skill file already exists are not re-asked and not regenerated.
54
+
55
+ On upgrade re-runs the command also refreshes the marker-guarded canonical
56
+ region of dflow/specs/shared/AI-AGENT-GUIDE.md (content outside the markers,
57
+ including "## Project Context", is kept) and advances the "> Dflow Version:"
58
+ last-reconciled line in _conventions.md. A pre-marker guide, or an agent file
59
+ you edited yourself, is never rewritten silently: interactive runs offer
60
+ marker adoption (default No); non-interactive runs skip and warn. (A pristine,
61
+ unedited Dflow shim is still regenerated in place, as before.)
62
+ `);
63
+ }
64
+
65
+ function printRenderHelp() {
66
+ process.stdout.write(`Usage:
67
+ dflow render [--src <dir>] [--out <dir>] [--title <text>]
68
+
69
+ Renders the Markdown specs tree into a mirrored static HTML tree for human
70
+ reading (record tables become cards, AI markers become badges), plus an
71
+ index.html file tree at the output root. Open index.html directly in a
72
+ browser; file:// works, no server needed.
73
+
74
+ Markdown stays the AI-facing source of truth. Re-run this command whenever
75
+ the sources change; every run is a full rebuild.
76
+
77
+ Options:
78
+ --src <dir> Specs root to render (default: dflow/specs)
79
+ --out <dir> Output directory (default: dflow-specs-html)
80
+ --title <text> index.html page title (default: "dflow specs")
81
+
82
+ The output directory is owned by dflow render: every rendered file embeds a
83
+ generated-by marker, and a .dflow-render-manifest.json ledger tracks the
84
+ mirror. Files whose sources were deleted or renamed are cleaned up on the
85
+ next run — a file is deleted only when it is both ledger-listed and
86
+ marker-verified, and an existing file at a path being rendered is
87
+ overwritten only when it is marker-verified (that is how the partial
88
+ outputs of an interrupted run converge on the next run). render refuses a
89
+ non-empty directory without a ledger, anything it never creates (symlinks,
90
+ junctions, hardlinked files), unrecognized files at paths it must write,
91
+ and source trees whose outputs would collide. render only writes --out; it
92
+ never modifies --src.
43
93
  `);
44
94
  }
45
95
 
@@ -50,7 +100,20 @@ function printDoctorHelp() {
50
100
  Read-only health check for the current project. Reports findings such as:
51
101
 
52
102
  - dflow/specs/shared/_conventions.md missing the Dflow Version
53
- front-matter line
103
+ front-matter line, or recording an older last-reconciled version
104
+ - policy sections (Git Policy / AI Commit Policy / Prose Language)
105
+ missing or no longer machine-readable
106
+ - AI-AGENT-GUIDE.md frozen at an older Dflow version (missing or
107
+ malformed guide-canonical markers, stale canonical content) and
108
+ dangling "AI-AGENT-GUIDE.md § ..." references from the workflow bundle
109
+ - AI-AGENT-GUIDE.md "## Project Context" missing the machine-readable
110
+ Tech stack / Migration rows that context inference reads
111
+ - init-only starters drifted (missing or edited Git-principles file
112
+ for the selected policy)
113
+ - active feature _index.md files created from an older template shape
114
+ - root agent files (AGENTS.md / CLAUDE.md / copilot-instructions.md)
115
+ with malformed Dflow markers or unmanaged Dflow wording
116
+ - workflow bundle orphans and a bundle projected by an older Dflow
54
117
 
55
118
  Doctor never modifies files.
56
119
  `);
@@ -111,6 +174,20 @@ async function main() {
111
174
  });
112
175
  }
113
176
 
177
+ if (args[0] === 'render') {
178
+ if (args.length > 1 && (args[1] === '--help' || args[1] === '-h')) {
179
+ printRenderHelp();
180
+ return 0;
181
+ }
182
+
183
+ return await runRender({
184
+ cwd: process.cwd(),
185
+ args: args.slice(1),
186
+ stdout: process.stdout,
187
+ stderr: process.stderr
188
+ });
189
+ }
190
+
114
191
  if (args[0] === 'doctor') {
115
192
  if (args.length > 1 && (args[1] === '--help' || args[1] === '-h')) {
116
193
  printDoctorHelp();
@@ -46,6 +46,12 @@ in your project's `dflow/specs/` directory and AI instruction files.
46
46
  the tools you select (e.g., `CLAUDE.md`, `AGENTS.md`,
47
47
  `.github/copilot-instructions.md`). Each points the tool to the canonical
48
48
  guide and workflow bundle.
49
+ - The project-level skill for the selected tools (`.claude/skills/dflow/` /
50
+ `.agents/skills/dflow/` / `.github/skills/dflow/`), installed **by default**
51
+ — the source of natural-language auto-trigger. Interactive runs ask one
52
+ `(Y/n)` question (Enter = install); non-interactive runs never read an extra
53
+ answer and install by default. If you answer `n`, add it later with
54
+ `dflow configure-agents --skills`.
49
55
 
50
56
  `init` does **not**:
51
57
 
@@ -76,7 +82,8 @@ and router; executable workflow steps live in the vendored bundle at
76
82
  - Multiple tools can be active in the same project without diverging
77
83
  workflow rules.
78
84
  - Switching or adding tools later does not require re-running `init`; run
79
- `dflow configure-agents` to add another shim, or
85
+ `dflow configure-agents` to add another shim (it asks the same default-yes
86
+ skill question for newly selected tools that have no skill yet), or
80
87
  `dflow configure-agents --command-adapters` to opt in to tool-native command
81
88
  entries.
82
89
  - The guide and workflow bundle together are the authoritative sources for
@@ -154,6 +161,13 @@ real codebase.
154
161
  `dflow/specs/shared/_conventions.md`, and
155
162
  `dflow/specs/shared/AI-AGENT-GUIDE.md` to see the shape.
156
163
 
164
+ You can also run `dflow render` to project the specs tree into
165
+ human-readable HTML (output in `dflow-specs-html/`; open `index.html` to
166
+ browse). A freshly initialized project is mostly starter templates; for a
167
+ closer-to-real rendering, clone this repo and render the tutorial's worked
168
+ specs: `dflow render --src tutorial/01-greenfield/outputs/dflow/specs
169
+ --out <any output dir>`.
170
+
157
171
  4. **Read one tutorial walk-through** to see what a real feature flow looks
158
172
  like end to end:
159
173
  - Greenfield: [`tutorial/01-greenfield/`](../tutorial/01-greenfield/walkthrough-00-setup.md)
@@ -177,7 +191,12 @@ against.
177
191
 
178
192
  Dflow is designed for low cost to try and low cost to leave:
179
193
 
180
- - Nothing depends on the `dflow-sdd-ddd` CLI being installed after `init`.
194
+ - After `init`, the specs and workflow documents themselves do not depend on
195
+ the `dflow-sdd-ddd` CLI being installed — they are plain Markdown committed
196
+ into your repo, readable from any clone. The CLI is only needed for three
197
+ things: upgrade re-projection (`configure-agents`), health checks
198
+ (`doctor`), and rendering the specs as human-readable HTML (`dflow render`,
199
+ see playbook step 3 above).
181
200
  - The generated files are plain Markdown; remove Dflow from a project with
182
201
  `rm -rf dflow/` plus deleting the AI agent shim files you no longer want.
183
202
  - If an existing project instruction file (e.g., a pre-existing `CLAUDE.md`)
@@ -33,6 +33,10 @@ Dflow 是 Markdown-based 的 workflow 材料加上一個 scaffolding CLI。它
33
33
  且可達的,任何 clone 都不需要 Dflow source 或 package 在本機安裝。
34
34
  - 你所選工具的 AI 指示檔或既有檔案中的 marked Dflow block(例如 `CLAUDE.md`、`AGENTS.md`、`.github/copilot-instructions.md`)。
35
35
  每個都把工具指向 canonical 指南與 workflow bundle。
36
+ - 選定工具的 project-level skill(`.claude/skills/dflow/` / `.agents/skills/dflow/` /
37
+ `.github/skills/dflow/`),**預設安裝**——自然語言自動觸發的來源。互動模式會問
38
+ 一題 `(Y/n)`(Enter = 裝);非互動不多讀答案、直接預設裝。答 `n` 可之後用
39
+ `dflow configure-agents --skills` 補裝。
36
40
 
37
41
  `init` **不會**:
38
42
 
@@ -58,8 +62,9 @@ Dflow 支援多種 AI 程式設計助理。跑完 `init` 後,你選取一個
58
62
  與 `dflow/specs/shared/dflow-workflows/`(可執行步驟定義)。實際意義:
59
63
 
60
64
  - 同一個專案可以同時啟用多個工具,而不會有 workflow 規則分歧。
61
- - 之後切換或新增工具不需要重跑 `init`;執行 `dflow configure-agents` 即可新增 shim,
62
- 或用 `dflow configure-agents --command-adapters` opt in 工具原生命令入口。
65
+ - 之後切換或新增工具不需要重跑 `init`;執行 `dflow configure-agents` 即可新增 shim
66
+ (對新選且尚無 skill 的工具會問同一題預設 Y 的 skill 安裝問句),或用
67
+ `dflow configure-agents --command-adapters` opt in 工具原生命令入口。
63
68
  - 指南與 workflow bundle 共同成為 Dflow workflow 行為的權威來源;兩者都是純 Markdown
64
69
  已 commit 進 repo,任何 clone 均可直接讀取。
65
70
 
@@ -123,6 +128,12 @@ repo 上下文的 AI 助理一起運作。
123
128
 
124
129
  開啟 `dflow/specs/shared/_overview.md`、`dflow/specs/shared/_conventions.md`、以及 `dflow/specs/shared/AI-AGENT-GUIDE.md` 看看整體架構。
125
130
 
131
+ 也可以跑 `dflow render` 把 specs 樹轉成人類閱讀的 HTML(輸出
132
+ `dflow-specs-html/`,開 `index.html` 即可瀏覽)。剛 init 完的 specs 多是
133
+ 起始模板;要看接近實戰的渲染效果,clone 本 repo 後對 tutorial 的規格範例
134
+ 跑 `dflow render --src tutorial/01-greenfield/outputs/dflow/specs --out
135
+ <任意輸出目錄>`。
136
+
126
137
  4. **閱讀一份 tutorial walk-through** 以了解完整的 feature flow:
127
138
  - Greenfield:[`tutorial/01-greenfield/`](../tutorial/01-greenfield/walkthrough-00-setup.md)
128
139
  - Brownfield:[`tutorial/02-brownfield/`](../tutorial/02-brownfield/walkthrough-00-setup.md)
@@ -137,7 +148,10 @@ repo 上下文的 AI 助理一起運作。
137
148
 
138
149
  Dflow 的設計讓試用成本低、退出成本也低:
139
150
 
140
- - `init` 完成後,你的專案不依賴已安裝的 `dflow-sdd-ddd` CLI。
151
+ - `init` 完成後,specs 與 workflow 文件本身不依賴已安裝的 `dflow-sdd-ddd`
152
+ CLI——它們是已 commit 進 repo 的純 Markdown,任何 clone 都讀得到。CLI 只在
153
+ 三種時機用到:升級重投影(`configure-agents`)、健康檢查(`doctor`)、以及
154
+ 把 specs 轉成人類閱讀的 HTML(`dflow render`,見上方 playbook 第 3 步)。
141
155
  - 產生的檔案都是純 Markdown;用 `rm -rf dflow/` 加上刪除你不再需要的 AI 指示 shim 檔案,即可從專案中移除 Dflow。
142
156
  - 既有的專案指示檔(例如原本就存在的 `CLAUDE.md`)若被加入 marked Dflow
143
157
  block,刪除該 block 即可復原;但之後再跑 `init` / `configure-agents`
@@ -12,7 +12,9 @@ Replace `<version>` with the version being published, for example `0.1.2`.
12
12
  - [ ] Update `CHANGELOG.md`.
13
13
  - [ ] Confirm `README.md` installation instructions match the release.
14
14
  - [ ] Confirm Greenfield and Brownfield common flow changes are synchronized.
15
- - [ ] Confirm generated templates match skill source where applicable.
15
+ - [ ] Confirm workflow content changes are complete under `templates/` — the
16
+ single content source; there is no separate skill-source copy to
17
+ synchronize.
16
18
  - [ ] Run the lifecycle check in the development repo and confirm it is green,
17
19
  so every proposal this release covers is terminal (`implemented` /
18
20
  `rejected` / `superseded`) and already archived:
@@ -95,8 +95,9 @@ the only place where release history is recorded.
95
95
 
96
96
  ## Greenfield and Brownfield Changes
97
97
 
98
- If a change touches a common SDD flow, update both Greenfield and Brownfield
99
- skill sources unless the release intentionally changes only one track.
98
+ If a change touches a common SDD flow, update the flow under both
99
+ `templates/greenfield/references/` and `templates/brownfield/references/`
100
+ unless the release intentionally changes only one track.
100
101
 
101
102
  Common synchronized flow files include:
102
103
 
@@ -82,8 +82,11 @@ without Claude-Code-specific edits.
82
82
 
83
83
  If a `CLAUDE.md` already existed in the project, `init` does not overwrite
84
84
  custom content. A Dflow-generated shim is refreshed in place; another file
85
- that already points to `dflow/specs/shared/AI-AGENT-GUIDE.md` is skipped
86
- without adding a second pointer. Otherwise Dflow shows the change in the
85
+ that already points to `dflow/specs/shared/AI-AGENT-GUIDE.md` is skipped with
86
+ a warning, without adding a second pointer — a later interactive
87
+ `dflow configure-agents` run offers to append the marked managed block
88
+ (default No), while non-interactive runs keep skipping with the warning.
89
+ Otherwise Dflow shows the change in the
87
90
  confirmation preview and appends a marked
88
91
  `<!-- dflow-generated: agent-shim START/END -->` block at the end of the file;
89
92
  re-running refreshes that same block in place without duplicating it. Dflow
@@ -208,23 +211,31 @@ git rm --cached -r .claude/commands/dflow/
208
211
  files.)
209
212
 
210
213
  After upgrading Dflow, re-running `dflow configure-agents --command-adapters`
211
- re-projects adapters from the **new registry**, but an existing
212
- `dflow/specs/shared/AI-AGENT-GUIDE.md` is **not** overwritten — "re-projecting
213
- adapters" is not the same as "migrating the canonical guide." Re-project with
214
- the **same dflow CLI version** to avoid a registry / guide version mismatch.
214
+ re-projects adapters from the **new registry** and also refreshes the
215
+ **marker-guarded canonical region** of `dflow/specs/shared/AI-AGENT-GUIDE.md`
216
+ in place (everything outside the markers — including `## Project Context` — is
217
+ kept). If an older project's guide has no markers yet, an interactive run asks
218
+ before adopting them (default No); a non-interactive run skips with a warning.
219
+ Re-project with the **same dflow CLI version**, and run `dflow doctor`
220
+ afterwards to review any remaining drift (read-only).
215
221
 
216
- ### Optional Skill Adapter (Restore Natural-Language Auto-Trigger)
222
+ ### Skill Adapter (Natural-Language Auto-Trigger, Installed by Default)
217
223
 
218
224
  Command adapters give you a `/` menu entry, but they **do not auto-trigger** —
219
- you have to invoke the command yourself. If you want to restore the "say 'I want
220
- to add a feature' and it shows up automatically" experience, run this in an
221
- initialized project:
225
+ you have to invoke the command yourself. Auto-trigger comes from the
226
+ project-level skill, and it now installs **by default**: `dflow init` installs
227
+ it when AI tools were selected (interactive runs ask one question — press Enter
228
+ to install; non-interactive runs never read an extra answer and install by
229
+ default), and `dflow configure-agents` asks the same question for newly
230
+ selected tools that have no skill yet. If you answered `n` back then, or want
231
+ to force-regenerate (for example to refresh after upgrading Dflow), run:
222
232
 
223
233
  ```bash
224
234
  dflow configure-agents --skills
225
235
  ```
226
236
 
227
- After you select Claude Code, Dflow generates a thin skill:
237
+ After you select Claude Code (in init or configure-agents), Dflow generates a
238
+ thin skill:
228
239
 
229
240
  - `.claude/skills/dflow/SKILL.md`
230
241
 
@@ -233,8 +244,8 @@ This skill does not copy workflow steps; its body points to the canonical
233
244
  `dflow/specs/shared/dflow-workflows/` (vendored bundle with executable step
234
245
  definitions).
235
246
 
236
- The same edition-neutral skill source is now also projected by `--skills` as a
237
- project-level skill for Codex (`.agents/skills/dflow/SKILL.md`) and GitHub Copilot
247
+ The same edition-neutral skill source is also projected as a project-level
248
+ skill for Codex (`.agents/skills/dflow/SKILL.md`) and GitHub Copilot
238
249
  (`.github/skills/dflow/SKILL.md`); all three follow the same cross-tool
239
250
  agentskills.io standard.
240
251
 
@@ -249,14 +260,14 @@ Its behavior:
249
260
  judges the intent, **suggests the matching `/dflow:` command, and waits for
250
261
  your confirmation** before proceeding.
251
262
 
252
- **The four combinations** (command adapters and the skill are each independently
253
- opt-in):
263
+ **The four combinations** (command adapters stay opt-in; the skill installs by
264
+ default — answer `n` at init to skip it, or delete it later):
254
265
 
255
266
  | Installed | Entry behavior |
256
267
  |---|---|
257
- | Neither | Root shim only (CLAUDE.md points to the guide); no `/` menu, no auto-trigger |
268
+ | Neither (skill skipped with `n`, no adapters) | Root shim only (CLAUDE.md points to the guide); no `/` menu, no auto-trigger |
258
269
  | Command adapters only | `/dflow:*` appears in the `/` menu; no natural-language auto-trigger |
259
- | Skill only | Natural-language auto-trigger (suggest-and-wait); no `/` menu |
270
+ | Skill only (init's default outcome) | Natural-language auto-trigger (suggest-and-wait); no `/` menu |
260
271
  | Both | `/` menu + natural-language safety net **may coexist** |
261
272
 
262
273
  **Both may coexist with no mutex needed** (validated in a real Claude Code
@@ -307,11 +318,13 @@ spec locations, or SDD constraints to `CLAUDE.md`, those belong in
307
318
  `dflow/specs/shared/AI-AGENT-GUIDE.md` instead. The shim stays small so
308
319
  that other tools' shims don't drift away from it.
309
320
 
310
- **`/dflow:*` is not a Claude Code Skill installation.** `init` does not
311
- install anything into Claude Code's skill system. Without command adapters,
312
- Dflow names are text triggers the AI recognizes from the workflow table. After
313
- you run `dflow configure-agents --command-adapters`, the added files are thin
314
- command wrappers, not a second workflow definition.
321
+ **The `/dflow:*` command names are not the skill.** `init` does install the
322
+ auto-trigger skill into Claude Code's skill system by default
323
+ (`.claude/skills/dflow/SKILL.md`; answer `n` at the skill question to skip),
324
+ but the `/dflow:*` **command names** themselves are not a skill. Without
325
+ command adapters, those names are text triggers the AI recognizes from the
326
+ workflow table. After you run `dflow configure-agents --command-adapters`, the
327
+ added files are thin command wrappers, not a second workflow definition.
315
328
 
316
329
  **Choose either legacy Claude skills or the installed adapter.** If the
317
330
  project still has legacy `.claude/skills/sdd-ddd-*` skills, choose either
@@ -184,19 +184,24 @@ git rm --cached -r .claude/commands/dflow/
184
184
  (`--cached` 只移出版控、保留工作目錄檔案。)
185
185
 
186
186
  升級 dflow 後重跑 `dflow configure-agents --command-adapters`,adapter 會用**新版 registry**
187
- 重投影;但既有 `dflow/specs/shared/AI-AGENT-GUIDE.md` **不會**被覆寫——「重投影 adapter」不等於
188
- 「升級 canonical guide」。請以**相同的 dflow CLI 版本**重投影,避免 registry 與 guide 版本錯位。
187
+ 重投影;`dflow/specs/shared/AI-AGENT-GUIDE.md` 內**帶 marker 的 canonical 區**也會原地刷新
188
+ (marker 以外——含 `## Project Context`——保留不動)。較舊專案的 guide 還沒有 marker 時,
189
+ 互動執行會詢問是否採用(預設 N)、非互動則跳過並警告。請以**相同的 dflow CLI 版本**重投影,
190
+ 升級後先跑 `dflow doctor` 檢視殘餘漂移(read-only)。
189
191
 
190
- ### 選配 Skill Adapter(找回自然語言自動觸發)
192
+ ### Skill Adapter(自然語言自動觸發,init 預設安裝)
191
193
 
192
- Command adapter 提供 `/` 選單入口,但**不會自動觸發**——你得主動打命令。若想找回
193
- 「講『我要加一個功能』就自動現身」的體驗,可在已初始化的專案中執行:
194
+ Command adapter 提供 `/` 選單入口,但**不會自動觸發**——你得主動打命令。自動觸發
195
+ 來自 project-level skill,而它現在是**預設安裝**:`dflow init` 有選 AI 工具時就會裝
196
+ (互動模式問一題、直接按 Enter = 裝;非互動不多讀答案、直接預設裝),
197
+ `dflow configure-agents` 對「新選且尚無 skill」的工具也補問同一題。若當時答 `n`
198
+ 略過、或想強制重生成(例如升級 Dflow 後刷新),執行:
194
199
 
195
200
  ```bash
196
201
  dflow configure-agents --skills
197
202
  ```
198
203
 
199
- 選擇 Claude Code 後,Dflow 會產生一份薄 skill:
204
+ 選擇 Claude Code 後(init 或 configure-agents 皆同),Dflow 會產生一份薄 skill:
200
205
 
201
206
  - `.claude/skills/dflow/SKILL.md`
202
207
 
@@ -204,7 +209,7 @@ dflow configure-agents --skills
204
209
  `dflow/specs/shared/AI-AGENT-GUIDE.md`(命令登錄表與路由規則)以及
205
210
  `dflow/specs/shared/dflow-workflows/`(含可執行步驟定義的 vendored bundle)。
206
211
 
207
- 同一份 edition-neutral skill source,現在也會由 `--skills` 為 Codex
212
+ 同一份 edition-neutral skill source,也會為 Codex
208
213
  (`.agents/skills/dflow/SKILL.md`)與 GitHub Copilot(`.github/skills/dflow/SKILL.md`)
209
214
  投影 project-level skill,三家沿用相同的跨工具 agentskills.io 標準。
210
215
 
@@ -216,14 +221,15 @@ dflow configure-agents --skills
216
221
  - 由自然語言觸發時,**不會直接進 workflow**:它會判斷意圖、**建議對應的 `/dflow:`
217
222
  命令並等待你確認**,再進入流程。
218
223
 
219
- **四種組合**(command adapter 與 skill 各自獨立 opt-in):
224
+ **四種組合**(command adapter 維持 opt-in;skill 預設安裝,可在 init 答 `n`
225
+ 略過或事後刪除):
220
226
 
221
227
  | 安裝組合 | 入口行為 |
222
228
  |---|---|
223
- | 都不裝 | 只有根目錄 shim(CLAUDE.md 指向 guide);無 `/` 選單、無自動觸發 |
224
- | 只裝 command adapters | `/dflow:*` 出現在 `/` 選單;無自然語言自動觸發 |
225
- | 只裝 skill | 自然語言自動觸發(suggest-and-wait);無 `/` 選單 |
226
- | 兩者都裝 | `/` 選單 + 自然語言 safety net **可共存** |
229
+ | 都沒有(skill 題答 `n`、未裝 adapters) | 只有根目錄 shim(CLAUDE.md 指向 guide);無 `/` 選單、無自動觸發 |
230
+ | 只有 command adapters | `/dflow:*` 出現在 `/` 選單;無自然語言自動觸發 |
231
+ | 只有 skill(init 預設結果) | 自然語言自動觸發(suggest-and-wait);無 `/` 選單 |
232
+ | 兩者都有 | `/` 選單 + 自然語言 safety net **可共存** |
227
233
 
228
234
  **兩者可共存、無需互斥**(已在真實 Claude Code 環境驗證):skill 名稱 `dflow` 與
229
235
  command adapter 的 `dflow:<id>` 不撞名,明確命令各自精準載入、不會雙觸發;skill 當
@@ -266,10 +272,12 @@ SDD 約束加入 `CLAUDE.md`,這些內容應該放到
266
272
  `dflow/specs/shared/AI-AGENT-GUIDE.md`。shim 保持精簡,其他工具的 shim 才不會
267
273
  與它產生漂移(drift)。
268
274
 
269
- **`/dflow:*` 不是安裝 Claude Code Skill。** `init` 不會在 Claude Code 的
270
- skill 系統中安裝任何東西。未安裝 command adapters 時,Dflow 名稱只是 AI 從
271
- workflow 表識別的文字 trigger;安裝 `dflow configure-agents --command-adapters`
272
- 後,新增的是薄 command wrapper,不是 workflow 的第二份定義。
275
+ **`/dflow:*` 命令名不等於 skill。** init 預設會在 Claude Code 的 skill 系統
276
+ 裝一份自動觸發 skill(`.claude/skills/dflow/SKILL.md`,skill 題答 `n` 可略過),
277
+ 但 `/dflow:*` 這組**命令名**本身不是 skill——未安裝 command adapters 時,它們
278
+ 只是 AI 從 workflow 表識別的文字 trigger;安裝
279
+ `dflow configure-agents --command-adapters` 後,新增的是薄 command wrapper,
280
+ 不是 workflow 的第二份定義。
273
281
 
274
282
  **legacy Claude skill 與 installed adapter 擇一。** 如果專案仍保留舊的
275
283
  `.claude/skills/sdd-ddd-*` skill,請在 legacy skill 與 `--command-adapters`
@@ -289,7 +297,9 @@ Code 會在進入對應 workflow 時才讀取它們。這樣可以讓 context
289
297
  工作保持比例。
290
298
 
291
299
  **既有的 `CLAUDE.md` 會被保留。** `init` 不會覆蓋你現有的自訂專案指示;已是
292
- Dflow-generated shim 會原地刷新,其他已指向 `AI-AGENT-GUIDE.md` 的檔案會略過,
300
+ Dflow-generated shim 會原地刷新,其他已指向 `AI-AGENT-GUIDE.md` 的檔案會略過
301
+ 並警告、不新增第二個指標(之後在互動終端跑 `dflow configure-agents` 會詢問
302
+ 是否附加帶 marker 的管理區塊,預設 N;非互動執行維持略過並警告),
293
303
  否則會在確認 preview 顯示要附加的 marked Dflow block,寫入後重跑會原地更新同一段。
294
304
  若你刪除該 block,下一次 `init` / `configure-agents` 會再附加它;只有 marker
295
305
  conflict 時才需要到 `dflow/specs/shared/` 找 fallback merge snippet 手動處理。
@@ -86,8 +86,11 @@ GitHub Copilot, and other tools.
86
86
 
87
87
  If an `AGENTS.md` already existed in the project, `init` does not overwrite
88
88
  custom content. A Dflow-generated shim is refreshed in place; another file
89
- that already points to `dflow/specs/shared/AI-AGENT-GUIDE.md` is skipped
90
- without adding a second pointer. Otherwise Dflow shows the change in the
89
+ that already points to `dflow/specs/shared/AI-AGENT-GUIDE.md` is skipped with
90
+ a warning, without adding a second pointer — a later interactive
91
+ `dflow configure-agents` run offers to append the marked managed block
92
+ (default No), while non-interactive runs keep skipping with the warning.
93
+ Otherwise Dflow shows the change in the
91
94
  confirmation preview and appends a marked
92
95
  `<!-- dflow-generated: agent-shim START/END -->` block at the end of the file;
93
96
  re-running refreshes that same block in place. Dflow writes the fallback merge
@@ -179,8 +182,9 @@ triggers only. It does not create Codex command files. Codex v1 has no Dflow
179
182
  command-file adapter equivalent to Claude `.claude/commands` or Copilot
180
183
  `.github/prompts`.
181
184
 
182
- **Auto-trigger skills come from `--skills`, not `--command-adapters`.** See
183
- "Codex Behavior With Optional Skills" below.
185
+ **Auto-trigger skills come from the skill install (init's default, or
186
+ `--skills`), not `--command-adapters`.** See "Codex Behavior With Skills"
187
+ below.
184
188
 
185
189
  When you select `AGENTS.md - Codex / Copilot coding agent` in
186
190
  `--command-adapters` mode, Dflow writes a trigger list generated from the
@@ -219,10 +223,16 @@ Both snippets appear only on a marker conflict. A clean custom `AGENTS.md` with
219
223
  no conflicting markers does not produce a snippet at all — Dflow just appends the
220
224
  adjacent marked block in place.
221
225
 
222
- ### Codex Behavior With Optional Skills (Auto-Trigger)
226
+ ### Codex Behavior With Skills (Auto-Trigger, Installed by Default)
223
227
 
224
- `dflow configure-agents --skills` projects a thin, tool-neutral skill to
225
- `.agents/skills/dflow/SKILL.md` — Codex's project-level skill path. This gives
228
+ Dflow projects a thin, tool-neutral skill to
229
+ `.agents/skills/dflow/SKILL.md` — Codex's project-level skill path. The skill
230
+ now installs **by default**: `dflow init` installs it when Codex was selected
231
+ (interactive runs ask one default-yes question; non-interactive runs install
232
+ without reading extra stdin), and `dflow configure-agents` asks the same
233
+ question when Codex is newly selected without a skill;
234
+ `dflow configure-agents --skills` backfills a previously skipped skill or
235
+ force-regenerates it. This gives
226
236
  Codex **natural-language auto-trigger on par with Claude Code**: when you
227
237
  describe intent like "help me start a new feature", Codex can judge relevance
228
238
  from the skill's `description`, suggest the matching `dflow:<id>` workflow, and
@@ -320,9 +330,9 @@ workflow by reading `AI-AGENT-GUIDE.md`.
320
330
  Codex only strengthens text-trigger guidance in marked blocks inside
321
331
  `AGENTS.md`; fallback merge snippets are created only on marker conflicts. Do
322
332
  not expect Codex-specific **command** files under `.claude/commands` or
323
- `.github/prompts`. (Auto-trigger **skills** are separate: `--skills` projects
324
- one to `.agents/skills/dflow/SKILL.md`, see "Codex Behavior With Optional
325
- Skills" above.)
333
+ `.github/prompts`. (Auto-trigger **skills** are separate: init installs one to
334
+ `.agents/skills/dflow/SKILL.md` by default and `--skills` regenerates it, see
335
+ "Codex Behavior With Skills" above.)
326
336
 
327
337
  **Do not confuse Codex `/init` with Dflow `init`.** Codex `/init` creates a
328
338
  generic `AGENTS.md` scaffold for Codex. Dflow setup is `dflow init` (or
@@ -76,7 +76,9 @@ Claude Code、GitHub Copilot 與其他工具。
76
76
 
77
77
  如果專案中已有 `AGENTS.md`,`init` 不會覆蓋自訂內容。已是 Dflow-generated shim
78
78
  的檔案會原地刷新;其他已指向 `dflow/specs/shared/AI-AGENT-GUIDE.md` 的檔案會
79
- 略過,不會新增第二個指標。否則 Dflow 會在確認 preview 顯示並於檔案末尾附加帶有
79
+ 略過並警告,不會新增第二個指標——之後在互動終端跑 `dflow configure-agents`
80
+ 會詢問是否附加帶 marker 的管理區塊(預設 N),非互動執行維持略過並警告。
81
+ 否則 Dflow 會在確認 preview 顯示並於檔案末尾附加帶有
80
82
  `<!-- dflow-generated: agent-shim START/END -->` markers 的 Dflow block,重跑會
81
83
  原地更新同一段。只有遇到衝突或 malformed Dflow markers 時,才會改寫
82
84
  `dflow/specs/shared/AGENTS-md-snippet.md` fallback merge snippet 讓你手動合併。
@@ -158,8 +160,8 @@ guide 中記為 `/dflow:*`)。
158
160
  Codex 命令檔。Codex v1 沒有與 Claude `.claude/commands` 或 Copilot `.github/prompts`
159
161
  對等的 Dflow command-file adapter。
160
162
 
161
- **自動觸發 skill 走的是 `--skills`(非 `--command-adapters`)。** 見下方
162
- 〈選配 Skill 的 Codex 行為〉。
163
+ **自動觸發 skill 走的是 skill 安裝(init 預設、或 `--skills`),非
164
+ `--command-adapters`。** 見下方〈Skill 的 Codex 行為〉。
163
165
 
164
166
  當你在 `--command-adapters` 模式下選擇 `AGENTS.md - Codex / Copilot coding agent`
165
167
  時,Dflow 會把從 canonical command registry 產生的 trigger 清單寫進 `AGENTS.md`。
@@ -189,10 +191,13 @@ marker」分成兩種小抄:
189
191
  兩種小抄都只在 marker conflict 時出現。乾淨、沒有 marker 衝突的自訂 `AGENTS.md` 不會
190
192
  產生任何小抄——Dflow 會直接把相鄰 marked block append 進去。
191
193
 
192
- ### 選配 Skill 的 Codex 行為(自動觸發)
194
+ ### Skill 的 Codex 行為(自動觸發,init 預設安裝)
193
195
 
194
- `dflow configure-agents --skills` 會把一份精簡、工具中立的 skill 投影到
195
- `.agents/skills/dflow/SKILL.md`——Codex 的專案層 skill 路徑。這讓 Codex 取得與
196
+ Dflow 會把一份精簡、工具中立的 skill 投影到
197
+ `.agents/skills/dflow/SKILL.md`——Codex 的專案層 skill 路徑。這份 skill 現在
198
+ **預設安裝**:`dflow init` 有選 Codex 就裝(互動問一題預設 Y、非互動直接裝)、
199
+ `dflow configure-agents` 對新選且尚無 skill 的 Codex 也補問;
200
+ `dflow configure-agents --skills` 用於補裝先前略過的、或強制重生成。這讓 Codex 取得與
196
201
  Claude Code **對等的自然語言自動觸發**:你用「help me start a new feature」這類描述
197
202
  時,Codex 可依該 skill 的 `description` 自動判斷是否相關,建議對應的 `dflow:<id>`
198
203
  workflow,而不必每次都記得手打命令。
@@ -272,8 +277,8 @@ canonical `/dflow:<id>` workflow。
272
277
  **Codex 不產生命令檔。** 即使使用 `--command-adapters`,Codex 也只強化
273
278
  `AGENTS.md` 中 marked block 的文字 trigger 說明;只有 marker conflict 才會產生
274
279
  fallback merge snippet。不要期待 `.claude/commands` 或 `.github/prompts` 形式的
275
- Codex 專屬**命令**檔。(自動觸發 **skill** 是另一回事,由 `--skills` 投影到
276
- `.agents/skills/dflow/SKILL.md`,見上方〈選配 Skill 的 Codex 行為〉。)
280
+ Codex 專屬**命令**檔。(自動觸發 **skill** 是另一回事,init 預設安裝、`--skills`
281
+ 可重生成,路徑 `.agents/skills/dflow/SKILL.md`,見上方〈Skill 的 Codex 行為〉。)
277
282
 
278
283
  **不要混淆 Codex `/init` 與 Dflow `init`。** Codex `/init` 為 Codex 建立
279
284
  通用的 `AGENTS.md` scaffold。Dflow 的設定是 `dflow init`(或免安裝路徑的
@@ -142,11 +142,16 @@ steps. Note the command syntax uses the **hyphen** `/dflow-<id>`, not the
142
142
  canonical **colon** `/dflow:<id>` — the colon form is Claude / Codex's command
143
143
  syntax and in Copilot can only be a text reference, never typed as a command.
144
144
 
145
- ### The `--skills` Flag and Skill Triggering on Copilot
145
+ ### Skill Triggering on Copilot (Installed by Default)
146
146
 
147
- `dflow configure-agents --skills` projects the same tool-neutral thin skill for
147
+ Dflow projects the same tool-neutral thin skill for
148
148
  **Claude Code, Codex, and GitHub Copilot**, each at its own project-level skill
149
- path; Copilot's is `.github/skills/dflow/SKILL.md`. Testing (2026-06-05) confirmed
149
+ path; Copilot's is `.github/skills/dflow/SKILL.md`. The skill now installs **by
150
+ default**: `dflow init` installs it when Copilot was selected (interactive runs
151
+ ask one default-yes question; non-interactive runs install without reading
152
+ extra stdin), `dflow configure-agents` asks the same question when Copilot is
153
+ newly selected without a skill, and `dflow configure-agents --skills` backfills
154
+ or force-regenerates it. Testing (2026-06-05) confirmed
150
155
  Copilot discovers and runs the skill from its own native `.github/skills/` path
151
156
  (it still works with the cross-read `.claude`/`.agents` paths removed); the
152
157
  trigger differs by surface — **VS Code Chat auto-triggers on natural language**,
@@ -191,10 +196,13 @@ git rm --cached .github/prompts/dflow-*.prompt.md
191
196
  files.)
192
197
 
193
198
  After upgrading Dflow, re-running `dflow configure-agents --command-adapters`
194
- re-projects prompt adapters from the **new registry**, but an existing
195
- `dflow/specs/shared/AI-AGENT-GUIDE.md` is **not** overwritten — "re-projecting
196
- adapters" is not the same as "migrating the canonical guide." Re-project with
197
- the **same dflow CLI version**.
199
+ re-projects prompt adapters from the **new registry** and also refreshes the
200
+ **marker-guarded canonical region** of `dflow/specs/shared/AI-AGENT-GUIDE.md`
201
+ in place (everything outside the markers — including `## Project Context` — is
202
+ kept). If an older project's guide has no markers yet, an interactive run asks
203
+ before adopting them (default No); a non-interactive run skips with a warning.
204
+ Re-project with the **same dflow CLI version**, and run `dflow doctor`
205
+ afterwards to review any remaining drift (read-only).
198
206
 
199
207
  ### Sample Conversation Flow
200
208
 
@@ -225,7 +233,10 @@ Copilot: Got it. I'll create the feature spec at dflow/specs/features/active/
225
233
  If a `.github/copilot-instructions.md` file already exists in your project,
226
234
  `init` does not overwrite custom content. A Dflow-generated shim is refreshed
227
235
  in place; another file that already points to
228
- `dflow/specs/shared/AI-AGENT-GUIDE.md` is skipped. If the file does not yet
236
+ `dflow/specs/shared/AI-AGENT-GUIDE.md` is skipped with a warning — a later
237
+ interactive `dflow configure-agents` run offers to append the marked managed
238
+ block (default No), while non-interactive runs keep skipping with the warning.
239
+ If the file does not yet
229
240
  point to the guide, Dflow shows the change in the confirmation preview and
230
241
  appends a marked `<!-- dflow-generated: agent-shim START/END -->` block at the
231
242
  end of the file; re-running refreshes that same block in place without
@@ -287,7 +298,7 @@ The canonical guide (`dflow/specs/shared/AI-AGENT-GUIDE.md`) is the same across
287
298
  ## Where to Go Next
288
299
 
289
300
  - If you have not run `init`: run `dflow init` (after `npm install -g dflow-sdd-ddd`) or `npx dflow-sdd-ddd init` and choose the Copilot target to create `.github/copilot-instructions.md`.
290
- - Read [`dflow/specs/shared/AI-AGENT-GUIDE.md`](../sdd-ddd-greenfield-skill/scaffolding/AI-AGENT-GUIDE.md) (or the brownfield equivalent) before starting a workflow.
301
+ - Read [`dflow/specs/shared/AI-AGENT-GUIDE.md`](../templates/greenfield/scaffolding/AI-AGENT-GUIDE.md) (or the brownfield equivalent) before starting a workflow.
291
302
  - See [`tutorial/01-greenfield/`](../tutorial/01-greenfield/walkthrough-00-setup.md) for conversation examples that demonstrate Copilot chat flows.
292
303
  - Read [`docs/why-ddd-for-ai.en.md`](why-ddd-for-ai.en.md) for the design rationale behind spec-first plus DDD.
293
304