dflow-sdd-ddd 0.9.0 → 0.11.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.
- package/CHANGELOG.md +96 -0
- package/README.en.md +73 -48
- package/README.md +46 -36
- package/TEMPLATE-COVERAGE.md +0 -1
- package/TEMPLATE-LANGUAGE-GLOSSARY.md +1 -0
- package/bin/dflow.js +7 -11
- package/docs/evaluating-dflow.en.md +11 -7
- package/docs/evaluating-dflow.md +9 -4
- package/docs/using-with-claude-code.en.md +40 -23
- package/docs/using-with-claude-code.md +34 -23
- package/docs/using-with-codex.en.md +125 -42
- package/docs/using-with-codex.md +93 -34
- package/docs/using-with-github-copilot.en.md +135 -34
- package/docs/using-with-github-copilot.md +120 -43
- package/docs/why-dflow.en.md +72 -0
- package/docs/why-dflow.md +72 -0
- package/lib/init.js +867 -214
- package/package.json +2 -2
- package/templates/brownfield/references/drift-verification.md +41 -10
- package/templates/brownfield/references/finish-feature-flow.md +3 -2
- package/templates/brownfield/references/git-integration.md +0 -1
- package/templates/brownfield/references/init-project-flow.md +31 -17
- package/templates/brownfield/references/modify-existing-flow.md +44 -38
- package/templates/brownfield/references/new-feature-flow.md +41 -11
- package/templates/brownfield/references/new-phase-flow.md +9 -2
- package/templates/brownfield/references/pr-review-checklist.md +7 -1
- package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +258 -29
- package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +5 -8
- package/templates/brownfield/scaffolding/_conventions.md +10 -9
- package/templates/brownfield/templates/_index.md +1 -1
- package/templates/brownfield/templates/context-map.md +12 -4
- package/templates/brownfield/templates/lightweight-spec.md +1 -1
- package/templates/brownfield/templates/phase-spec.md +1 -1
- package/templates/common/references/ddd-modeling-guide.md +643 -0
- package/templates/common/skill/SKILL.md +9 -6
- package/templates/greenfield/references/drift-verification.md +60 -15
- package/templates/greenfield/references/finish-feature-flow.md +3 -2
- package/templates/greenfield/references/git-integration.md +0 -1
- package/templates/greenfield/references/init-project-flow.md +31 -17
- package/templates/greenfield/references/modify-existing-flow.md +5 -7
- package/templates/greenfield/references/new-feature-flow.md +49 -19
- package/templates/greenfield/references/new-phase-flow.md +5 -2
- package/templates/greenfield/references/pr-review-checklist.md +9 -1
- package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +221 -29
- package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +10 -15
- package/templates/greenfield/scaffolding/Git-principles-trunk.md +1 -1
- package/templates/greenfield/scaffolding/_conventions.md +9 -8
- package/templates/greenfield/templates/_index.md +1 -1
- package/templates/greenfield/templates/aggregate-design.md +6 -0
- package/templates/greenfield/templates/context-map.md +13 -4
- package/templates/greenfield/templates/events.md +4 -1
- package/templates/greenfield/templates/lightweight-spec.md +1 -1
- package/templates/greenfield/templates/phase-spec.md +1 -1
- package/docs/migrating-to-dflow-v1.md +0 -230
- package/templates/brownfield/templates/CLAUDE.md +0 -165
- package/templates/greenfield/references/ddd-modeling-guide.md +0 -351
- package/templates/greenfield/templates/CLAUDE.md +0 -172
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
> **繁體中文** | [English](using-with-github-copilot.en.md)
|
|
4
4
|
|
|
5
|
-
當你的 AI 程式設計助理是 GitHub Copilot
|
|
5
|
+
當你的 AI 程式設計助理是 GitHub Copilot 時,Dflow 的使用體驗 walk-through。GitHub
|
|
6
|
+
Copilot 有兩個介面——**VS Code Copilot Chat**(IDE 內的 chat panel + inline
|
|
7
|
+
completions)與 **GitHub Copilot CLI**(終端機)——兩者觸發 Dflow 與調用命令的方式
|
|
8
|
+
不同,本指南會分開說明。閱讀約需 10 分鐘。
|
|
6
9
|
|
|
7
10
|
本指南專注於 GitHub Copilot 的具體使用體驗。工具中立的評估流程請見
|
|
8
11
|
[`docs/evaluating-dflow.md`](evaluating-dflow.md)。完整的 Get Started
|
|
@@ -12,8 +15,8 @@
|
|
|
12
15
|
|
|
13
16
|
你正在使用或評估以 GitHub Copilot 作為 AI 程式設計助理的 Dflow。
|
|
14
17
|
本指南說明 `init` 之後 Copilot 看到了什麼、repository shim 的位置、
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
如何在 VS Code Copilot Chat 與 Copilot CLI 兩個介面呼叫 Dflow workflow,
|
|
19
|
+
以及幾個值得了解的 Copilot 專屬使用模式與 permission 行為。
|
|
17
20
|
|
|
18
21
|
## 前置條件
|
|
19
22
|
|
|
@@ -36,28 +39,36 @@
|
|
|
36
39
|
|
|
37
40
|
This project uses Dflow for spec-first AI-assisted development.
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
For spec-impacting work — a new feature, a change to product, user-facing, or
|
|
43
|
+
domain behavior, a new requirement, or a bug-fix workflow — read and follow:
|
|
40
44
|
|
|
41
|
-
- `dflow/specs/shared/AI-AGENT-GUIDE.md`
|
|
45
|
+
- `dflow/specs/shared/AI-AGENT-GUIDE.md` — command registry, routing rules, and project context.
|
|
46
|
+
- `dflow/specs/shared/dflow-workflows/` — vendored workflow bundle with executable step definitions.
|
|
47
|
+
|
|
48
|
+
For routine work (refactors, renames, chores, formatting, dependency bumps, or
|
|
49
|
+
general code questions), proceed normally; you need not read the guide first.
|
|
50
|
+
|
|
51
|
+
Keep tool-specific instruction files small. The guide and workflow bundle are
|
|
52
|
+
the authoritative sources for Dflow workflow rules, slash-command behavior,
|
|
53
|
+
spec locations, and SDD/DDD constraints.
|
|
42
54
|
```
|
|
43
55
|
|
|
44
56
|
重點說明:
|
|
45
57
|
|
|
46
58
|
- Copilot shim 位於 `.github/copilot-instructions.md`(見 `lib/init.js` mapping)。
|
|
47
|
-
- Copilot shim
|
|
59
|
+
- Copilot shim 是薄指標,只透過路徑指向 canonical 指南;讀取
|
|
48
60
|
`dflow/specs/shared/AI-AGENT-GUIDE.md` 時需明確開啟該檔案。
|
|
49
61
|
|
|
50
62
|
## 在 GitHub Copilot 中使用 Dflow Workflow 指令
|
|
51
63
|
|
|
52
|
-
|
|
53
|
-
CLI 工具。請把 Dflow workflow 名稱當成普通的對話指示,而非 CLI slash command:
|
|
64
|
+
GitHub Copilot 有兩個介面,Dflow 在兩者的觸發與命令行為不同,先分清楚再用:
|
|
54
65
|
|
|
55
|
-
-
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
|
|
66
|
+
- **VS Code Copilot Chat**(IDE 內的 chat panel):自然語言**會自動觸發** Dflow
|
|
67
|
+
的 skill;若你 opt in prompt adapters,工具原生命令 `/dflow-<id>`(連字號)也可用。
|
|
68
|
+
- **GitHub Copilot CLI**(終端機):**沒有**自然語言自動觸發;要先打 `/dflow`
|
|
69
|
+
**手動喚起** skill 再由它引導;per-id 的 `/dflow-<id>` 命令在 CLI **不可用**。
|
|
59
70
|
|
|
60
|
-
|
|
71
|
+
兩介面共用同一組 workflow 入口(詞彙相同,差別只在怎麼喚起):
|
|
61
72
|
|
|
62
73
|
| 指令 | 適用情境 |
|
|
63
74
|
|---|---|
|
|
@@ -70,9 +81,43 @@ CLI 工具。請把 Dflow workflow 名稱當成普通的對話指示,而非 CL
|
|
|
70
81
|
| `/dflow:pr-review` | 變更已準備好進行 SDD/DDD review。 |
|
|
71
82
|
| `/dflow:report-dflow-feedback` | 你發現了 Dflow 的問題或改進點,想要一份清理過的上游回饋草稿。 |
|
|
72
83
|
|
|
84
|
+
> **語法提醒**:表中 `/dflow:<id>`(**冒號**)是 Dflow 的 canonical 詞彙,也是
|
|
85
|
+
> Claude / Codex 的**實際命令**語法。Copilot 的 prompt-adapter 命令改用
|
|
86
|
+
> `/dflow-<id>`(**連字號**),且只在 VS Code 活;在 Copilot 裡不要照字面把冒號
|
|
87
|
+
> 形式當命令輸入(Copilot CLI 會把 `/dflow:new-feature` 斷成 `/dflow`)。下面分介面
|
|
88
|
+
> 說明各自怎麼呼叫。
|
|
89
|
+
|
|
90
|
+
### 介面 A:VS Code Copilot Chat
|
|
91
|
+
|
|
92
|
+
- **自動觸發**:有。在 chat 直接用自然語言描述要做的事(例:「I want to add CSV
|
|
93
|
+
export for users」),Dflow 的 skill 會自動 engage、判斷對應 workflow,並以
|
|
94
|
+
**suggest-and-wait**(建議命令、等你確認)開始,不會擅自跑完整個 workflow。
|
|
95
|
+
- **命令**:`/dflow-<id>`(**連字號**)可用,但需先在專案跑
|
|
96
|
+
`dflow configure-agents --command-adapters` 投影
|
|
97
|
+
`.github/prompts/dflow-<id>.prompt.md`(見下節),之後在 prompt 選單選
|
|
98
|
+
`/dflow-new-feature` 即可。
|
|
99
|
+
- **純文字也行**:你也可以在 chat 用普通文字描述 workflow(例:`Run the Dflow
|
|
100
|
+
/dflow:new-feature workflow.`)——此時 `/dflow:new-feature` 只是被當成**文字
|
|
101
|
+
稱呼**,不是被當命令解析。
|
|
102
|
+
|
|
103
|
+
### 介面 B:GitHub Copilot CLI
|
|
104
|
+
|
|
105
|
+
- **自動觸發**:**無**。直接送自然語言**不會** engage Dflow 的 skill。
|
|
106
|
+
- **喚起方式**:先打 `/dflow`(無 id 後綴)**手動喚起** skill;skill engage 後會
|
|
107
|
+
列出可用的 workflow / 問你要做什麼,接著你用**自然語言描述**(例:「I want to
|
|
108
|
+
add CSV export」)或回覆它列的選項即可繼續。它一樣以 suggest-and-wait 運作。
|
|
109
|
+
- **命令**:per-id 的 `/dflow-<id>` 在 CLI **不可用**——
|
|
110
|
+
`.github/prompts/dflow-<id>.prompt.md` 是 VS Code Chat 專屬、**CLI 不讀取**,
|
|
111
|
+
輸入 `/dflow-new-feature` 會得到 Unknown;冒號形式 `/dflow:new-feature` 則被
|
|
112
|
+
CLI 斷成 `/dflow`。CLI 沒有 per-id 命令入口,統一走「`/dflow` 喚起 → 會話描述」。
|
|
113
|
+
- **skill 建議的命令怎麼辦**:skill engage 後可能會建議你用某個 `/dflow:<id>`
|
|
114
|
+
(這是給 Claude / Codex 的 canonical 寫法)。在 Copilot **不必照字面輸入那串
|
|
115
|
+
命令**——CLI 裡 skill 已經 engage,直接在會話用文字描述要的 workflow、或回覆
|
|
116
|
+
確認即可;VS Code 裡則改用 prompt 選單的 `/dflow-<id>`(連字號)。
|
|
117
|
+
|
|
73
118
|
### 選配 Prompt Adapters
|
|
74
119
|
|
|
75
|
-
如果想在支援 prompt files 的
|
|
120
|
+
如果想在支援 prompt files 的 VS Code Copilot 環境中使用工具原生**命令**入口,可在
|
|
76
121
|
已初始化的專案中執行:
|
|
77
122
|
|
|
78
123
|
```bash
|
|
@@ -84,11 +129,28 @@ dflow configure-agents --command-adapters
|
|
|
84
129
|
|
|
85
130
|
- `.github/prompts/dflow-<id>.prompt.md`
|
|
86
131
|
|
|
87
|
-
這些 prompt
|
|
88
|
-
`/dflow-new-feature
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
132
|
+
這些 prompt **只在 VS Code Copilot Chat 的 prompt 選單**生效(形式為
|
|
133
|
+
`/dflow-<id>`,例如 `/dflow-new-feature`);**Copilot CLI 不讀取**
|
|
134
|
+
`.github/prompts/`,所以這條命令路徑在 CLI 不可用(見上方「介面 B」)。Prompt
|
|
135
|
+
內容只指向 canonical `/dflow:new-feature` workflow 與
|
|
136
|
+
`dflow/specs/shared/AI-AGENT-GUIDE.md`,不複製 workflow 步驟。注意命令語法用
|
|
137
|
+
**連字號** `/dflow-<id>`,不是 canonical 的**冒號** `/dflow:<id>`——後者是
|
|
138
|
+
Claude / Codex 的命令寫法,在 Copilot 只能當文字稱呼、不能當命令輸入。
|
|
139
|
+
|
|
140
|
+
### `--skills` flag 與 Copilot 的 skill 觸發
|
|
141
|
+
|
|
142
|
+
`dflow configure-agents --skills` 會為 **Claude Code、Codex 與 GitHub Copilot**
|
|
143
|
+
各自投影同一份工具中立的 thin skill 到它們的 project-level skill 路徑;Copilot 的是
|
|
144
|
+
`.github/skills/dflow/SKILL.md`。實測(2026-06-05)確認 Copilot 會從**自己原生的
|
|
145
|
+
`.github/skills/`** 探索並運作(即使移除 `.claude`/`.agents` 的跨讀路徑也成立),
|
|
146
|
+
觸發方式依介面而異——**VS Code Chat 自然語言自動觸發**、**Copilot CLI 需打 `/dflow`
|
|
147
|
+
手動喚起**(細節見上方介面 A / B)。
|
|
148
|
+
|
|
149
|
+
> 註:Copilot 也會跨讀 `.claude/skills` 與 `.agents/skills`;若你同一專案同時選了
|
|
150
|
+
> Copilot 與 Claude / Codex,同一份 `dflow` skill 可能從多條路徑被看到。Dflow **產生**
|
|
151
|
+
> 的各份內容逐字相同(同 `name`),所以正常情況一致;但若你在某條路徑已有自己的
|
|
152
|
+
> (非 Dflow)`dflow` skill,Dflow 會原地保留、不覆寫——它可能與原生那份內容不同,
|
|
153
|
+
> 建議移除或改名以免同名重複。
|
|
92
154
|
|
|
93
155
|
### 產生物的版控政策與升級
|
|
94
156
|
|
|
@@ -142,22 +204,33 @@ Copilot: Got it. I'll create the feature spec at dflow/specs/features/active/
|
|
|
142
204
|
|
|
143
205
|
### 既有的 Repository 指示
|
|
144
206
|
|
|
145
|
-
如果你的專案中已有 `.github/copilot-instructions.md`,`init`
|
|
146
|
-
|
|
147
|
-
|
|
207
|
+
如果你的專案中已有 `.github/copilot-instructions.md`,`init` 不會覆蓋自訂內容。
|
|
208
|
+
已是 Dflow-generated shim 的檔案會原地刷新;其他已指向
|
|
209
|
+
`dflow/specs/shared/AI-AGENT-GUIDE.md` 的檔案會略過。若既有檔案尚未指向 guide,
|
|
210
|
+
Dflow 會在確認 preview 顯示並於檔案末尾附加帶有
|
|
211
|
+
`<!-- dflow-generated: agent-shim START/END -->` markers 的 Dflow block;重跑會
|
|
212
|
+
原地更新同一段,不會重複。這樣可以避免破壞你已有的自訂 Copilot 指示。若你刪除
|
|
213
|
+
該 block,下一次 `init` / `configure-agents` 會再附加它。
|
|
214
|
+
|
|
215
|
+
只有遇到衝突或 malformed Dflow markers 時,才到
|
|
216
|
+
`dflow/specs/shared/copilot-instructions-snippet.md` 找 fallback merge snippet,
|
|
217
|
+
再手動處理你現有的 `.github/copilot-instructions.md`。
|
|
218
|
+
|
|
219
|
+
### `/dflow:<id>`(冒號形式)能不能直接輸入?
|
|
148
220
|
|
|
149
|
-
|
|
150
|
-
|
|
221
|
+
canonical 的 `/dflow:<id>`(冒號)是給 Claude / Codex 的命令寫法。在 Copilot
|
|
222
|
+
**兩個介面都不要把它當命令字面輸入**:
|
|
151
223
|
|
|
152
|
-
|
|
224
|
+
- **VS Code Chat**:當文字稱呼可以(Copilot 會理解你指的 workflow);要命令入口
|
|
225
|
+
請用 prompt-adapter 的 `/dflow-<id>`(連字號)。
|
|
226
|
+
- **Copilot CLI**:輸入 `/dflow:new-feature` 會被斷成 `/dflow`(只喚起 skill、不帶
|
|
227
|
+
id)。直接打 `/dflow` 喚起後,用文字描述要的 workflow 即可。
|
|
153
228
|
|
|
154
|
-
|
|
155
|
-
IDE 整合方式與 Copilot 版本。若 Copilot 無法識別以 slash 為前綴的 workflow
|
|
156
|
-
名稱,以普通文字重新送出請求:
|
|
229
|
+
任何介面只要 slash 形式沒被識別,就改用普通文字重新送出請求:
|
|
157
230
|
|
|
158
231
|
```text
|
|
159
|
-
You:
|
|
160
|
-
|
|
232
|
+
You: Please help me start a new Dflow feature workflow. Read
|
|
233
|
+
dflow/specs/shared/AI-AGENT-GUIDE.md first.
|
|
161
234
|
```
|
|
162
235
|
|
|
163
236
|
## 與其他 AI 工具的差異
|
|
@@ -168,20 +241,20 @@ canonical 指南(`dflow/specs/shared/AI-AGENT-GUIDE.md`)在各工具之間
|
|
|
168
241
|
| 工具 | 產生的 shim | 載入 canonical 指南的方式 |
|
|
169
242
|
|---|---|---|
|
|
170
243
|
| GitHub Copilot | `.github/copilot-instructions.md` | 直接讀取 repository 指示 |
|
|
171
|
-
| Claude Code | `CLAUDE.md` |
|
|
244
|
+
| Claude Code | `CLAUDE.md` | 啟動時直接讀取檔案內容 |
|
|
172
245
|
| Codex / Copilot coding agent | `AGENTS.md` | 啟動時直接讀取檔案內容 |
|
|
173
246
|
|
|
174
247
|
- Shim 路徑:Copilot 使用 `.github/copilot-instructions.md`(不是 `AGENTS.md`
|
|
175
248
|
或 `CLAUDE.md`)。
|
|
176
|
-
-
|
|
177
|
-
|
|
178
|
-
- 工具模型:Copilot
|
|
179
|
-
Codex / Claude Code 是 CLI-based agent
|
|
180
|
-
|
|
249
|
+
- 載入方式:Copilot shim 是薄指標、不 inline 指南(與其他工具一致);
|
|
250
|
+
canonical 指南按需載入。
|
|
251
|
+
- 工具模型:Copilot 有兩個介面——VS Code Chat(chat panel + inline completions)
|
|
252
|
+
與 Copilot CLI(終端機);Codex / Claude Code 是 CLI-based agent。兩個 Copilot
|
|
253
|
+
介面與 Dflow 的互動方式不同(見上方介面 A / B)。
|
|
181
254
|
- Workflow 呼叫:canonical `/dflow:*` 是共同詞彙,但各工具 `/` parser 行為不同。
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
`/dflow
|
|
255
|
+
Claude / Codex 直接吃 `/dflow:<id>`(冒號)當命令;Copilot **不行**——VS Code
|
|
256
|
+
的命令入口是 prompt-adapter 的 `/dflow-<id>`(連字號,需 `--command-adapters`),
|
|
257
|
+
Copilot CLI 則沒有 per-id 命令、改打 `/dflow` 喚起 skill(見上方介面 A / B)。
|
|
185
258
|
- Permission 模型:Copilot 依賴 IDE 的 permission 與 extension sandbox。它可能
|
|
186
259
|
受 editor-level approvals 管理;CLI 工具通常有明確的 sandbox flags 與獨立的
|
|
187
260
|
permission gates。
|
|
@@ -196,8 +269,10 @@ canonical 指南(`dflow/specs/shared/AI-AGENT-GUIDE.md`)在各工具之間
|
|
|
196
269
|
需要 spec-driven 輸出時,請明確要求執行 workflow。
|
|
197
270
|
- Copilot Chat context 不一定會在所有 IDE 版本中自動包含 `.github/` 目錄下的
|
|
198
271
|
repository 指示檔;行為因 Copilot / IDE 版本而異(見頁尾說明)。
|
|
199
|
-
-
|
|
200
|
-
`/dflow
|
|
272
|
+
- 先分清楚介面:VS Code Chat 自然語言自動觸發、命令用 `/dflow-<id>`;Copilot CLI
|
|
273
|
+
無自動觸發、先打 `/dflow` 喚起、沒有 per-id 命令(見上方介面 A / B)。
|
|
274
|
+
- 當 slash 形式沒被識別(VS Code Chat 偶發、或 Copilot CLI 的 `/dflow-<id>`
|
|
275
|
+
Unknown)時,改用普通文字描述 workflow,或在 CLI 先打 `/dflow` 喚起 skill。
|
|
201
276
|
- Prompt adapter 是從 canonical command registry 產生的薄 wrapper;不要在
|
|
202
277
|
`.github/prompts/` 中手寫或複製 Dflow workflow 步驟。
|
|
203
278
|
|
|
@@ -223,5 +298,7 @@ canonical 指南(`dflow/specs/shared/AI-AGENT-GUIDE.md`)在各工具之間
|
|
|
223
298
|
|
|
224
299
|
---
|
|
225
300
|
|
|
226
|
-
|
|
227
|
-
|
|
301
|
+
行為說明:本指南描述的介面差異(VS Code Chat 自然語言自動觸發、Copilot CLI 以
|
|
302
|
+
`/dflow` 手動喚起、prompt adapters 僅 VS Code)依 2026-06-05 實測;`.github/`
|
|
303
|
+
指示檔的自動包含與各介面的 `/` 命令解析仍可能因 Copilot / IDE 版本而異,依賴確切
|
|
304
|
+
語意前請向 maintainer 確認。
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Why Dflow (Even When AI Already Knows DDD)
|
|
2
|
+
|
|
3
|
+
> [繁體中文](why-dflow.md) | **English**
|
|
4
|
+
|
|
5
|
+
If your instinct is "today's AI already knows DDD — tell it to *build a feature using DDD* and out come aggregates, value objects, events; isn't a spec-first tool on top of that over-engineering?" — this document is written for you. It is not trying to convince you; it lays Dflow's value, the evidence, and the limits flat so you can judge for yourself.
|
|
6
|
+
|
|
7
|
+
## What Dflow is
|
|
8
|
+
|
|
9
|
+
Dflow does not teach AI what DDD is — it is a scaffold: it forces the AI to keep a full record of the trade-offs behind each design decision, and fills in the blind spots the AI tends to miss while filling in details on its own and that review can't easily catch.
|
|
10
|
+
|
|
11
|
+
Split "AI knows DDD" into two things and you see why it is still needed:
|
|
12
|
+
|
|
13
|
+
1. **Can the AI state the correct DDD answer?** Yes. The model has read the textbooks — aggregate boundaries, invariants, ubiquitous language, it can recite them all.
|
|
14
|
+
2. **When you review it, does the AI leave a complete enough record to audit — which options it weighed, why it chose this one, what it left undecided — and does it proactively catch the traps it tends to miss on its own?** Not necessarily — it depends on how you ask.
|
|
15
|
+
|
|
16
|
+
So the real comparison is not "AI tool vs process" but:
|
|
17
|
+
|
|
18
|
+
- **AI alone** output = AI knowledge × the implicit prompt structure × your ability to review it
|
|
19
|
+
- **AI + Dflow** output = AI knowledge × an **explicit elicitation scaffold** × an **auditable record of the decisions (trade-offs, rejected options, open questions)** × your ability to review it
|
|
20
|
+
|
|
21
|
+
The difference is not "a smarter AI." It is "**a more reviewable AI**."
|
|
22
|
+
|
|
23
|
+
## Dflow's DDD guidance is grown, not copied from a textbook
|
|
24
|
+
|
|
25
|
+
Part of Dflow's value is this: its guidance is fed back from real blind spots, and once added, the model actually reuses it afterward. A concrete, checkable example —
|
|
26
|
+
|
|
27
|
+
**Blind spot**: modeling on its own, the model guarded "a connector can have at most one in-progress charging session" — a uniqueness rule — with just an in-memory `if Status == InUse throw` check inside the aggregate. By the DDD textbook this is correct, but under concurrency two requests each read `Available`, each pass the check, and each save → the invariant is broken (modeling-correct, production-broken).
|
|
28
|
+
|
|
29
|
+
**Feedback**: that blind spot was written up as a section of guidance and added to Dflow's `ddd-modeling-guide.md` — "Set-Based / Uniqueness Invariants": for any "only one active X at a time" rule, no matter how you slice the aggregate, an in-memory check is never enough under concurrency; you need a DB unique / partial index or a concurrency token, and you must translate the conflict into an HTTP 409.
|
|
30
|
+
|
|
31
|
+
**Reuse**: on a different domain (cold-chain sensors, "a sensor is attached to at most one carton at a time," structurally parallel) and with the model unaware it was being tested, it **proactively cited that section** and produced the full three-layer protection (in-memory guard + a concurrency token + a DB partial unique index + a 409).
|
|
32
|
+
|
|
33
|
+
What this proves is something concrete: **Dflow turns "the blind spots AI misses on its own" into reusable guidance it actually follows.** This is not the grand conclusion "a few runs prove AI+process wins across the board" (the sample is small); it is evidence that Dflow's guidance loop works — **blind spot → add guidance → the model reuses it**. You can reproduce it yourself (see the end).
|
|
34
|
+
|
|
35
|
+
> An honesty note: the domain and the framing also differ between the two runs, but both cut against the "it wasn't the guidance" counter-argument — neither domain is a high-frequency concurrency-design topic in the model's pre-training; the framing in the second run is purer (unaware of the test), and if that were the cause the result should be worse, not better. Once those two are pushed down as less plausible, the best remaining explanation for the flip is whether that section is present.
|
|
36
|
+
|
|
37
|
+
## A few more things Dflow forces on the record that AI misses on its own
|
|
38
|
+
|
|
39
|
+
The same observation round also showed (each point is "what Dflow does → what happens without it"):
|
|
40
|
+
|
|
41
|
+
- **Forces the rejected-alternative reasoning**: one prompt in the aggregate-design template elicits a full decision block — "this boundary + why + which alternatives were considered + why rejected." On its own the AI usually hands you a single option, and at review you cannot audit "did it consider X?"
|
|
42
|
+
- **Step gates turn decisions into reviewable moments**: the model naturally stops to confirm at naming and model-spike points; on its own the AI writes all the way to code and tests before you get to review, by which time the aggregate boundary is no longer negotiable.
|
|
43
|
+
- **Open Questions get logged for the domain expert**: the model lists uncertain points as OQs awaiting an answer, instead of "guess something plausible" and burying the assumption in code logic.
|
|
44
|
+
- **Ubiquitous language does not drift**: a glossary plus code mapping keeps spec / model / code on one set of terms; on its own the AI can mix `Sensor` / `Device` / `Tracker` within a single paragraph.
|
|
45
|
+
- **Rules are queryable**: each business rule has an ID, a status, an owning aggregate, and a behavior link; on its own the AI scatters rules across prose, so "which tests does BR-003 affect?" is answerable only by grep and inference.
|
|
46
|
+
|
|
47
|
+
## The honest trade-off
|
|
48
|
+
|
|
49
|
+
Not hiding the limits is what makes the argument trustworthy:
|
|
50
|
+
|
|
51
|
+
- **Scope**: the observations so far ran on a single model × a few moderate-complexity domains × lightweight modeling scope (through domain modeling, not the implementation phase). Whether the guidance is equally effective at the implementation phase, and whether a different model behaves the same, is **untested**.
|
|
52
|
+
- **Prior**: the tested model already has a DDD pre-training prior. Dflow demonstrates it can turn "knows DDD but doesn't always think carefully" into "thinks carefully" — **not** "turns an AI with no DDD concept into one that does."
|
|
53
|
+
- **Adoption implies compliance**: Dflow is a spec-first tool; it only works when it is followed. Cases where the AI or a person deliberately bypasses it are outside the claim. That is a property of the tool, not a bug.
|
|
54
|
+
|
|
55
|
+
For audit-sensitive settings — medical, finance, compliance, safety-sensitive, or anything where a production failure is expensive or carries personal liability — this reviewability difference is a deal-breaker. The cost has two sides. *Producing* the DDD documents is no longer the pre-AI era when DDD by hand carried a heavy labor cost — the AI generates the specs, the decision record, and the domain model for you, so the marginal cost is mainly a few more tokens and running the workflow; and just being constrained by the domain model during generation already makes the output steadier (as in the concurrency blind spot above), a layer you get even if you never read the record closely. Dflow's DDD is also deliberately pragmatic (not the full academic suite), fitting a typical company's mid-sized systems with a low adoption barrier (a team need not be DDD experts first). But cashing in the further "reviewable" value still takes a person actually reviewing that record — that is the key cost in human attention and discipline. So the trade-off stands and is worth discussing: when stakes are high, an audit is needed, or a team maintains it long-term, the investment clearly pays off; when you won't review it, the cost of failure is low, and iteration is fast, AI alone may still be the more practical choice — Dflow does not always win.
|
|
56
|
+
|
|
57
|
+
## Verify it yourself
|
|
58
|
+
|
|
59
|
+
Don't trust any of the above — run it once (about 10–30 minutes):
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install -g dflow-sdd-ddd
|
|
63
|
+
mkdir dflow-test && cd dflow-test
|
|
64
|
+
git init && git commit --allow-empty -m "init"
|
|
65
|
+
dflow init # choose greenfield + your AI tool + your stack
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Then in your AI coding agent run `/dflow:new-feature` and assign a feature with a "cross-instance uniqueness" invariant, e.g. "at most one active session per account at a time." Watch whether, at domain modeling, the model reaches the "Set-Based / Uniqueness Invariants" section (in Dflow's `ddd-modeling-guide.md`), cites it, and adds a DB unique / partial index + a concurrency token + a 409. Note: installing the latest version verifies the half "when the guidance is present the model uses it"; the "without the guidance the model misses it" half was established by the run above before the guidance was added, and is not a variable you can toggle on the latest version — which always contains it.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
Dflow does not claim to make the AI smarter; it makes the AI more reviewable: spec-first, domain meaning made explicit, decisions and rejected alternatives kept on the record, AI constrained before implementation, and drift verified before the work is called done. For why domain meaning itself matters more in the AI era, see [Why DDD Matters More with AI](why-ddd-for-ai.en.md).
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# 為什麼用 Dflow(即使 AI 已經會 DDD)
|
|
2
|
+
|
|
3
|
+
> **繁體中文** | [English](why-dflow.en.md)
|
|
4
|
+
|
|
5
|
+
如果你的直覺是「現在的 AI 已經會 DDD,叫它『用 DDD 建一個 feature』,aggregate、value object、event 都出得來,再加一層 spec-first 工具是不是過度工程?」——這份文件是寫給你的。它不打算說服你,而是把 Dflow 的價值、證據與限制攤平,讓你自己判斷。
|
|
6
|
+
|
|
7
|
+
## Dflow 是什麼
|
|
8
|
+
|
|
9
|
+
Dflow 不是教 AI 什麼是 DDD——它是一層 scaffold(鷹架):強迫 AI 把每個設計決策的取捨完整留檔,並補上「AI 自己補細節時容易漏、而 review 又難一眼看出」的盲區。
|
|
10
|
+
|
|
11
|
+
把「AI 會 DDD」拆成兩件事,就懂為什麼還需要它:
|
|
12
|
+
|
|
13
|
+
1. **AI 能不能說出對的 DDD 答案?** 能。模型讀過教科書,aggregate 邊界、不變式、ubiquitous language 都答得出來。
|
|
14
|
+
2. **AI 在你 review 時會不會留下夠完整的紀錄(它考慮過哪些、為何這樣選、哪裡還沒確定)讓你 audit、會不會主動 catch 它自己容易漏的陷阱?** 不一定,要看你怎麼問。
|
|
15
|
+
|
|
16
|
+
所以真正該比的不是「AI 工具 vs process」,而是:
|
|
17
|
+
|
|
18
|
+
- **AI alone** 的產出 = AI 知識 × 隱含的 prompt 結構 × 你 review 它的能力
|
|
19
|
+
- **AI + Dflow** 的產出 = AI 知識 × **明確的 elicitation scaffold** × **可審查的決策紀錄(取捨、否決的方案、open questions)** × 你 review 它的能力
|
|
20
|
+
|
|
21
|
+
差異不是「更聰明的 AI」,是「**更可審查的 AI**」。
|
|
22
|
+
|
|
23
|
+
## Dflow 的 DDD 引導是「長出來的」,不是抄教科書
|
|
24
|
+
|
|
25
|
+
Dflow 的價值有一部分在於:它的引導是從真實盲區回灌的,而且補上之後,模型真的會在後續主動沿用。一個具體、可檢查的例子——
|
|
26
|
+
|
|
27
|
+
**盲區**:模型自己建模時,把「一個充電槍同時只能有一筆進行中 session」這條唯一性規則,只用 aggregate 內 `if Status == InUse throw` 的 in-memory check 保護。DDD 教科書角度這是對的,但並發下兩個請求各自讀到 `Available`、各自通過檢查、各自 save → 不變式被破壞(modeling-correct、production-broken)。
|
|
28
|
+
|
|
29
|
+
**回灌**:把這個盲區寫成一段引導,補進 Dflow 的 `ddd-modeling-guide.md`——「Set-Based / Uniqueness Invariants」:這類「同 X 只能有一筆 active」的規則,無論怎麼切 aggregate,in-memory check 在並發下永遠不夠,要加 DB unique / partial index 或 concurrency token,並把衝突 translate 成 HTTP 409。
|
|
30
|
+
|
|
31
|
+
**沿用**:換一個 domain(冷鏈感測器「一個 sensor 同時最多掛在一個 carton」,結構平行)、且讓模型不知道自己在被測,它就**主動引用那段**、補上完整三層保護(in-memory guard + concurrency token + DB partial unique index + 409)。
|
|
32
|
+
|
|
33
|
+
這證明的是一件具體的事:**Dflow 把「AI 自己會漏的盲區」固化成可重用、會被遵循的引導。** 這不是「跑幾次就證明 AI+process 全面勝出」那種大結論(樣本很小);它是 Dflow 引導迴路有效的證據——**盲區 → 補引導 → 模型沿用**。你也能自己複現(見文末)。
|
|
34
|
+
|
|
35
|
+
> 補充誠實度:兩次 run 之間 domain 與 framing 也不同,但都不利於「不是引導的功勞」這個反方——兩個 domain 在模型的 pre-training 裡都不是高頻並發設計題材;framing 在第二次更純(不知被測),若它是主因,結果該更差而非更好。把這兩條的可能性壓低後,最能解釋這個翻轉的就剩那段引導在不在。
|
|
36
|
+
|
|
37
|
+
## 其他幾個「Dflow 強制留檔、AI 自己容易漏」
|
|
38
|
+
|
|
39
|
+
同一輪觀察裡還看到(每點都是「Dflow 做了什麼 → 沒它會怎樣」):
|
|
40
|
+
|
|
41
|
+
- **強迫寫否決理由**:aggregate 設計模板一句 prompt,誘出「選這個邊界 + 理由 + 考慮過哪些替代 + 為何否決」的完整決策段;AI 自己通常只給你一個方案,review 時你無法 audit「它想過 X 嗎」。
|
|
42
|
+
- **Step gate 把決策變成 reviewable moment**:模型在命名、模型 spike 等節點自然停下等確認;AI 自己一路寫到 code、tests 都好了你才有機會 review,這時 aggregate 邊界已經沒有商量空間。
|
|
43
|
+
- **Open Question 留檔給 domain expert**:模型把不確定的點列成 OQ 等人答,而不是「不確定就猜一個合理的」把假設藏進 code。
|
|
44
|
+
- **Ubiquitous language 不漂移**:術語表 + code mapping 讓 spec / model / code 用同一組名詞;AI 自己一段話內就能混用 Sensor / Device / Tracker。
|
|
45
|
+
- **規則可被查詢**:每條 business rule 有 ID、status、所屬 aggregate、behavior 連結;AI 自己把規則散在 prose 裡,「BR-003 影響哪些測試」只能用 grep 推敲。
|
|
46
|
+
|
|
47
|
+
## 誠實的取捨
|
|
48
|
+
|
|
49
|
+
不掩蓋限制,反而是這套論點的可信來源:
|
|
50
|
+
|
|
51
|
+
- **scope**:目前觀察只跑在單一模型 × 幾個中等複雜度 domain × lightweight modeling scope(到領域建模、不含 implementation phase)。implementation 階段的引導是否同樣有效、換不同模型會不會一樣,**未驗**。
|
|
52
|
+
- **先驗**:被測模型本來就對 DDD 有 pre-training 先驗。Dflow 證明的是「能讓『會、但不一定每次仔細想』變成『仔細想』」,**不是**「能讓完全不懂 DDD 的 AI 變會」。
|
|
53
|
+
- **採用即承諾遵循**:Dflow 是 spec-first 工具,只在被遵循時有效;AI 或人故意走偏的情境不在宣稱範圍內。這是工具屬性,不是 bug。
|
|
54
|
+
|
|
55
|
+
對需要 audit 的場景——醫療、金融、合規、安全敏感、或任何「上線出包代價高 / 個人責任重」的領域——這個 reviewability 差異是 deal-breaker。成本要分兩塊看:**產出** DDD 文件已經不是徒手做 DDD 的高人力年代——AI 幫你生規格、決策紀錄與領域模型,邊際成本主要是多花一些 token 與走一遍流程;而且光是「生成時被領域模型約束」就已讓產出更穩(如上面那個並發盲區),這層就算你沒深讀紀錄也拿得到。Dflow 的 DDD 也刻意務實裁剪(不是學院派全套)、適合一般公司的中型系統,採用門檻不高(不需要團隊先是 DDD 專家)。但要再兌現「可審查」這份價值,得有人實際去 review 那份紀錄——那才是人力與紀律的關鍵成本。所以取捨仍在、值得討論:高風險、需 audit、要長期維護時,這筆投資明顯划算;你不會去 review、失敗成本低、迭代又快時,AI alone 仍可能是更實際的選擇,不是 Dflow 一定贏。
|
|
56
|
+
|
|
57
|
+
## 自己驗證
|
|
58
|
+
|
|
59
|
+
不用相信任何說法,自己跑一次(約 10–30 分鐘):
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install -g dflow-sdd-ddd
|
|
63
|
+
mkdir dflow-test && cd dflow-test
|
|
64
|
+
git init && git commit --allow-empty -m "init"
|
|
65
|
+
dflow init # 選 greenfield + 你的 AI 工具 + 你的 stack
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
接著在你的 AI coding agent 裡跑 `/dflow:new-feature`,指派一個含「跨實例唯一」型不變式的 feature,例如「同帳號同時最多一個 active session」。看模型走到領域建模時,會不會寫到「Set-Based / Uniqueness Invariants」段(Dflow 的 `ddd-modeling-guide.md`)、cite 它、並補上 DB unique / partial index + concurrency token + 409。注意:裝最新版能驗證的是「引導在場時模型確實會用它」這一半;「引導不在場時模型會漏」那一半是上面那段在加入引導之前建立的,不是你在最新版上能切換的——最新版一律含這段。
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
Dflow 不宣稱讓 AI 更聰明,它讓 AI 更可審查:規格優先、領域語義顯式化、把決策與否決理由留檔、在實作前約束、完成前驗證漂移(drift)。為什麼領域語義本身在 AI 時代更關鍵,見 [為什麼 AI 時代 DDD 更重要](why-ddd-for-ai.md)。
|