dflow-sdd-ddd 0.8.0 → 0.10.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 (52) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/LICENSE +679 -21
  3. package/README.en.md +24 -12
  4. package/README.md +15 -8
  5. package/TEMPLATE-COVERAGE.md +0 -1
  6. package/bin/dflow.js +4 -3
  7. package/docs/evaluating-dflow.en.md +11 -7
  8. package/docs/evaluating-dflow.md +9 -4
  9. package/docs/migrating-to-dflow-v1.md +7 -3
  10. package/docs/using-with-claude-code.en.md +40 -23
  11. package/docs/using-with-claude-code.md +34 -23
  12. package/docs/using-with-codex.en.md +135 -48
  13. package/docs/using-with-codex.md +99 -38
  14. package/docs/using-with-github-copilot.en.md +135 -34
  15. package/docs/using-with-github-copilot.md +120 -43
  16. package/lib/init.js +943 -145
  17. package/package.json +3 -3
  18. package/templates/brownfield/references/dflow-feedback-flow.md +135 -63
  19. package/templates/brownfield/references/drift-verification.md +1 -4
  20. package/templates/brownfield/references/finish-feature-flow.md +59 -23
  21. package/templates/brownfield/references/git-integration.md +65 -7
  22. package/templates/brownfield/references/init-project-flow.md +67 -36
  23. package/templates/brownfield/references/modify-existing-flow.md +10 -38
  24. package/templates/brownfield/references/new-feature-flow.md +28 -11
  25. package/templates/brownfield/references/new-phase-flow.md +16 -1
  26. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +253 -2
  27. package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +5 -8
  28. package/templates/brownfield/scaffolding/Git-principles-gitflow.md +13 -12
  29. package/templates/brownfield/scaffolding/Git-principles-trunk.md +13 -16
  30. package/templates/brownfield/scaffolding/_conventions.md +10 -9
  31. package/templates/brownfield/templates/_index.md +21 -3
  32. package/templates/brownfield/templates/lightweight-spec.md +1 -1
  33. package/templates/brownfield/templates/phase-spec.md +1 -1
  34. package/templates/common/skill/SKILL.md +9 -6
  35. package/templates/greenfield/references/dflow-feedback-flow.md +135 -63
  36. package/templates/greenfield/references/drift-verification.md +1 -4
  37. package/templates/greenfield/references/finish-feature-flow.md +58 -23
  38. package/templates/greenfield/references/git-integration.md +65 -7
  39. package/templates/greenfield/references/init-project-flow.md +67 -36
  40. package/templates/greenfield/references/modify-existing-flow.md +9 -7
  41. package/templates/greenfield/references/new-feature-flow.md +29 -12
  42. package/templates/greenfield/references/new-phase-flow.md +16 -1
  43. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +222 -2
  44. package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +10 -15
  45. package/templates/greenfield/scaffolding/Git-principles-gitflow.md +13 -12
  46. package/templates/greenfield/scaffolding/Git-principles-trunk.md +14 -18
  47. package/templates/greenfield/scaffolding/_conventions.md +9 -8
  48. package/templates/greenfield/templates/_index.md +21 -3
  49. package/templates/greenfield/templates/lightweight-spec.md +1 -1
  50. package/templates/greenfield/templates/phase-spec.md +1 -1
  51. package/templates/brownfield/templates/CLAUDE.md +0 -165
  52. package/templates/greenfield/templates/CLAUDE.md +0 -172
package/README.en.md CHANGED
@@ -35,8 +35,9 @@ npm install -g dflow-sdd-ddd
35
35
  dflow init
36
36
  ```
37
37
 
38
- The init flow asks whether the project is greenfield or brownfield, then
39
- previews the files it will create. Existing files are not overwritten. Init
38
+ The init flow asks whether the project is greenfield or brownfield, which Git
39
+ policy the team follows (GitFlow / Trunk), and how AI-made commits should be
40
+ marked, then previews the files it will create. Existing files are not overwritten. Init
40
41
  creates workflow documentation and AI instruction files; it does not inspect,
41
42
  refactor, or migrate your application code.
42
43
 
@@ -215,7 +216,9 @@ dflow/
215
216
  └── completed/
216
217
  ```
217
218
 
218
- Dflow also creates or provides a mergeable project instruction file for your AI coding agent. The exact file depends on the target tool and existing project setup; Dflow avoids overwriting existing project instructions.
219
+ Dflow also creates or updates a project instruction file for your AI coding
220
+ agent. The exact file depends on the target tool and existing project setup;
221
+ Dflow avoids overwriting custom content in existing project instructions.
219
222
 
220
223
  When you select AI agent setup during init, Dflow writes
221
224
  `dflow/specs/shared/AI-AGENT-GUIDE.md` as the canonical project guide, then
@@ -228,14 +231,22 @@ files whose only job is to redirect the tool to the canonical guide):
228
231
  | Claude Code | `CLAUDE.md` |
229
232
  | GitHub Copilot | `.github/copilot-instructions.md` |
230
233
 
231
- If one of those files already exists, Dflow leaves it unchanged and writes a
232
- merge snippet under `dflow/specs/shared/` instead. The project guide stays the
233
- single source of truth, so teams can use multiple AI tools without maintaining
234
- multiple copies of the workflow rules.
234
+ If one of those files already exists, Dflow preserves custom content. A
235
+ Dflow-generated shim is refreshed in place; another file that already points to
236
+ `dflow/specs/shared/AI-AGENT-GUIDE.md` is skipped. If the file does not yet
237
+ point to the guide, Dflow shows the change in the confirmation preview and
238
+ appends a marked `<!-- dflow-generated: agent-shim START/END -->` block at the
239
+ end of the file; re-running refreshes that same block in place without
240
+ duplicating it. A fallback merge snippet under `dflow/specs/shared/` is written
241
+ only when the file contains conflicting or malformed Dflow markers. The project
242
+ guide stays the single source of truth, so teams can use multiple AI tools
243
+ without maintaining multiple copies of the workflow rules.
235
244
 
236
245
  You can run `dflow configure-agents` later to add more tool shims as the team
237
246
  adopts additional AI coding agents. If you need Claude / Copilot tool-native
238
- command entries, use `dflow configure-agents --command-adapters`.
247
+ command entries, use `dflow configure-agents --command-adapters`. For
248
+ natural-language auto-trigger (a project-level skill for Claude Code and Codex),
249
+ use `dflow configure-agents --skills`.
239
250
 
240
251
  ### Version-Control Policy for Generated Artifacts (recommended default)
241
252
 
@@ -246,9 +257,10 @@ version-control the source, not the generated artifacts.
246
257
 
247
258
  | File | Role | Recommended default |
248
259
  |---|---|---|
249
- | `dflow/` (canonical guide, specs, merge snippet) | source | **version-control** |
250
- | Thin shims (`CLAUDE.md` / `AGENTS.md` / `.github/copilot-instructions.md`) | source | **version-control** |
260
+ | `dflow/` (canonical guide, specs, fallback merge snippets) | source | **version-control** |
261
+ | Thin shims or marked Dflow blocks in existing root agent files (`CLAUDE.md` / `AGENTS.md` / `.github/copilot-instructions.md`) | source | **version-control** |
251
262
  | `.claude/commands/dflow/`, `.github/prompts/dflow-*.prompt.md` | generated | **recommended: do not version-control (gitignore)**; regenerate after clone with `configure-agents --command-adapters` |
263
+ | `.claude/skills/dflow/`, `.agents/skills/dflow/` | generated | **recommended: do not version-control (gitignore)**; regenerate after clone with `configure-agents --skills` |
252
264
 
253
265
  This is a **recommendation**, not the only valid policy. If your team wants a
254
266
  native `/` menu immediately after clone, or your CI / dev environment does not
@@ -317,7 +329,7 @@ Usable only inside an already-started active feature. Targets pointing at `compl
317
329
  |---|---|---|
318
330
  | `/dflow:verify` | Need to confirm docs, code, tests, and tech-debt records are still in sync | Drift report across spec, domain docs, implementation, tests, and debt records |
319
331
  | `/dflow:pr-review` | A change is ready for review | SDD/DDD compliance review checklist with risks, gaps, and follow-up items |
320
- | `/dflow:report-dflow-feedback` | You or the AI found a Dflow issue or improvement while using it | Sanitized local feedback draft; nothing is submitted automatically |
332
+ | `/dflow:report-dflow-feedback` | You or the AI found a Dflow issue or improvement while using it | Sanitized local draft rendered field-by-field for the upstream issue form, ready to paste; nothing is submitted automatically |
321
333
 
322
334
  ### What should I run? (rule of thumb)
323
335
 
@@ -389,4 +401,4 @@ release history.
389
401
 
390
402
  ## License
391
403
 
392
- MIT License. See [LICENSE](LICENSE).
404
+ GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later). See [LICENSE](LICENSE).
package/README.md CHANGED
@@ -33,7 +33,7 @@ npm install -g dflow-sdd-ddd
33
33
  dflow init
34
34
  ```
35
35
 
36
- init 流程會詢問是 greenfield 或 brownfield,接著預覽即將建立的檔案。既有檔案不會被覆寫。Init 只建立 workflow 文件與 AI 指示檔,**不會**檢查、重構、或遷移你的應用程式碼。
36
+ init 流程會詢問是 greenfield 或 brownfield、團隊採用的 Git policy(GitFlow / Trunk)、以及 AI commit 的標記方式,接著預覽即將建立的檔案。既有檔案不會被覆寫。Init 只建立 workflow 文件與 AI 指示檔,**不會**檢查、重構、或遷移你的應用程式碼。
37
37
 
38
38
  若專案已初始化、之後又要加入另一個 AI 程式設計工具,執行:
39
39
 
@@ -190,7 +190,7 @@ dflow/
190
190
  └── completed/
191
191
  ```
192
192
 
193
- Dflow 也會為你的 AI 程式設計助理建立或提供可合併的專案指示檔;確切檔名取決於目標工具與既有專案設定。Dflow 不覆寫既有專案指示。
193
+ Dflow 也會為你的 AI 程式設計助理建立或更新專案指示檔;確切檔名取決於目標工具與既有專案設定。Dflow 不覆寫既有專案指示中的自訂內容。
194
194
 
195
195
  選擇 AI agent 設定時,Dflow 把 `dflow/specs/shared/AI-AGENT-GUIDE.md` 作為 canonical 專案指南,並為每個 AI 工具建立**小型的指向檔**(俗稱 shim,內容很短,只是把該工具引導去讀 canonical 指南):
196
196
 
@@ -200,9 +200,15 @@ Dflow 也會為你的 AI 程式設計助理建立或提供可合併的專案指
200
200
  | Claude Code | `CLAUDE.md` |
201
201
  | GitHub Copilot | `.github/copilot-instructions.md` |
202
202
 
203
- 若這些檔案已存在,Dflow 不會覆蓋,改寫 merge snippet 到 `dflow/specs/shared/`。專案指南保持單一 source of truth,團隊就能用多個 AI 工具而不必維護多份 workflow 規則。
203
+ 若這些檔案已存在,Dflow 不會覆蓋自訂內容;已是 Dflow-generated shim 的檔案
204
+ 會原地刷新,其他已指向 `dflow/specs/shared/AI-AGENT-GUIDE.md` 的檔案會略過。
205
+ 若檔案尚未指向 guide,預設會在確認 preview 顯示並於檔案末尾附加帶有
206
+ `<!-- dflow-generated: agent-shim START/END -->` markers 的 Dflow block,重跑會
207
+ 原地更新同一段且不重複。只有檔案內有衝突或 malformed Dflow markers 時,
208
+ 才會改寫 fallback merge snippet 到 `dflow/specs/shared/`。專案指南保持單一
209
+ source of truth,團隊就能用多個 AI 工具而不必維護多份 workflow 規則。
204
210
 
205
- 之後團隊採用新 AI 程式設計助理時,可隨時跑 `dflow configure-agents` 新增 shim;若需要 Claude / Copilot 的工具原生命令入口,改用 `dflow configure-agents --command-adapters`。
211
+ 之後團隊採用新 AI 程式設計助理時,可隨時跑 `dflow configure-agents` 新增 shim;若需要 Claude / Copilot 的工具原生命令入口,改用 `dflow configure-agents --command-adapters`;若要自然語言自動觸發(為 Claude Code 與 Codex 投影專案層 skill),改用 `dflow configure-agents --skills`。
206
212
 
207
213
  ### 產生物的版控政策(建議預設)
208
214
 
@@ -210,9 +216,10 @@ Dflow 也會為你的 AI 程式設計助理建立或提供可合併的專案指
210
216
 
211
217
  | 檔案 | 角色 | 建議預設 |
212
218
  |---|---|---|
213
- | `dflow/`(canonical guide、規格、merge snippet) | source | **版控** |
214
- | 薄 shim(`CLAUDE.md` / `AGENTS.md` / `.github/copilot-instructions.md`) | source | **版控** |
219
+ | `dflow/`(canonical guide、規格、fallback merge snippet) | source | **版控** |
220
+ | 薄 shim 或既有 root agent 檔案中的 marked Dflow block(`CLAUDE.md` / `AGENTS.md` / `.github/copilot-instructions.md`) | source | **版控** |
215
221
  | `.claude/commands/dflow/`、`.github/prompts/dflow-*.prompt.md` | 衍生物 | **建議不版控(gitignore)**,clone 後重跑 `configure-agents --command-adapters` 重生成 |
222
+ | `.claude/skills/dflow/`、`.agents/skills/dflow/` | 衍生物 | **建議不版控(gitignore)**,clone 後重跑 `configure-agents --skills` 重生成 |
216
223
 
217
224
  這是**建議**,不是唯一正解。若團隊希望 clone 後立即有原生 `/` 選單、或 CI / 開發環境不裝 npm,**版控 adapter** 也是合理選擇——代價是升級若改了命名,要重投影並 commit 刪除舊檔。關鍵原則:**同一專案對所有工具採一致策略**,別像常見的踩雷一樣一邊 ignore、一邊版控。
218
225
 
@@ -263,7 +270,7 @@ Dflow 指令依角色分四類。「我要做的事」對應到指令的速查
263
270
  |---|---|---|
264
271
  | `/dflow:verify` | 需要確認文件、程式、測試、債務紀錄是否一致 | 跨規格、領域文件、實作、測試、債務的 drift report |
265
272
  | `/dflow:pr-review` | 變更已準備接受審查 | SDD/DDD 合規 review 清單,含風險、缺口、後續項目 |
266
- | `/dflow:report-dflow-feedback` | 你或 AI 在使用中發現 Dflow 本身的問題 | sanitized 的本地 feedback 草稿;不自動送出 |
273
+ | `/dflow:report-dflow-feedback` | 你或 AI 在使用中發現 Dflow 本身的問題 | sanitized 的本地草稿,逐欄對齊上游 issue 表單可直接貼上;不自動送出 |
267
274
 
268
275
  ### 該選哪個指令(rule of thumb)
269
276
 
@@ -328,4 +335,4 @@ GitHub 上的 source 可能包含 `0.2.0` 之後尚未發佈的 repo 變更。
328
335
 
329
336
  ## 授權
330
337
 
331
- MIT License,見 [LICENSE](LICENSE)。
338
+ GNU Affero General Public License v3.0 或更新版本(AGPL-3.0-or-later),見 [LICENSE](LICENSE)。
@@ -25,7 +25,6 @@ The matrix lists Brownfield / Greenfield logical template parity so reviewers ca
25
25
  | ADR guide | `dflow/specs/architecture/decisions/README.md` | n/a | `scaffolding/architecture-decisions-README.md` | Greenfield only | Brownfield not applicable | - |
26
26
  | Project AI guide | `dflow/specs/shared/AI-AGENT-GUIDE.md` when at least one AI agent is selected during init | `scaffolding/AI-AGENT-GUIDE.md` | `scaffolding/AI-AGENT-GUIDE.md` | Same canonical tool-neutral workflow guide and source-of-truth pointers | Track-specific seeded values and available source-of-truth paths may differ | - |
27
27
  | AI tool shims | `AGENTS.md`, `CLAUDE.md`, `.github/copilot-instructions.md`, or merge snippets under `dflow/specs/shared/` | generated by CLI | generated by CLI | Thin files must point back to `dflow/specs/shared/AI-AGENT-GUIDE.md`; existing files are not overwritten | Tool-specific import hints differ | - |
28
- | Legacy Claude guide template | `<project root>/CLAUDE.md` | `templates/CLAUDE.md` | `templates/CLAUDE.md` | H2 navigation and H3 structural headings aligned (canonical English, per F-01 Path A) | Greenfield includes Aggregate / Architecture Decisions and other Greenfield-specific H3 sections | - |
29
28
 
30
29
  ## Reference Flow Parity
31
30
 
package/bin/dflow.js CHANGED
@@ -22,8 +22,9 @@ function printInitHelp() {
22
22
  dflow init
23
23
 
24
24
  Initializes Dflow project specs under dflow/specs/.
25
- The command prompts for project type, tech stack, prose language,
26
- optional starter files, and AI coding agents before showing a full file preview.
25
+ The command prompts for project type, tech stack, migration context, prose
26
+ language, Git policy, AI commit marker, optional starter files, and AI coding
27
+ agents before showing a full file preview.
27
28
  `);
28
29
  }
29
30
 
@@ -38,7 +39,7 @@ dflow/specs/shared/AI-AGENT-GUIDE.md file.
38
39
 
39
40
  Options:
40
41
  --command-adapters Also generate tool-native thin wrappers for supported tools.
41
- --skills Also generate a supported tool's skill adapter (currently Claude Code project skill, restores natural-language auto-trigger).
42
+ --skills Also generate project-level skill adapters for supported tools (Claude Code and Codex), restoring natural-language auto-trigger.
42
43
  `);
43
44
  }
44
45
 
@@ -42,15 +42,18 @@ in your project's `dflow/specs/` directory and AI instruction files.
42
42
  completion checklists, templates). This bundle is projected from the npm
43
43
  package at init time so workflows are reachable from any clone without
44
44
  needing the Dflow source or package installed locally.
45
- - Mergeable AI agent instruction files for the tools you select (e.g.,
46
- `CLAUDE.md`, `AGENTS.md`, `.github/copilot-instructions.md`). Each is a
47
- thin pointer to the canonical guide and workflow bundle.
45
+ - AI agent instruction files, or marked Dflow blocks inside existing files, for
46
+ the tools you select (e.g., `CLAUDE.md`, `AGENTS.md`,
47
+ `.github/copilot-instructions.md`). Each points the tool to the canonical
48
+ guide and workflow bundle.
48
49
 
49
50
  `init` does **not**:
50
51
 
51
52
  - Inspect, refactor, or migrate your application code.
52
- - Overwrite existing AI agent instruction files; if one exists, Dflow writes
53
- a merge snippet under `dflow/specs/shared/` instead.
53
+ - Overwrite custom content in existing AI agent instruction files; if one
54
+ exists, Dflow refreshes Dflow-generated shims, leaves a file that already
55
+ points to the guide as-is, shows and appends a marked Dflow block by default
56
+ otherwise, and writes a fallback merge snippet only on marker conflicts.
54
57
  - Modify your build system, package manager, or dependencies.
55
58
  - Send any data anywhere; it is a local scaffolding command.
56
59
 
@@ -177,8 +180,9 @@ Dflow is designed for low cost to try and low cost to leave:
177
180
  - Nothing depends on the `dflow-sdd-ddd` CLI being installed after `init`.
178
181
  - The generated files are plain Markdown; remove Dflow from a project with
179
182
  `rm -rf dflow/` plus deleting the AI agent shim files you no longer want.
180
- - Existing project instruction files (e.g., a pre-existing `CLAUDE.md`) are
181
- not modified by Dflow, so reverting is straightforward.
183
+ - If an existing project instruction file (e.g., a pre-existing `CLAUDE.md`)
184
+ received a marked Dflow block, remove that block to revert it; later
185
+ `init` / `configure-agents` runs will append it again.
182
186
 
183
187
  This means an evaluation pass leaves no permanent footprint if you decide
184
188
  not to adopt.
@@ -31,13 +31,16 @@ Dflow 是 Markdown-based 的 workflow 材料加上一個 scaffolding CLI。它
31
31
  各 `/dflow:*` workflow 的可執行步驟定義(step gates、completion checklists、模板)。
32
32
  這個 bundle 在 init 時從 npm 套件投影進專案,因此 workflow 步驟是 self-contained
33
33
  且可達的,任何 clone 都不需要 Dflow source 或 package 在本機安裝。
34
- - 你所選工具的可合併 AI 指示檔(例如 `CLAUDE.md`、`AGENTS.md`、`.github/copilot-instructions.md`)。
35
- 每個都是指向 canonical 指南與 workflow bundle 的薄 shim。
34
+ - 你所選工具的 AI 指示檔或既有檔案中的 marked Dflow block(例如 `CLAUDE.md`、`AGENTS.md`、`.github/copilot-instructions.md`)。
35
+ 每個都把工具指向 canonical 指南與 workflow bundle。
36
36
 
37
37
  `init` **不會**:
38
38
 
39
39
  - 檢查、重構、或遷移你的應用程式碼。
40
- - 覆寫既有的 AI 指示檔;若檔案已存在,Dflow 改在 `dflow/specs/shared/` 下寫入 merge snippet。
40
+ - 覆寫既有 AI 指示檔中的自訂內容;若檔案已存在,Dflow 會刷新
41
+ Dflow-generated shim,已指向 guide 的檔案則保持原樣,其他情況預設在確認
42
+ preview 顯示並附加 marked Dflow block,只有 marker conflict 才寫 fallback
43
+ merge snippet。
41
44
  - 修改你的建構系統、套件管理工具、或相依套件。
42
45
  - 傳送任何資料到外部;它是本機的 scaffolding 指令。
43
46
 
@@ -136,7 +139,9 @@ Dflow 的設計讓試用成本低、退出成本也低:
136
139
 
137
140
  - `init` 完成後,你的專案不依賴已安裝的 `dflow-sdd-ddd` CLI。
138
141
  - 產生的檔案都是純 Markdown;用 `rm -rf dflow/` 加上刪除你不再需要的 AI 指示 shim 檔案,即可從專案中移除 Dflow。
139
- - 既有的專案指示檔(例如原本就存在的 `CLAUDE.md`)不會被 Dflow 修改,因此復原很直接。
142
+ - 既有的專案指示檔(例如原本就存在的 `CLAUDE.md`)若被加入 marked Dflow
143
+ block,刪除該 block 即可復原;但之後再跑 `init` / `configure-agents`
144
+ 會再附加它。
140
145
 
141
146
  這表示評估一輪後,若你決定不採用,不會留下任何永久痕跡。
142
147
 
@@ -174,9 +174,13 @@ dflow configure-agents
174
174
  ```
175
175
 
176
176
  This command adds shims for any AI tools you select. `dflow configure-agents`
177
- does not overwrite an existing `CLAUDE.md`; instead, it writes a
178
- `dflow/specs/shared/<tool>-md-snippet.md` that you can merge into the
179
- existing file at your own pace.
177
+ does not overwrite custom content in an existing root instruction file. If it
178
+ recognizes an older Dflow-generated shim, it refreshes that file to the current
179
+ thin shim in place; a file that already points to the guide is left as-is;
180
+ otherwise it shows the change in the preview and appends a marked Dflow block to
181
+ the existing file. It writes a manual-merge snippet under
182
+ `dflow/specs/shared/<tool>-md-snippet.md` only when the file contains
183
+ conflicting or malformed Dflow markers.
180
184
 
181
185
  If you prefer a fully clean V1 layout, archive the existing root
182
186
  instruction file under another name first, then run
@@ -45,18 +45,18 @@ selecting Claude Code as a target tool creates a thin shim at the project root:
45
45
 
46
46
  This project uses Dflow for spec-first AI-assisted development.
47
47
 
48
- Before planning or editing code, read and follow:
48
+ For spec-impacting work — a new feature, a change to product, user-facing, or
49
+ domain behavior, a new requirement, or a bug-fix workflow — read and follow:
49
50
 
50
- - `dflow/specs/shared/AI-AGENT-GUIDE.md`
51
+ - `dflow/specs/shared/AI-AGENT-GUIDE.md` — command registry, routing rules, and project context.
52
+ - `dflow/specs/shared/dflow-workflows/` — vendored workflow bundle with executable step definitions.
51
53
 
52
- Keep tool-specific instruction files small. The Dflow guide above is the
53
- single source of truth for project workflow rules, slash-command behavior,
54
- spec locations, and SDD/DDD constraints.
55
-
56
- If your tool supports Markdown imports, the canonical guide is imported
57
- below:
54
+ For routine work (refactors, renames, chores, formatting, dependency bumps, or
55
+ general code questions), proceed normally; you need not read the guide first.
58
56
 
59
- @dflow/specs/shared/AI-AGENT-GUIDE.md
57
+ Keep tool-specific instruction files small. The guide and workflow bundle are
58
+ the authoritative sources for Dflow workflow rules, slash-command behavior,
59
+ spec locations, and SDD/DDD constraints.
60
60
  ```
61
61
 
62
62
  Two things happen when Claude Code starts in this project:
@@ -64,9 +64,11 @@ Two things happen when Claude Code starts in this project:
64
64
  1. Claude Code automatically loads `CLAUDE.md` from the project root into
65
65
  its context. This is Claude Code's standard project instructions
66
66
  mechanism.
67
- 2. The trailing `@dflow/specs/shared/AI-AGENT-GUIDE.md` line uses Claude
68
- Code's Markdown import syntax to inline the canonical Dflow guide. So
69
- Claude Code effectively reads both files as one set of instructions.
67
+ 2. `CLAUDE.md` is a thin pointer: it names the canonical guide but does not
68
+ inline it. The guide is loaded on demand — the `dflow` skill pulls it in
69
+ when relevant work auto-triggers the skill, or the agent follows the
70
+ pointer for spec-impacting work. This keeps the guide out of every
71
+ session's context (progressive disclosure) instead of force-loading it.
70
72
 
71
73
  The canonical guide (`dflow/specs/shared/AI-AGENT-GUIDE.md`) is the
72
74
  **command registry and router**: project context (track, tech stack, prose
@@ -79,9 +81,14 @@ checked into your repo, so they travel with the project when cloned. The
79
81
  without Claude-Code-specific edits.
80
82
 
81
83
  If a `CLAUDE.md` already existed in the project, `init` does not overwrite
82
- it. Instead it writes a merge snippet under `dflow/specs/shared/` that you
83
- can paste into your existing `CLAUDE.md` manually. This avoids destroying
84
- custom project instructions you already had.
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
87
+ confirmation preview and appends a marked
88
+ `<!-- dflow-generated: agent-shim START/END -->` block at the end of the file;
89
+ re-running refreshes that same block in place without duplicating it. Dflow
90
+ writes the fallback merge snippet `dflow/specs/shared/CLAUDE-md-snippet.md` only
91
+ when the file contains conflicting or malformed Dflow markers.
85
92
 
86
93
  ## Using Dflow Slash Commands in Claude Code
87
94
 
@@ -225,6 +232,12 @@ This skill does not copy workflow steps; its body points to the canonical
225
232
  `dflow/specs/shared/AI-AGENT-GUIDE.md` (command registry and routing rules) and
226
233
  `dflow/specs/shared/dflow-workflows/` (vendored bundle with executable step
227
234
  definitions).
235
+
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
238
+ (`.github/skills/dflow/SKILL.md`); all three follow the same cross-tool
239
+ agentskills.io standard.
240
+
228
241
  Its behavior:
229
242
 
230
243
  - **Auto-triggers on** feature / bug-fix workflows, product/domain behavior
@@ -275,7 +288,7 @@ across tools. Only the root-level shim differs:
275
288
 
276
289
  | Tool | Generated shim | Loads canonical guide via |
277
290
  |---|---|---|
278
- | Claude Code | `CLAUDE.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
291
+ | Claude Code | `CLAUDE.md` | Reads file content directly when starting |
279
292
  | Codex / Copilot coding agent | `AGENTS.md` | Reads file content directly when starting |
280
293
  | GitHub Copilot | `.github/copilot-instructions.md` | Reads file content directly |
281
294
 
@@ -315,16 +328,20 @@ their own approval gates (e.g., "I drafted the spec — do you want me to
315
328
  proceed to implementation?"). Both can fire on the same action; this is
316
329
  expected and not a sign of misconfiguration.
317
330
 
318
- **The `@` import is not recursive.** `CLAUDE.md` imports
319
- `AI-AGENT-GUIDE.md`, but if `AI-AGENT-GUIDE.md` references other files
320
- (e.g., feature specs), those are not auto-loaded — Claude Code reads them
321
- on demand when entering the relevant workflow. This keeps context usage
331
+ **Guide references are not all loaded at once.** `CLAUDE.md` points to
332
+ `AI-AGENT-GUIDE.md`, and the other files `AI-AGENT-GUIDE.md` references
333
+ (e.g., feature specs) are also read on demand — Claude Code reads them
334
+ when entering the relevant workflow. This keeps context usage
322
335
  proportional to active work.
323
336
 
324
337
  **A pre-existing `CLAUDE.md` is preserved.** `init` will not overwrite your
325
- existing project instructions. Look under `dflow/specs/shared/` for the
326
- merge snippet `init` wrote and paste the relevant sections into your
327
- existing `CLAUDE.md` manually.
338
+ custom project instructions. Dflow-generated shims are refreshed in place; it
339
+ skips other files that already point to `AI-AGENT-GUIDE.md`. Otherwise it shows
340
+ the marked Dflow block in the confirmation preview, then refreshes that same
341
+ block in place on later runs.
342
+ If you delete the block, the next `init` / `configure-agents` run appends it
343
+ again. Look under `dflow/specs/shared/` for a fallback merge snippet only when
344
+ there is a marker conflict to resolve manually.
328
345
 
329
346
  **Cross-machine projects work.** `dflow/specs/` is plain Markdown checked
330
347
  into your repo. Anyone cloning the repo and using Claude Code in it will
@@ -40,27 +40,28 @@ commands 是如何被識別的,以及幾個值得了解的 Claude Code 專屬
40
40
 
41
41
  This project uses Dflow for spec-first AI-assisted development.
42
42
 
43
- Before planning or editing code, read and follow:
43
+ For spec-impacting work — a new feature, a change to product, user-facing, or
44
+ domain behavior, a new requirement, or a bug-fix workflow — read and follow:
44
45
 
45
- - `dflow/specs/shared/AI-AGENT-GUIDE.md`
46
+ - `dflow/specs/shared/AI-AGENT-GUIDE.md` — command registry, routing rules, and project context.
47
+ - `dflow/specs/shared/dflow-workflows/` — vendored workflow bundle with executable step definitions.
46
48
 
47
- Keep tool-specific instruction files small. The Dflow guide above is the
48
- single source of truth for project workflow rules, slash-command behavior,
49
- spec locations, and SDD/DDD constraints.
50
-
51
- If your tool supports Markdown imports, the canonical guide is imported
52
- below:
49
+ For routine work (refactors, renames, chores, formatting, dependency bumps, or
50
+ general code questions), proceed normally; you need not read the guide first.
53
51
 
54
- @dflow/specs/shared/AI-AGENT-GUIDE.md
52
+ Keep tool-specific instruction files small. The guide and workflow bundle are
53
+ the authoritative sources for Dflow workflow rules, slash-command behavior,
54
+ spec locations, and SDD/DDD constraints.
55
55
  ```
56
56
 
57
57
  Claude Code 在這個專案中啟動時,會發生兩件事:
58
58
 
59
59
  1. Claude Code 自動從專案根目錄載入 `CLAUDE.md` 到它的 context 中。
60
60
  這是 Claude Code 的標準專案指示機制。
61
- 2. 末尾的 `@dflow/specs/shared/AI-AGENT-GUIDE.md` 這行使用 Claude Code 的
62
- Markdown import 語法,將 canonical Dflow 指南 inline 嵌入。因此 Claude Code
63
- 等效於把兩個檔案當成一組指示來讀取。
61
+ 2. `CLAUDE.md` 是一份薄指標,只指向 canonical 指南、不把它 inline 進來。
62
+ 指南改為按需載入——`dflow` skill 在相關工作自動觸發時把它讀進來,或由
63
+ AI 在做 spec-impacting 工作時跟著指標讀取。指南因此不會被塞進每個 session 的
64
+ context(progressive disclosure),而非每次強制載入。
64
65
 
65
66
  canonical 指南(`dflow/specs/shared/AI-AGENT-GUIDE.md`)是**命令登錄表與路由器**:
66
67
  專案上下文(track、技術棧、文章語言)、`/dflow:*` workflow 表、source-of-truth
@@ -71,9 +72,12 @@ completion checklists)則放在 `init` 投影進專案的 **vendored workflow
71
72
  `CLAUDE.md` shim 刻意保持精簡,這樣 canonical 指南就能在不需要 Claude Code
72
73
  專屬修改的情況下持續演進。
73
74
 
74
- 如果專案中已有 `CLAUDE.md`,`init` 不會覆蓋它。它改為在
75
- `dflow/specs/shared/` 下寫入 merge snippet,讓你手動貼入現有的 `CLAUDE.md`。
76
- 這樣可以避免破壞你已有的自訂專案指示。
75
+ 如果專案中已有 `CLAUDE.md`,`init` 不會覆蓋自訂內容。已是 Dflow-generated shim
76
+ 的檔案會原地刷新;其他已指向 `dflow/specs/shared/AI-AGENT-GUIDE.md` 的檔案會
77
+ 略過,不會新增第二個指標。否則 Dflow 會在確認 preview 顯示並於檔案末尾附加帶有
78
+ `<!-- dflow-generated: agent-shim START/END -->` markers 的 Dflow block;重跑
79
+ 會原地更新同一段,不會重複。只有遇到衝突或 malformed Dflow markers 時,
80
+ 才會改寫 `dflow/specs/shared/CLAUDE-md-snippet.md` fallback merge snippet 讓你手動處理。
77
81
 
78
82
  ## 在 Claude Code 中使用 Dflow Slash Commands
79
83
 
@@ -199,6 +203,11 @@ dflow configure-agents --skills
199
203
  這份 skill 不複製 workflow 步驟,body 指向 canonical
200
204
  `dflow/specs/shared/AI-AGENT-GUIDE.md`(命令登錄表與路由規則)以及
201
205
  `dflow/specs/shared/dflow-workflows/`(含可執行步驟定義的 vendored bundle)。
206
+
207
+ 同一份 edition-neutral skill source,現在也會由 `--skills` 為 Codex
208
+ (`.agents/skills/dflow/SKILL.md`)與 GitHub Copilot(`.github/skills/dflow/SKILL.md`)
209
+ 投影 project-level skill,三家沿用相同的跨工具 agentskills.io 標準。
210
+
202
211
  它的行為:
203
212
 
204
213
  - **自動觸發於** feature / bug-fix workflow、product/domain behavior 變更、新需求、
@@ -239,7 +248,7 @@ canonical 指南(`dflow/specs/shared/AI-AGENT-GUIDE.md`)在各工具之間
239
248
 
240
249
  | 工具 | 產生的 shim | 載入 canonical 指南的方式 |
241
250
  |---|---|---|
242
- | Claude Code | `CLAUDE.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
251
+ | Claude Code | `CLAUDE.md` | 啟動時直接讀取檔案內容 |
243
252
  | Codex / Copilot coding agent | `AGENTS.md` | 啟動時直接讀取檔案內容 |
244
253
  | GitHub Copilot | `.github/copilot-instructions.md` | 直接讀取檔案內容 |
245
254
 
@@ -274,14 +283,16 @@ adapter wrapper 必須保持薄指標,不應複製 workflow 語義。
274
283
  「我已起草 spec —— 你要我繼續進入實作嗎?」)。兩者可能在同一個動作上同時觸發;
275
284
  這是預期行為,不代表設定有誤。
276
285
 
277
- **`@` import 不是遞迴的。** `CLAUDE.md` import 了 `AI-AGENT-GUIDE.md`,但如果
278
- `AI-AGENT-GUIDE.md` 引用了其他檔案(例如 feature spec),那些檔案不會被自動
279
- 載入 —— Claude Code 會在進入對應 workflow 時按需讀取它們。這樣可以讓 context
280
- 用量與正在進行的工作保持比例。
286
+ **指南的引用不會被一次全部載入。** `CLAUDE.md` 指向 `AI-AGENT-GUIDE.md`;而
287
+ `AI-AGENT-GUIDE.md` 引用的其他檔案(例如 feature spec)也是按需載入 —— Claude
288
+ Code 會在進入對應 workflow 時才讀取它們。這樣可以讓 context 用量與正在進行的
289
+ 工作保持比例。
281
290
 
282
- **既有的 `CLAUDE.md` 會被保留。** `init` 不會覆蓋你現有的專案指示。請到
283
- `dflow/specs/shared/` 下找 `init` 寫入的 merge snippet,並手動將相關段落貼入
284
- 你現有的 `CLAUDE.md`。
291
+ **既有的 `CLAUDE.md` 會被保留。** `init` 不會覆蓋你現有的自訂專案指示;已是
292
+ Dflow-generated shim 會原地刷新,其他已指向 `AI-AGENT-GUIDE.md` 的檔案會略過,
293
+ 否則會在確認 preview 顯示要附加的 marked Dflow block,寫入後重跑會原地更新同一段。
294
+ 若你刪除該 block,下一次 `init` / `configure-agents` 會再附加它;只有 marker
295
+ conflict 時才需要到 `dflow/specs/shared/` 找 fallback merge snippet 手動處理。
285
296
 
286
297
  **跨機器專案可正常運作。** `dflow/specs/` 是純 Markdown,已 check in 到你的
287
298
  repo。任何人 clone 該 repo 並在其中使用 Claude Code,都會透過已 commit 的