dflow-sdd-ddd 0.2.0 → 0.4.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 (41) hide show
  1. package/CHANGELOG.md +971 -0
  2. package/README.en.md +345 -0
  3. package/README.md +213 -159
  4. package/docs/evaluating-dflow.en.md +238 -0
  5. package/docs/evaluating-dflow.md +94 -151
  6. package/docs/examples-by-stack.md +516 -0
  7. package/docs/migrating-to-dflow-v1.md +28 -10
  8. package/docs/release-versioning-policy.md +13 -0
  9. package/docs/using-with-claude-code.en.md +210 -0
  10. package/docs/using-with-claude-code.md +108 -124
  11. package/docs/using-with-codex.en.md +248 -0
  12. package/docs/using-with-codex.md +137 -157
  13. package/docs/using-with-gemini-cli.en.md +200 -0
  14. package/docs/using-with-gemini-cli.md +184 -0
  15. package/docs/using-with-github-copilot.en.md +136 -0
  16. package/docs/using-with-github-copilot.md +177 -0
  17. package/docs/why-ddd-for-ai.en.md +37 -0
  18. package/docs/why-ddd-for-ai.md +19 -17
  19. package/lib/init.js +187 -24
  20. package/package.json +1 -1
  21. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +2 -1
  22. package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +32 -22
  23. package/templates/brownfield/scaffolding/Git-principles-gitflow.md +1 -1
  24. package/templates/brownfield/scaffolding/Git-principles-trunk.md +1 -1
  25. package/templates/brownfield/scaffolding/_conventions.md +1 -1
  26. package/templates/brownfield/scaffolding/_overview.md +40 -29
  27. package/templates/brownfield/templates/CLAUDE.md +26 -18
  28. package/templates/brownfield/templates/context-definition.md +4 -4
  29. package/templates/brownfield/templates/context-map.md +1 -1
  30. package/templates/brownfield/templates/lightweight-spec.md +3 -1
  31. package/templates/brownfield/templates/models.md +1 -1
  32. package/templates/brownfield/templates/phase-spec.md +33 -28
  33. package/templates/brownfield/templates/tech-debt.md +2 -2
  34. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +2 -1
  35. package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +14 -13
  36. package/templates/greenfield/scaffolding/Git-principles-gitflow.md +2 -2
  37. package/templates/greenfield/scaffolding/Git-principles-trunk.md +2 -2
  38. package/templates/greenfield/scaffolding/_conventions.md +1 -1
  39. package/templates/greenfield/scaffolding/_overview.md +29 -11
  40. package/templates/greenfield/templates/CLAUDE.md +6 -6
  41. package/templates/greenfield/templates/phase-spec.md +24 -21
@@ -5,9 +5,9 @@
5
5
  > This file is a **snippet**, not a standalone `CLAUDE.md`. Its purpose
6
6
  > is to be merged into your project's root `CLAUDE.md`:
7
7
  >
8
- > - New `npx dflow-sdd-ddd init` output uses
9
- > `dflow/specs/shared/AI-AGENT-GUIDE.md` as the canonical guide and
10
- > creates a thin `CLAUDE.md` shim that points back to it.
8
+ > - New Dflow CLI init output (`dflow init`, or `npx dflow-sdd-ddd init` when
9
+ > using the no-install path) uses `dflow/specs/shared/AI-AGENT-GUIDE.md` as
10
+ > the canonical guide and creates a thin `CLAUDE.md` shim that points back to it.
11
11
  > - Use this legacy snippet only if you intentionally want the older
12
12
  > Claude-specific two-H2 layout in your project's root `CLAUDE.md`.
13
13
 
@@ -21,7 +21,7 @@ when merging into an existing `CLAUDE.md`.
21
21
  ## Snippet to merge into `CLAUDE.md`
22
22
 
23
23
  ```markdown
24
- # Project: {系統名稱} — ASP.NET WebForms
24
+ # Project: {系統名稱} — {Framework}
25
25
 
26
26
  **重要:所有開發工作都必須遵循本文件定義的流程。**
27
27
 
@@ -33,10 +33,12 @@ when merging into an existing `CLAUDE.md`.
33
33
 
34
34
  ### Background
35
35
 
36
- 這是一個運行中的 ASP.NET WebForms 系統,{一句話描述業務領域:例如
36
+ 這是一個運行中的既有系統,使用 {Framework} / {Language},{一句話描述業務領域:例如
37
37
  「提供員工費用報銷」/「處理 HR 人事流程」/「訂單管理」}。採用 Dflow
38
- (SDD/DDD workflow guardian skill)引導開發流程,同時為未來遷移到
39
- ASP.NET Core 做準備。
38
+ (SDD/DDD workflow guardian skill)引導開發流程,逐步將 business logic
39
+ embedded in delivery/entrypoint code(presentation/UI layer、controllers、
40
+ handlers、jobs、message consumers、data pipelines、stored procedures)抽離,
41
+ 並朝 target architecture 前進。
40
42
 
41
43
  {選填:補上團隊規模、使用者規模、主要 stakeholders 等 context,
42
44
  1-3 行即可。完整內容放在 `dflow/specs/shared/_overview.md`。}
@@ -45,8 +47,8 @@ ASP.NET Core 做準備。
45
47
 
46
48
  ```
47
49
  dflow/specs/
48
- ├── shared/ # 專案級治理文件(由 npx dflow-sdd-ddd init 寫入)
49
- │ ├── _overview.md # 系統現況與遷移策略
50
+ ├── shared/ # 專案級治理文件(由 Dflow CLI init 寫入)
51
+ │ ├── _overview.md # 系統現況與 target architecture
50
52
  │ ├── _conventions.md # 規格撰寫慣例
51
53
  │ └── Git-principles-*.md # Git 規範(gitflow 或 trunk 版)
52
54
  ├── domain/ # 領域知識
@@ -68,12 +70,20 @@ dflow/specs/
68
70
  └── tech-debt.md
69
71
 
70
72
  src/
71
- ├── Domain/ # 抽離的領域邏輯(純 C#)
73
+ ├── Domain/ # 抽離的領域邏輯(framework-pure)
72
74
  │ ├── {BoundedContext}/
73
75
  │ └── SharedKernel/
74
- └── Pages/ # 既有 WebForms 頁面
76
+ └── Delivery/ # delivery-layer code(entrypoints, controllers, handlers)
75
77
  ```
76
78
 
79
+ > **目錄命名說明**:上方 `src/Domain/` / `src/Delivery/` 是 Clean
80
+ > Architecture 通用示意,不限 stack。請依專案實際慣例對應(例:Java/Spring 用
81
+ > `src/main/java/com/example/domain/`、Node/TS 用 `src/domain/` /
82
+ > `src/routes/`、Python 用 `domain/` package、Go 用 `internal/domain/` /
83
+ > `internal/handler/`、.NET 用 `src/{Project}.Domain/` + `.csproj` 分層)。
84
+ > 完整 per-stack 範例見 `docs/examples-by-stack.md`。重點是
85
+ > `src/Domain/`(或對應命名)保持與 delivery/entrypoint code 獨立。
86
+
77
87
  ---
78
88
 
79
89
  ## Development Workflow
@@ -83,9 +93,9 @@ src/
83
93
  ### Core Principles
84
94
 
85
95
  1. **Spec Before Code** — 沒有規格就不寫實作(依 Ceremony Scaling 調整嚴謹度)
86
- 2. **Domain Extraction** — 業務邏輯屬於 `src/Domain/`,不屬於 Code-Behind
96
+ 2. **Domain Extraction** — 業務邏輯屬於 `src/Domain/`,不屬於 delivery/entrypoint code
87
97
  3. **Ubiquitous Language** — 使用 `dflow/specs/domain/glossary.md` 中定義的術語
88
- 4. **Migration Awareness** — 每個決策都要考慮未來 ASP.NET Core 遷移
98
+ 4. **Migration Awareness** — 每個決策都要考慮 target architecture
89
99
 
90
100
  ### Dflow Skill — Canonical Decision Logic Lives in the Skill
91
101
 
@@ -97,7 +107,7 @@ AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
97
107
  當你作為 AI assistant 被呼叫時,若偵測到使用者需要 SDD/DDD 工作流
98
108
  引導,請參考 Dflow entry points:
99
109
 
100
- - `npx dflow-sdd-ddd init` — 專案初始化(建立 `dflow/specs/` 結構)
110
+ - Dflow CLI init command (`dflow init`, or `npx dflow-sdd-ddd init` when using the no-install path) — 專案初始化(建立 `dflow/specs/` 結構)
101
111
  - `/dflow:new-feature` — 新功能開發
102
112
  - `/dflow:new-phase` — 在 active feature 內新增階段
103
113
  - `/dflow:modify-existing` — 修改既有功能
@@ -114,7 +124,7 @@ AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
114
124
 
115
125
  - **Git 分支策略**:見 `dflow/specs/shared/Git-principles-{gitflow|trunk}.md`
116
126
  - **規格撰寫慣例**:見 `dflow/specs/shared/_conventions.md`
117
- - **系統現況與遷移**:見 `dflow/specs/shared/_overview.md`
127
+ - **系統現況與 target architecture**:見 `dflow/specs/shared/_overview.md`
118
128
  - {其他專案特有規則,例如「JPY 金額必須以最小貨幣單位(yen)儲存」/
119
129
  「所有費用報銷需主管審核」/「跨時區行程以 UTC 記錄」}
120
130
 
@@ -122,18 +132,18 @@ AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
122
132
 
123
133
  此目錄中的程式碼必須遵守(與 Dflow skill 的 Domain Layer Rules 一致):
124
134
 
125
- - ❌ 不可引用 `System.Web` 或任何 WebForms 命名空間
135
+ - ❌ 不可引用任何 delivery-framework 命名空間(例:HTTP 請求/回應物件、Session/Cookie context、job runner context、CLI flag parser、ViewState 類等)
126
136
  - ❌ 不可直接存取資料庫(使用 interface + Repository pattern)
127
- - ❌ 不可使用 `HttpContext`、`Session`、`ViewState`
137
+ - ❌ 不可使用 delivery-framework runtime context(例:HTTP request/response、session/cookie、job runner state、CLI args)
128
138
  - ❌ 不可有 UI 相關邏輯
129
- - ✅ 純 C# 類別,可直接搬到 ASP.NET Core 專案
130
- - ✅ 所有公開行為都能在沒有 Web 基礎設施的情況下測試
139
+ - ✅ 語言純粹的 class(不依賴 delivery framework),可直接搬到 target architecture
140
+ - ✅ 所有公開行為都能在沒有 delivery infrastructure 的情況下測試
131
141
 
132
142
  ### AI Collaboration Notes
133
143
 
134
144
  - 遇到開發需求時,優先引導使用 `/dflow:` 命令
135
145
  - 回答 Domain 相關問題時,優先參考 `dflow/specs/domain/` 中的文件
136
- - 發現 Code-Behind 中的業務邏輯時,建議抽離到 `src/Domain/`
146
+ - 發現 delivery/entrypoint code 中的業務邏輯時,建議抽離到 `src/Domain/`
137
147
  - 建立分支前,確認命名符合規範且對應 spec 存在
138
148
  - 詳細 Git 操作規則見 `dflow/specs/shared/Git-principles-{gitflow|trunk}.md`
139
149
  ```
@@ -162,5 +172,5 @@ When merging this snippet into an existing `CLAUDE.md`:
162
172
  duplicate it.
163
173
 
164
174
  If you are starting from scratch (no existing `CLAUDE.md`), the
165
- `npx dflow-sdd-ddd init` flow will install this snippet as-is and you
166
- can refine from there.
175
+ the Dflow CLI init flow (`dflow init`, or `npx dflow-sdd-ddd init` when using
176
+ the no-install path) will install this snippet as-is and you can refine from there.
@@ -170,7 +170,7 @@ before making key Git operations:
170
170
  `behavior.md` reflect the feature's net BR changes
171
171
  - [ ] `dflow/specs/domain/glossary.md` updated with any new terms
172
172
  - [ ] `dflow/specs/migration/tech-debt.md` updated with any debt discovered
173
- - [ ] Domain layer (`src/Domain/`) has no `System.Web` references
173
+ - [ ] Domain layer (`src/Domain/`) has no delivery-framework references
174
174
 
175
175
  ---
176
176
 
@@ -134,7 +134,7 @@ and circle the chosen one.
134
134
  `behavior.md` reflect the feature's net BR changes
135
135
  - [ ] `dflow/specs/domain/glossary.md` updated with any new terms
136
136
  - [ ] `dflow/specs/migration/tech-debt.md` updated with any debt discovered
137
- - [ ] Domain layer (`src/Domain/`) has no `System.Web` references
137
+ - [ ] Domain layer (`src/Domain/`) has no delivery-framework references
138
138
  - [ ] CI green
139
139
  - [ ] PR has at least one review approval
140
140
 
@@ -108,7 +108,7 @@ situations.
108
108
  |------------------------------|--------------------|-----|
109
109
  | {e.g. Year-end reporting tweak without BR change} | T2 | Touches logic path even though no new BR; extract to `lightweight-spec.md` for trace |
110
110
  | {e.g. Pure label / display text translation} | T3 | No BR change; inline row in `_index.md` |
111
- | {e.g. UI refresh across multiple pages} | T1 (project convention) | We treat multi-page UI refresh as T1 for this project even though Dflow default would be T2, because our WebForms UI changes often leak into Code-Behind |
111
+ | {e.g. UI refresh across multiple entrypoints} | T1 (project convention) | We treat multi-entrypoint UI/API refresh as T1 for this project even though Dflow default would be T2, because these changes often leak into business logic embedded in delivery/entrypoint code (presentation/UI layer, controllers, handlers, jobs, message consumers, data pipelines, or stored procedures) |
112
112
 
113
113
  If the team disagrees on tier classification for a specific change,
114
114
  run through the T3 four-criteria checklist (in the Dflow skill) and
@@ -3,7 +3,7 @@
3
3
  # System Overview — {System Name}
4
4
 
5
5
  > Created: {YYYY-MM-DD}
6
- > Scope: current state and migration direction of {System Name}
6
+ > Scope: current state and target-architecture direction of {System Name}
7
7
  > Audience: team members onboarding to the system + AI assistants reading
8
8
  > `dflow/specs/` for context.
9
9
 
@@ -30,33 +30,44 @@ delivers. Keep it non-technical enough that a new hire can skim it in
30
30
 
31
31
  ## Technical Architecture (Current)
32
32
 
33
- This project runs on ASP.NET WebForms. The SDD/DDD workflow is used to
34
- progressively prepare for migration (see "Migration Strategy" below).
33
+ This project runs on {Framework}. The SDD/DDD workflow is used to
34
+ progressively extract domain logic and prepare for the target architecture
35
+ (see "Target Architecture Strategy" below).
35
36
 
36
37
  | Item | Current |
37
38
  |------|---------|
38
- | Framework | ASP.NET WebForms ({.NET Framework version}) |
39
- | Language | C# {version} |
39
+ | Framework | {Framework} ({Framework version}) |
40
+ | Language | {Language} |
40
41
  | Database | {e.g. SQL Server 2019, MySQL 8.0} |
41
- | ORM / data access | {e.g. Entity Framework 6, ADO.NET, stored procedures} |
42
- | UI | WebForms Pages + Code-Behind + {CSS framework if any} |
43
- | Auth | {e.g. Forms authentication, Windows auth} |
44
- | Hosting | {e.g. IIS on-prem, Azure App Service} |
42
+ | ORM / persistence | {ORM / persistence} ({ORM version}) |
43
+ | Delivery / entrypoint | {Framework} |
44
+ | Auth | {e.g. session auth, OAuth/OIDC, API key, internal SSO} |
45
+ | Hosting | {e.g. on-prem VM, container platform, managed app platform} |
45
46
 
46
47
  ### Code Layout (High Level)
47
48
 
49
+ > **Note on directory naming**: The tree below uses generic Clean
50
+ > Architecture folder names (`src/Domain/`, `src/Delivery/`). Adapt to your
51
+ > stack's conventions — for example, Java/Spring `src/main/java/com/example/domain/`,
52
+ > Node/TS `src/domain/` + `src/routes/`, Python `domain/` package, Go
53
+ > `internal/domain/` + `internal/handler/`, PHP/Laravel `app/Domain/` +
54
+ > `app/Http/`, .NET `src/{Project}.Domain/` + `src/{Project}.WebAPI/`
55
+ > (separate `.csproj` per layer). For full per-stack examples see
56
+ > `docs/examples-by-stack.md`.
57
+
48
58
  ```
49
59
  src/
50
- ├── Domain/ # Extracted domain logic (pure C#; migration target)
60
+ ├── Domain/ # Extracted domain logic (framework-pure; target architecture)
51
61
  │ ├── {BoundedContext}/
52
62
  │ └── SharedKernel/
53
- └── Pages/ # WebForms pages (.aspx + Code-Behind)
63
+ └── Delivery/ # delivery-layer code (entrypoints, controllers, handlers)
54
64
  ```
55
65
 
56
66
  The `src/Domain/` directory is where business logic lives **as it is
57
- extracted** from Code-Behind. Everything in `src/Domain/` must be pure
58
- C# with no `System.Web` dependencies (see `CLAUDE.md` and the Dflow
59
- skill for the full rule set).
67
+ extracted** from delivery/entrypoint code (presentation/UI layer, controllers,
68
+ handlers, jobs, message consumers, data pipelines, or stored procedures).
69
+ Everything in `src/Domain/` must be framework-pure with no delivery-framework
70
+ dependencies (see `CLAUDE.md` and the Dflow skill for the full rule set).
60
71
 
61
72
  ---
62
73
 
@@ -66,34 +77,34 @@ skill for the full rule set).
66
77
  top 3–5 known issues the team wants to address as part of migration.
67
78
  Link each to `migration/tech-debt.md` entries if they exist.}
68
79
 
69
- 1. {e.g. Business logic scattered across Code-Behind; duplicated
70
- calculations in multiple pages}
71
- 2. {e.g. Direct SQL in Code-Behind; inconsistent error handling}
80
+ 1. {e.g. Business logic embedded in delivery/entrypoint code; duplicated
81
+ calculations across multiple flows}
82
+ 2. {e.g. Direct SQL in delivery/entrypoint code; inconsistent error handling}
72
83
  3. {e.g. Magic numbers / undocumented statuses}
73
84
 
74
85
  ---
75
86
 
76
- ## Migration Strategy
87
+ ## Target Architecture Strategy
77
88
 
78
- This system is being prepared for migration to ASP.NET Core. The
79
- migration follows four principles; expand / adapt each to this project:
89
+ This system is being prepared for the project's target architecture. The
90
+ strategy follows four principles; expand / adapt each to this project:
80
91
 
81
- - **Migration Awareness** — Every feature decision considers future
82
- migration. We ask "does this make the migration harder or easier?"
92
+ - **Migration Awareness** — Every feature decision considers the target
93
+ architecture. We ask "does this make the target architecture harder or easier?"
83
94
  - **Domain Extraction** — Business logic gradually moves from
84
- Code-Behind to `src/Domain/`. Each feature is an opportunity to
85
- extract a little more.
95
+ delivery/entrypoint code to `src/Domain/`. Each feature is an
96
+ opportunity to extract a little more.
86
97
  - **Dual-Track Parallel** — We do not force-rewrite existing code; new
87
- development preferentially uses the Domain layer, and legacy pages
98
+ development preferentially uses the Domain layer, and legacy entrypoints
88
99
  get touched only when they are being modified.
89
- - **Pragmatic First** — Migration does not block feature delivery. If
100
+ - **Pragmatic First** — Target-architecture work does not block feature delivery. If
90
101
  a deadline is tight, record the debt in `migration/tech-debt.md`
91
102
  and continue.
92
103
 
93
- ### Target Architecture (Post-Migration)
104
+ ### Target Architecture
94
105
 
95
- {1-2 sentences describing where this system is heading: e.g. "ASP.NET
96
- Core 8 + Clean Architecture + EF Core, deployed to Azure App Service."
106
+ {1-2 sentences describing where this system is heading: e.g. "{Framework}
107
+ + Clean Architecture + {ORM / persistence}, deployed to {hosting platform}."
97
108
  Link to any ADR or migration plan doc if one exists.}
98
109
 
99
110
  ---
@@ -1,4 +1,4 @@
1
- # Project: {系統名稱} — ASP.NET WebForms
1
+ # Project: {系統名稱} — {Framework}
2
2
 
3
3
  **重要:所有開發工作都必須遵循本文件定義的流程。**
4
4
 
@@ -10,15 +10,15 @@
10
10
 
11
11
  ### Background
12
12
 
13
- 這是一個運行中的 ASP.NET WebForms 系統,目前持續新增與修改功能。
14
- 未來將遷移至 ASP.NET Core。目前採用 SDD 流程,同時為 DDD 做準備。
13
+ 這是一個運行中的既有系統,使用 {Framework} / {Language},目前持續新增與修改功能。
14
+ 目前採用 SDD 流程,同時為 DDD 與 target architecture 做準備。
15
15
 
16
16
  ### Project Structure
17
17
 
18
18
  ```
19
19
  dflow/specs/
20
- ├── shared/ # 專案級治理文件(由 npx dflow-sdd-ddd init 寫入)
21
- │ ├── _overview.md # 系統現況與遷移策略
20
+ ├── shared/ # 專案級治理文件(由 dflow init 寫入)
21
+ │ ├── _overview.md # 系統現況與 target architecture
22
22
  │ └── _conventions.md # 規格撰寫慣例與模板
23
23
  ├── domain/ # 領域知識
24
24
  │ ├── glossary.md # 術語表(Ubiquitous Language)
@@ -40,16 +40,24 @@ dflow/specs/
40
40
  └── tech-debt.md # 技術債與遷移備忘
41
41
 
42
42
  src/
43
- ├── Domain/ # 抽離的領域邏輯(純 C#)
43
+ ├── Domain/ # 抽離的領域邏輯(framework-pure)
44
44
  │ ├── {Context}/
45
45
  │ │ ├── Entities/
46
46
  │ │ ├── ValueObjects/
47
47
  │ │ ├── Services/
48
48
  │ │ └── Interfaces/
49
49
  │ └── SharedKernel/
50
- └── Pages/ # 既有 WebForms 頁面
50
+ └── Delivery/ # delivery-layer code(entrypoints, controllers, handlers)
51
51
  ```
52
52
 
53
+ > **目錄命名說明**:上方 `src/Domain/` / `src/Delivery/` 是 Clean
54
+ > Architecture 通用示意,不限 stack。請依專案實際慣例對應(例:Java/Spring 用
55
+ > `src/main/java/com/example/domain/`、Node/TS 用 `src/domain/` /
56
+ > `src/routes/`、Python 用 `domain/` package、Go 用 `internal/domain/` /
57
+ > `internal/handler/`、.NET 用 `src/{Project}.Domain/` + `.csproj` 分層)。
58
+ > 完整 per-stack 範例見 `docs/examples-by-stack.md`。重點是
59
+ > `src/Domain/`(或對應命名)保持與 delivery/entrypoint code 獨立。
60
+
53
61
  ---
54
62
 
55
63
  ## Development Workflow
@@ -58,9 +66,9 @@ src/
58
66
 
59
67
  ### Core Principles
60
68
  1. **Spec Before Code** — 沒有規格就不寫實作
61
- 2. **Domain Extraction** — 業務邏輯屬於 `src/Domain/`,不屬於 Code-Behind
69
+ 2. **Domain Extraction** — 業務邏輯屬於 `src/Domain/`,不屬於 delivery/entrypoint code(presentation/UI layer、controllers、handlers、jobs、message consumers、data pipelines、stored procedures)
62
70
  3. **Ubiquitous Language** — 使用 `dflow/specs/domain/glossary.md` 中定義的術語
63
- 4. **Migration Awareness** — 每個決策都要考慮未來 ASP.NET Core 遷移
71
+ 4. **Migration Awareness** — 每個決策都要考慮 target architecture
64
72
 
65
73
  ### Three Ceremony Tiers
66
74
 
@@ -81,8 +89,8 @@ src/
81
89
  1. 建 feature 目錄 `dflow/specs/features/active/{SPEC-ID}-{slug}/`
82
90
  2. 建 `_index.md`(feature dashboard)+ 第一份 `phase-spec-YYYY-MM-DD-{slug}.md`
83
91
  3. 識別涉及的領域概念,更新 `dflow/specs/domain/` 下的對應文件
84
- 4. 盡可能將業務邏輯實作在 `src/Domain/` 中(純 C# class,不依賴 WebForms)
85
- 5. Code-Behind 僅負責 UI 綁定,呼叫 Domain 層處理邏輯
92
+ 4. 盡可能將業務邏輯實作在 `src/Domain/` 中(語言純粹的 class,不依賴 delivery framework)
93
+ 5. Delivery/entrypoint code 僅負責輸入解析、協調流程與輸出綁定,呼叫 Domain 層處理邏輯
86
94
  6. 撰寫測試驗證 Domain 層行為符合規格
87
95
 
88
96
  ### New Phase
@@ -95,7 +103,7 @@ src/
95
103
  2. 若偵測到改動與 completed feature 相關,主動詢問是否為 follow-up
96
104
  (follow-up 走新建 feature + `follow-up-of` 鏈回原 feature;不把 T2/T3
97
105
  寫回 completed 目錄)
98
- 3. 如果該功能的邏輯還在 Code-Behind 中,評估是否值得先抽離到 Domain 層
106
+ 3. 如果該功能的邏輯還在 delivery/entrypoint code 中,評估是否值得先抽離到 Domain 層
99
107
  4. 在 `dflow/specs/migration/tech-debt.md` 記錄發現的技術債
100
108
 
101
109
  ### Bug Fix
@@ -136,12 +144,12 @@ bugfix/{BUG-ID}-{short-description} # Bug 修復(SDD 必須)
136
144
  ### Domain Layer Rules (`src/Domain/`)
137
145
 
138
146
  此目錄中的程式碼必須遵守:
139
- - ❌ 不可引用 `System.Web` 或任何 WebForms 命名空間
147
+ - ❌ 不可引用任何 delivery-framework 命名空間(例:HTTP 請求/回應物件、Session/Cookie context、job runner context、CLI flag parser、ViewState 類等)
140
148
  - ❌ 不可直接存取資料庫(使用 interface + Repository pattern)
141
- - ❌ 不可使用 `HttpContext`、`Session`、`ViewState`
142
- - ❌ 不可有 UI 相關邏輯(格式化顯示、Page 引用)
143
- - ✅ 純 C# 類別,可直接搬到 ASP.NET Core 專案
144
- - ✅ 所有公開行為都能在沒有 Web 基礎設施的情況下測試
149
+ - ❌ 不可使用 delivery-framework runtime context(例:HTTP request/response、session/cookie、job runner state、CLI args)
150
+ - ❌ 不可有 UI / entrypoint 相關邏輯(格式化顯示、controller/page/handler 引用)
151
+ - ✅ 語言純粹的 class(不依賴 delivery framework),可直接搬到 target architecture
152
+ - ✅ 所有公開行為都能在沒有 delivery infrastructure 的情況下測試
145
153
 
146
154
  ### Glossary
147
155
 
@@ -152,6 +160,6 @@ bugfix/{BUG-ID}-{short-description} # Bug 修復(SDD 必須)
152
160
 
153
161
  - 開發者提出任何功能需求時,先引導建立 spec
154
162
  - 在回答 Domain 相關問題時,優先參考 `dflow/specs/domain/` 中的文件
155
- - 發現 Code-Behind 中的業務邏輯時,建議抽離到 `src/Domain/`
163
+ - 發現 delivery/entrypoint code 中的業務邏輯時,建議抽離到 `src/Domain/`
156
164
  - 每次開發循環結束時,提醒更新術語表和技術債記錄
157
165
  - 建立分支前,確認命名符合規範且對應 spec 存在
@@ -49,9 +49,9 @@ created: {YYYY-MM-DD}
49
49
 
50
50
  ## Code Mapping
51
51
 
52
- ### Current WebForms
53
- - Pages: `src/Pages/{相關頁面}.aspx`
52
+ ### Current Delivery/Entrypoint Mapping
53
+ - Delivery/entrypoint code: `{project/path/or/namespace}`
54
54
  - Domain: `src/Domain/{Context}/`
55
55
 
56
- ### Future ASP.NET Core
57
- - 預計作為獨立模組/專案
56
+ ### Target Architecture
57
+ - 預計作為 target architecture 中的獨立模組、服務、套件或 bounded context
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Context Map
4
4
 
5
- > Optional bounded context relationship map for WebForms brownfield discovery.
5
+ > Optional bounded context relationship map for Brownfield discovery.
6
6
 
7
7
  ## Context List
8
8
 
@@ -69,7 +69,9 @@ Template note (for AI):
69
69
 
70
70
  > Keep T2 Light tasks concise. If the fix scope starts to expand, AI should pause and ask the developer whether to keep this as T2 or upgrade it to T1. Do not auto-upgrade based on task count alone.
71
71
  >
72
- > Recommended layer tags (WebForms): `DOMAIN` / `PAGE` / `DATA` / `TEST` / `DOC`
72
+ > Recommended layer tags (Brownfield): `DOMAIN` / `DELIVERY` / `DATA` / `TEST` / `DOC`
73
+ > (`DELIVERY` covers delivery/entrypoint code: presentation/UI layer, controllers,
74
+ > handlers, jobs, message consumers, data pipelines, or stored procedures)
73
75
 
74
76
  - [ ] {LAYER}-1: {minimal required change}
75
77
  - [ ] TEST-1: {minimal verification / regression test}
@@ -36,4 +36,4 @@
36
36
 
37
37
  ## Code Mapping Notes
38
38
 
39
- - {domain concept} maps to `{existing WebForms / EF / service code}`.
39
+ - {domain concept} maps to `{existing delivery/entrypoint, persistence, or service code}`.
@@ -19,30 +19,33 @@ Template note (for AI):
19
19
  `phase-spec-YYYY-MM-DD-{slug}.md` placed at
20
20
  `dflow/specs/features/active/{SPEC-ID}-{slug}/`.
21
21
 
22
- Each section below carries an HTML comment indicating its fill-in phase (Phase 1-4).
23
- These phase markers let /dflow:status and the completion checklist track progress.
24
- Phases correspond to SKILL.md § Guiding Questions by Phase:
25
- Phase 1 - Understanding (What & Why)
26
- Phase 2 - Domain Analysis (Where does it live?)
27
- Phase 3 - Spec Writing (Behavior + Rules + Edge Cases)
28
- Phase 4 - Implementation Planning
29
- The "Implementation Tasks" section at the end is generated by AI after Phase 4 planning is done
22
+ Each section below carries an HTML comment indicating its fill-in activity (Activity 1-4).
23
+ These activity markers let /dflow:status and the completion checklist track progress.
24
+ Activities correspond to SKILL.md § Guiding Questions by Activity:
25
+ Activity 1: Understanding (What & Why)
26
+ Activity 2: Domain Analysis (Where does it live?)
27
+ Activity 3: Spec Writing (Behavior + Rules + Edge Cases)
28
+ Activity 4: Implementation Planning
29
+ The "Implementation Tasks" section at the end is generated by AI after Activity 4 (Implementation Planning) is done
30
30
  (see new-feature-flow.md Step 5 end / new-phase-flow.md Step 4 end /
31
31
  modify-existing-flow.md Step 4 end).
32
32
 
33
+ Note: "phase 2+ specs" / "Phase 2+" in the BR and Delta sections below refers to
34
+ the N-th phase-spec of this feature (i.e. iteration unit), NOT an activity number.
35
+
33
36
  For phase 2+ specs in the same feature: only list BRs that are NEW or
34
37
  MODIFIED in this phase under "Business Rules"; do not re-copy unchanged BRs from
35
38
  prior phases. The cumulative state lives in the feature's `_index.md`
36
39
  Current BR Snapshot table.
37
40
  -->
38
41
 
39
- ## Problem Description <!-- Fill timing: Phase 1 -->
42
+ ## Problem Description <!-- Fill timing: Activity 1: Understanding -->
40
43
 
41
44
  這個功能要解決什麼問題?誰需要它?
42
45
 
43
46
  > 用使用者的角度描述,避免技術用語。
44
47
 
45
- ## Domain Concepts <!-- Fill timing: Phase 2 -->
48
+ ## Domain Concepts <!-- Fill timing: Activity 2: Domain Analysis -->
46
49
 
47
50
  涉及的 Domain 概念(引用 `dflow/specs/domain/{context}/models.md`):
48
51
 
@@ -55,7 +58,7 @@ Template note (for AI):
55
58
  - [ ] `dflow/specs/domain/{context}/models.md` — 新增模型定義
56
59
 
57
60
  <!-- dflow:section behavior-scenarios -->
58
- ## Behavior Scenarios <!-- Fill timing: Phase 3 -->
61
+ ## Behavior Scenarios <!-- Fill timing: Activity 3: Spec Writing -->
59
62
 
60
63
  ### Main Success Scenario
61
64
 
@@ -75,7 +78,7 @@ Scenario: {替代情境}
75
78
  Then {不同的預期結果}
76
79
  ```
77
80
 
78
- ## Business Rules <!-- Fill timing: Phase 3 -->
81
+ ## Business Rules <!-- Fill timing: Activity 3: Spec Writing -->
79
82
 
80
83
  > Phase 2+ 注意:本段僅列**本 phase 新增 / 修改到的 BR**;未變動的 BR 不重抄
81
84
  > (它們的當前狀態見 feature 的 `_index.md` Current BR Snapshot 表)。
@@ -85,7 +88,7 @@ Scenario: {替代情境}
85
88
  | BR-01 | {規則描述} | |
86
89
  | BR-02 | {規則描述} | |
87
90
 
88
- ## Delta from prior phases <!-- Fill timing: Phase 3; skip for the first phase -->
91
+ ## Delta from prior phases <!-- Fill timing: Activity 3: Spec Writing; skip for the first phase -->
89
92
 
90
93
  > 本段僅記**本 phase 相對前一 phase 的變化**,不累積歷史。歷史由 feature 目錄下
91
94
  > 各 phase-spec 的本段串接閱讀;feature 層的當前累積狀態見 `_index.md` 的
@@ -119,18 +122,20 @@ Then {新的預期結果}
119
122
  - BR-003 金額上限
120
123
  - BR-005 提交後不可修改
121
124
 
122
- ## Edge Cases <!-- Fill timing: Phase 3 -->
125
+ ## Edge Cases <!-- Fill timing: Activity 3: Spec Writing -->
123
126
 
124
127
  | ID | Case | Expected Handling |
125
128
  |---|---|---|
126
129
  | EC-01 | {邊界描述} | {處理方式} |
127
130
  | EC-02 | {邊界描述} | {處理方式} |
128
131
 
129
- ## Implementation Notes <!-- Fill timing: Phase 4 -->
132
+ ## Implementation Notes <!-- Fill timing: Activity 4: Implementation Planning -->
130
133
 
131
- ### Current WebForms Implementation
134
+ ### Current Delivery-Layer Implementation
132
135
 
133
- > 在現有架構下如何實作?哪些 Code-Behind 會被修改?
136
+ > 在現有架構下如何實作?哪些 business logic embedded in delivery/entrypoint code
137
+ > (presentation/UI layer、controllers、handlers、jobs、message consumers、data
138
+ > pipelines、stored procedures)會被修改?
134
139
 
135
140
  ### Domain Layer Design
136
141
 
@@ -140,15 +145,15 @@ Then {新的預期結果}
140
145
  // 關鍵 Domain 類別草稿
141
146
  ```
142
147
 
143
- ### Keep Code-Behind Thin
148
+ ### Keep Delivery/Entrypoint Code Thin
144
149
 
145
- > Code-Behind 只負責:解析 UI 輸入 -> 呼叫 Domain 層 -> 顯示結果
150
+ > Delivery/entrypoint code 只負責:解析輸入 -> 呼叫 Domain 層 -> 回傳或顯示結果
146
151
 
147
- ### Future ASP.NET Core Migration Considerations
152
+ ### Target Architecture Considerations
148
153
 
149
- > 遷移時需要注意的事項,或者現在的設計如何幫助未來遷移。
154
+ > target architecture 需要注意的事項,或者現在的設計如何幫助後續演進。
150
155
 
151
- ## Data Structure Changes <!-- Fill timing: Phase 4 -->
156
+ ## Data Structure Changes <!-- Fill timing: Activity 4: Implementation Planning -->
152
157
 
153
158
  > 涉及的資料表與欄位變更(如有)
154
159
 
@@ -156,7 +161,7 @@ Then {新的預期結果}
156
161
  |---|---|---|---|
157
162
  | {Table} | {Column} | 新增/修改/刪除 | |
158
163
 
159
- ## Test Strategy <!-- Fill timing: Phase 4 -->
164
+ ## Test Strategy <!-- Fill timing: Activity 4: Implementation Planning -->
160
165
 
161
166
  > Domain 層的單元測試應驗證哪些行為?
162
167
 
@@ -164,24 +169,24 @@ Then {新的預期結果}
164
169
  - [ ] {測試案例 2}
165
170
 
166
171
  <!-- dflow:section open-questions -->
167
- ## Open Questions <!-- Fill timing: Phase 1-4 -->
172
+ ## Open Questions <!-- Fill timing: Activity 1-4; any time during planning -->
168
173
 
169
174
  - {尚未釐清的需求、規則、資料或實作問題}
170
175
 
171
176
  <!-- dflow:section implementation-tasks -->
172
- ## Implementation Tasks <!-- Fill timing: generated by AI after Phase 4; all items should be checked at completion -->
177
+ ## Implementation Tasks <!-- Fill timing: generated by AI after Activity 4: Implementation Planning; all items should be checked at completion -->
173
178
 
174
- > AI 在 Phase 4 實作規劃完成後,根據「Implementation Notes」產生的具體任務清單。
179
+ > AI 在 Activity 4 (Implementation Planning) 完成後,根據「Implementation Notes」產生的具體任務清單。
175
180
  > 格式:`[LAYER]-[NUMBER]: 任務描述`
176
181
  > 分類標籤(Brownfield track):
177
182
  > - `DOMAIN` — Domain 層類別、VO、Service、Interface
178
- > - `PAGE` — Code-Behind / ASPX 變更
183
+ > - `DELIVERY` — Delivery-layer code(entrypoints, controllers, handlers, UI/API adapters)
179
184
  > - `DATA` — 資料表 schema 或 Repository 實作
180
185
  > - `TEST` — 測試案例
181
186
  > 本段在 spec 歸檔(搬到 `completed/`)前應確認全部勾選,或明確標註未完成項的 follow-up。
182
187
 
183
188
  - [ ] DOMAIN-1: {任務描述}
184
189
  - [ ] DOMAIN-2: {任務描述}
185
- - [ ] PAGE-1: {任務描述}
190
+ - [ ] DELIVERY-1: {任務描述}
186
191
  - [ ] DATA-1: {任務描述}
187
192
  - [ ] TEST-1: {任務描述}
@@ -2,13 +2,13 @@
2
2
 
3
3
  # Migration Tech Debt
4
4
 
5
- > WebForms migration debt backlog discovered during SDD/DDD work.
5
+ > Target-architecture debt backlog discovered during SDD/DDD work.
6
6
 
7
7
  ## Debt Items
8
8
 
9
9
  | Item | Location | Description | Severity | Migration impact | Status |
10
10
  |---|---|---|---|---|---|
11
- | {Debt item} | `{file/path/or/namespace}` | {問題描述} | {Low/Medium/High/Critical} | {對 WebForms -> Core 遷移的影響} | {open/planned/in-progress/done} |
11
+ | {Debt item} | `{file/path/or/namespace}` | {問題描述} | {Low/Medium/High/Critical} | {對 target architecture 的影響} | {open/planned/in-progress/done} |
12
12
 
13
13
  ## Follow-up Notes
14
14
 
@@ -70,7 +70,8 @@ Signals:
70
70
  canonical English; compare against `TEMPLATE-LANGUAGE-GLOSSARY.md` if
71
71
  available.
72
72
  - References to a runtime `/dflow:init-project` slash command (V1
73
- replaced it with the shell command `npx dflow-sdd-ddd init`).
73
+ replaced it with the Dflow CLI init command (`dflow init`, or
74
+ `npx dflow-sdd-ddd init` when using the no-install path)).
74
75
  - A root `CLAUDE.md`, `AGENTS.md`, or equivalent that holds the full
75
76
  Dflow workflow text instead of being a thin shim pointing to this
76
77
  file.