dflow-sdd-ddd 0.1.0 → 0.2.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 +1176 -0
  2. package/CONTRIBUTING.md +123 -0
  3. package/README.md +199 -157
  4. package/TEMPLATE-COVERAGE.md +46 -0
  5. package/TEMPLATE-LANGUAGE-GLOSSARY.md +52 -0
  6. package/bin/dflow.js +73 -8
  7. package/docs/evaluating-dflow.md +226 -0
  8. package/docs/migrating-to-dflow-v1.md +212 -0
  9. package/docs/npm-publish-checklist.md +93 -0
  10. package/docs/release-versioning-policy.md +99 -0
  11. package/docs/using-with-claude-code.md +207 -0
  12. package/docs/using-with-codex.md +244 -0
  13. package/docs/why-ddd-for-ai.md +35 -0
  14. package/lib/init.js +444 -66
  15. package/package.json +13 -7
  16. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +92 -0
  17. package/templates/{webforms → brownfield}/scaffolding/CLAUDE-md-snippet.md +8 -9
  18. package/templates/{webforms → brownfield}/scaffolding/Git-principles-gitflow.md +1 -1
  19. package/templates/{webforms → brownfield}/scaffolding/Git-principles-trunk.md +1 -1
  20. package/templates/{webforms → brownfield}/scaffolding/_conventions.md +2 -1
  21. package/templates/{webforms → brownfield}/scaffolding/_overview.md +2 -2
  22. package/templates/{webforms → brownfield}/templates/context-map.md +1 -1
  23. package/templates/{webforms → brownfield}/templates/glossary.md +1 -1
  24. package/templates/{webforms → brownfield}/templates/models.md +1 -1
  25. package/templates/{webforms → brownfield}/templates/phase-spec.md +1 -1
  26. package/templates/{webforms → brownfield}/templates/rules.md +1 -1
  27. package/templates/{webforms → brownfield}/templates/tech-debt.md +1 -1
  28. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +92 -0
  29. package/templates/{core → greenfield}/scaffolding/CLAUDE-md-snippet.md +15 -14
  30. package/templates/{core → greenfield}/scaffolding/Git-principles-gitflow.md +1 -1
  31. package/templates/{core → greenfield}/scaffolding/Git-principles-trunk.md +1 -1
  32. package/templates/{core → greenfield}/scaffolding/_conventions.md +2 -1
  33. package/templates/{core → greenfield}/scaffolding/_overview.md +2 -2
  34. package/templates/{core → greenfield}/scaffolding/architecture-decisions-README.md +1 -1
  35. package/templates/{core → greenfield}/templates/context-map.md +1 -1
  36. package/templates/{core → greenfield}/templates/events.md +1 -1
  37. package/templates/{core → greenfield}/templates/glossary.md +1 -1
  38. package/templates/{core → greenfield}/templates/models.md +1 -1
  39. package/templates/{core → greenfield}/templates/phase-spec.md +1 -1
  40. package/templates/{core → greenfield}/templates/rules.md +1 -1
  41. package/templates/{core → greenfield}/templates/tech-debt.md +1 -1
  42. /package/templates/{webforms → brownfield}/templates/CLAUDE.md +0 -0
  43. /package/templates/{webforms → brownfield}/templates/_index.md +0 -0
  44. /package/templates/{webforms → brownfield}/templates/behavior.md +0 -0
  45. /package/templates/{webforms → brownfield}/templates/context-definition.md +0 -0
  46. /package/templates/{webforms → brownfield}/templates/lightweight-spec.md +0 -0
  47. /package/templates/{core → greenfield}/templates/CLAUDE.md +0 -0
  48. /package/templates/{core → greenfield}/templates/_index.md +0 -0
  49. /package/templates/{core → greenfield}/templates/aggregate-design.md +0 -0
  50. /package/templates/{core → greenfield}/templates/behavior.md +0 -0
  51. /package/templates/{core → greenfield}/templates/context-definition.md +0 -0
  52. /package/templates/{core → greenfield}/templates/lightweight-spec.md +0 -0
@@ -0,0 +1,123 @@
1
+ # Contributing to Dflow
2
+
3
+ Thanks for taking the time to improve Dflow. This project is a spec-first
4
+ SDD/DDD workflow kit for AI-assisted development, so changes are reviewed for
5
+ both implementation correctness and workflow clarity.
6
+
7
+ ## Before You Start
8
+
9
+ Please read:
10
+
11
+ - `README.md` for the public project overview and installation flow.
12
+ - `TEMPLATE-COVERAGE.md` before changing templates, scaffolding, or generated
13
+ document structure.
14
+ - `TEMPLATE-LANGUAGE-GLOSSARY.md` before changing template headings or field
15
+ labels.
16
+ - The relevant Greenfield or Brownfield skill source when changing workflow
17
+ behavior.
18
+
19
+ The public source is kept intentionally smaller than the development workspace.
20
+ Internal planning notes, proposal handoffs, and review artifacts are maintainer
21
+ records; public issues and pull requests should be understandable without them.
22
+
23
+ ## What to Open
24
+
25
+ Open a bug report when an existing command, generated file, or documented flow
26
+ does not behave as described.
27
+
28
+ Open a workflow change request when you want to change Dflow behavior, template
29
+ shape, generated scaffolding, DDD guidance, or the contract of a `/dflow:*`
30
+ flow.
31
+
32
+ Open docs feedback when the current documentation is confusing, incomplete, or
33
+ hard to follow.
34
+
35
+ Open a question when you need help deciding how Dflow applies to your project.
36
+ Questions are welcome, but this project does not promise a general support SLA.
37
+
38
+ If an AI assistant notices a possible Dflow issue while helping in your project,
39
+ you can ask it to run `/dflow:report-dflow-feedback`. That flow should produce a
40
+ sanitized local draft that you review before opening a GitHub issue or PR. It
41
+ must not submit private project details or publish anything automatically.
42
+
43
+ ## Pull Request Expectations
44
+
45
+ Keep pull requests focused. A good PR explains:
46
+
47
+ - What changed and why.
48
+ - Which files or workflow contracts are affected.
49
+ - Whether the change affects Greenfield, Brownfield, or both tracks.
50
+ - Whether common flow files were synchronized across both tracks.
51
+ - Whether generated templates, tutorial material, or coverage docs need updates.
52
+ - What verification was run.
53
+
54
+ For code or packaging changes, run:
55
+
56
+ ```bash
57
+ npm test
58
+ npm pack --dry-run
59
+ git diff --check
60
+ ```
61
+
62
+ For documentation-only changes, at minimum run:
63
+
64
+ ```bash
65
+ git diff --check
66
+ ```
67
+
68
+ If a command cannot be run in your environment, note that in the PR.
69
+
70
+ GitHub Actions runs the same verification commands on every pull request to
71
+ `main` and on every push to `main`. The CI is verification-only — it does not
72
+ publish releases, change versions, or create tags.
73
+
74
+ When changing templates or scaffolding, keep both source surfaces aligned:
75
+
76
+ - skill source under `sdd-ddd-greenfield-skill/` or
77
+ `sdd-ddd-brownfield-skill/`
78
+ - packaged templates under `templates/greenfield/` or `templates/brownfield/`
79
+
80
+ If you are unsure which surface to edit, describe that uncertainty in the PR.
81
+
82
+ ## Greenfield and Brownfield Synchronization
83
+
84
+ Several Dflow flows are shared between the Greenfield and Brownfield tracks. If
85
+ you change a common SDD flow, update both copies unless the change is
86
+ intentionally track-specific.
87
+
88
+ Common shared flows include:
89
+
90
+ - `dflow-feedback-flow.md`
91
+ - `init-project-flow.md`
92
+ - `new-feature-flow.md`
93
+ - `modify-existing-flow.md`
94
+ - `new-phase-flow.md`
95
+ - `finish-feature-flow.md`
96
+ - `drift-verification.md`
97
+ - `pr-review-checklist.md`
98
+ - `git-integration.md`
99
+
100
+ Track-specific behavior is fine, but it should be named explicitly in the PR.
101
+
102
+ ## Template and Heading Changes
103
+
104
+ Dflow templates use canonical English structure so AI agents can locate sections
105
+ reliably across projects. User-authored prose inside generated documents may use
106
+ the team's chosen prose language.
107
+
108
+ Do not localize template headings or structural field labels as a drive-by
109
+ change. Localized headings require a separate design decision because they
110
+ affect templates, anchors, tutorial output, and verification strategy.
111
+
112
+ ## Release Changes
113
+
114
+ If your change affects published behavior, generated files, CLI commands, or
115
+ workflow contracts, mention the expected version impact in the PR:
116
+
117
+ - Patch: bug fix, docs clarification, release metadata, or non-breaking wording.
118
+ - Minor: new command, new generated file, workflow contract expansion, or
119
+ materially changed template shape.
120
+ - Breaking change: anything that can make existing Dflow projects or automation
121
+ need manual adjustment.
122
+
123
+ See `docs/release-versioning-policy.md` for the maintainer release policy.
package/README.md CHANGED
@@ -1,209 +1,251 @@
1
- # AI-Guided SDD/DDD Development Skills
1
+ # Dflow
2
2
 
3
- AI 引導的規格驅動開發(SDD)與領域驅動設計(DDD)工作流程規範,設計用於 Claude Code 協作開發。
3
+ Dflow is a spec-first workflow kit for AI-assisted software development. It gives your AI coding agent a concrete process for turning change requests into structured specs, domain language, implementation plans, drift checks, and reviewable code instead of jumping straight from prompt to code.
4
4
 
5
- ## 這是什麼
5
+ AI makes delivery faster, but it also makes ambiguous domain knowledge more dangerous. Dflow uses DDD ideas such as ubiquitous language, bounded contexts, domain rules, and model ownership as the semantic backbone of SDD, so the AI has constraints before it generates code. The goal is not ceremony for its own sake; the goal is repeatable software change with clearer meaning, fewer scattered rules, and less prompt-dependent behavior.
6
6
 
7
- 這套 Skill 讓 AI 在開發過程中擔任**流程守衛(Workflow Guardian)**的角色。開發者不需要熟悉 SDD 或 DDD 的所有細節——AI 會在對的時機問對的問題,引導開發者自然地產出規格文件、領域模型、和技術債記錄。
7
+ ## Key Features
8
8
 
9
- 適用場景:
10
- - 團隊導入 SDD/DDD 但成員經驗不一
11
- - 希望在開發過程中保持架構紀律
12
- - ASP.NET WebForms 專案準備遷移到 ASP.NET Core
13
- - 學習 DDD 並透過模擬專案練習
9
+ | Feature | What it gives engineering teams |
10
+ |---|---|
11
+ | **Spec-first development** | Every meaningful change starts from an explicit spec, acceptance behavior, and implementation plan before code changes begin. |
12
+ | **Greenfield and Brownfield tracks** | Start clean in a new project, or introduce Dflow into an existing codebase through progressive domain extraction and safer incremental change. |
13
+ | **Hybrid workflow control** | Command-first entry points for intentional work, auto-trigger checks as a safety net, and transparent phase gates so developers stay in control. |
14
+ | **DDD semantic backbone** | Captures domain language, context boundaries, business rules, and model decisions so AI output is constrained by project meaning. |
15
+ | **Three-layer documentation model** | Keeps short-lived phase deltas, feature snapshots, and system-level state separate, so specs stay useful instead of becoming one large document dump. |
16
+ | **Drift verification** | Checks whether specs, domain documents, implementation, tests, and technical debt records still describe the same system. |
17
+
18
+ ## Get Started
14
19
 
15
- ## 目錄結構
20
+ Prerequisite: a local Node.js / npm environment that can run `npx`.
16
21
 
22
+ Run Dflow from the root of the project you want to adopt it in:
23
+
24
+ ```bash
25
+ npx dflow-sdd-ddd init
17
26
  ```
18
- ├── bin/ # dflow CLI entrypoint
19
- ├── lib/ # init runtime implementation
20
- ├── templates/ # npm package template source
21
- ├── test/ # smoke tests
22
- ├── tutorial/ # 人讀教學劇本與範例 outputs
23
- ├── planning/ # handoff / contract / planning notes
24
- ├── proposals/ # Proposal 管理目錄
25
- ├── reviews/ # cross-round review reports and prompts
26
- ├── sdd-ddd-webforms-skill/ # WebForms 版 Skill(英文,供 AI 使用)
27
- └── sdd-ddd-core-skill/ # ASP.NET Core 版 Skill(英文,供 AI 使用)
27
+
28
+ The init flow asks whether the project is greenfield or brownfield, then
29
+ previews the files it will create. Existing files are not overwritten. Init
30
+ creates workflow documentation and AI instruction files; it does not inspect,
31
+ refactor, or migrate your application code.
32
+
33
+ For a fixed global CLI:
34
+
35
+ ```bash
36
+ npm install -g dflow-sdd-ddd
37
+ dflow init
28
38
  ```
29
39
 
30
- ---
40
+ If the project is already initialized and you later add another AI coding
41
+ tool, run:
31
42
 
32
- ## 兩套 Skill 的差異
43
+ ```bash
44
+ dflow configure-agents
45
+ ```
33
46
 
34
- | | WebForms Skill | Core Skill |
35
- |---|---|---|
36
- | **適用階段** | 目前:在運行中的 WebForms 專案開發 | 未來:ASP.NET Core 新專案 / 模擬練習 |
37
- | **架構** | Domain 層 + Code-Behind(兩層) | Clean Architecture 四層 |
38
- | **DDD 深度** | 準備性——術語表、Context 識別、基本抽離 | 完整戰術模式——Aggregate、Domain Events、CQRS |
39
- | **核心引導** | 「Code-Behind 盡量薄」 | 「每一層各司其職,業務邏輯只在 Domain」 |
40
- | **遷移意識** | 每次開發都產出可遷移的資產 | 從頭設計乾淨架構 |
41
- | **附加內容** | — | DDD 建模指南、Aggregate 設計工作表、模擬練習計畫 |
47
+ This command only configures AI instruction files. It does not rerun project
48
+ initialization or touch existing specs.
42
49
 
43
- ---
50
+ To check whether the project still has legacy or pre-V1 artifacts (such as
51
+ a top-level `specs/` directory or a `_共用/` directory left over from older
52
+ Dflow forms), run:
44
53
 
45
- ## WebForms Skill 檔案說明
54
+ ```bash
55
+ dflow doctor
56
+ ```
46
57
 
47
- ### SKILL.md — 主文件
48
- AI 的決策樹和核心規範。定義了五個核心原則、流程嚴謹度對照表、專案目錄結構、各階段引導問題、Domain 層規範。
58
+ `doctor` is a read-only health check. It never modifies files; it only
59
+ reports findings and points at the migration guide.
49
60
 
50
- ### references/ — 流程參考
51
- | 檔案 | 內容 |
52
- |---|---|
53
- | `init-project-flow.md` | `npx dflow-sdd-ddd init` 的 internal flow / manual fallback,定義 project bootstrap 問答和 scaffolding 行為 |
54
- | `new-feature-flow.md` | 新功能 8 步驟流程:需求理解 → Context 識別 → 概念發掘 → 撰寫規格 → 實作規劃 → 分支 → 實作 → 完成 |
55
- | `modify-existing-flow.md` | 修改既有功能流程,重點在趁機從 Code-Behind 抽離業務邏輯到 Domain 層 |
56
- | `new-phase-flow.md` | 在既有 feature 下新增 phase 的規格與實作流程 |
57
- | `finish-feature-flow.md` | 完成功能時的 drift 檢查、文件收斂與 tech-debt 收尾 |
58
- | `drift-verification.md` | 規格、模型、實作與文件間的 drift verification 檢查 |
59
- | `git-integration.md` | Git principles 與 SDD 階段對齊,每個 gate 有具體檢查項目 |
60
- | `pr-review-checklist.md` | PR 審查時的合規檢查和遷移準備度 A~F 評分 |
61
-
62
- ### scaffolding/ — init 建立的基線文件
63
- | 檔案 | 用途 |
64
- |---|---|
65
- | `_overview.md` | Dflow-owned spec tree 的總覽 |
66
- | `_conventions.md` | 專案 convention,包含 `Prose Language` |
67
- | `Git-principles-*.md` | Git Flow / Trunk-Based Development 原則模板 |
61
+ After init, start work through the Dflow workflow in your AI coding agent:
68
62
 
69
- ### templates/ — 模板
70
- | 檔案 | 用途 |
71
- |---|---|
72
- | `_index.md` | feature / phase 索引與 integration summary |
73
- | `phase-spec.md` | phase 級規格模板 |
74
- | `behavior.md` | Given/When/Then 行為規格模板 |
75
- | `lightweight-spec.md` | Bug 修復用的輕量規格模板 |
76
- | `context-definition.md` | 新 Bounded Context 定義模板 |
77
- | `CLAUDE.md` | init 用的 AI 協作規範模板來源;採用時由 `npx dflow-sdd-ddd init` 處理 |
78
- | `context-map.md`、`glossary.md`、`models.md`、`rules.md`、`tech-debt.md` | domain / migration 文件模板 |
63
+ ```text
64
+ /dflow:new-feature
65
+ /dflow:modify-existing
66
+ /dflow:bug-fix
67
+ /dflow:new-phase
68
+ /dflow:finish-feature
69
+ /dflow:verify
70
+ /dflow:pr-review
71
+ ```
79
72
 
80
- ---
73
+ If your tool does not support custom slash commands, use the same command names as plain instructions in chat. Dflow is Markdown-based workflow material plus a scaffolding CLI, so it can be used with AI coding agents that can read project instructions and repository context.
81
74
 
82
- ## Core Skill 檔案說明
75
+ For the first adoption pass, use a branch or disposable sample project so your
76
+ team can inspect the generated `dflow/specs/` workspace before bringing the
77
+ workflow into an active codebase.
83
78
 
84
- ### SKILL.md — 主文件
85
- 在 WebForms 版基礎上新增:Clean Architecture 四層架構圖、各層不可妥協的規範、DDD 戰術模式的引導問題。
79
+ For a guided evaluation walk-through — what `init` creates, AI tool support,
80
+ track choice, and a 30-minute sample-project playbook — see [Evaluating
81
+ Dflow](docs/evaluating-dflow.md). For end-to-end scenario walk-throughs of
82
+ Greenfield and Brownfield workflows with worked spec outputs, see the
83
+ [`tutorial/`](tutorial/README.md) index (top of file has an English reading
84
+ guide).
86
85
 
87
- ### references/ — 流程參考
88
- | 檔案 | 內容 |
89
- |---|---|
90
- | `init-project-flow.md` | `npx dflow-sdd-ddd init` 的 internal flow / manual fallback,定義 project bootstrap 問答和 scaffolding 行為 |
91
- | `new-feature-flow.md` | 新功能流程,新增逐層實作順序(Domain → Application → Infrastructure → Presentation) |
92
- | `modify-existing-flow.md` | 修改流程,新增 Aggregate 設計重新評估 |
93
- | `new-phase-flow.md` | 在既有 feature 下新增 phase 的規格與實作流程 |
94
- | `finish-feature-flow.md` | 完成功能時的 drift 檢查、文件收斂與 tech-debt 收尾 |
95
- | `drift-verification.md` | 規格、模型、實作與文件間的 drift verification 檢查 |
96
- | `ddd-modeling-guide.md` | **核心新增**:DDD 建模完整指南,涵蓋 Aggregate 設計規則、Value Object、Domain Events、Specification、Domain Service、Bounded Context 關係、常見錯誤 |
97
- | `git-integration.md` | Git principles 與 SDD 階段對齊,閘門檢查新增 Aggregate 設計和 Domain Events |
98
- | `pr-review-checklist.md` | PR 審查,四層各自的檢查項目 |
99
-
100
- ### scaffolding/ — init 建立的基線文件
101
- | 檔案 | 用途 |
102
- |---|---|
103
- | `_overview.md` | Dflow-owned spec tree 的總覽 |
104
- | `_conventions.md` | 專案 convention,包含 `Prose Language` |
105
- | `architecture-decisions-README.md` | architecture decisions 目錄說明 |
106
- | `Git-principles-*.md` | Git Flow / Trunk-Based Development 原則模板 |
86
+ ## Project Tracks
107
87
 
108
- ### templates/ — 模板
109
- | 檔案 | 用途 |
110
- |---|---|
111
- | `_index.md` | feature / phase 索引與 integration summary |
112
- | `phase-spec.md` | phase 級規格模板,支援 Domain Events 和逐層實作計畫 |
113
- | `behavior.md` | Given/When/Then 行為規格模板 |
114
- | `lightweight-spec.md` | 輕量規格模板 |
115
- | `context-definition.md` | Bounded Context 定義模板 |
116
- | `aggregate-design.md` | **核心新增**:Aggregate 設計工作表(不變條件、狀態變更方法、Events、引用關係) |
117
- | `CLAUDE.md` | init 用的 AI 協作規範模板來源;採用時由 `npx dflow-sdd-ddd init` 處理 |
118
- | `events.md`、`context-map.md`、`glossary.md`、`models.md`、`rules.md`、`tech-debt.md` | domain / architecture 文件模板 |
119
-
120
- ### PRACTICE_PLAN_tw.md — 模擬練習計畫
121
- 7 個 Phase 的 DDD 學習路線,使用費用報銷系統作為模擬專案,預估 15-22 小時:
122
-
123
- | Phase | 內容 | 學到的 DDD 概念 |
88
+ | Track | Use it when | Main outcome |
124
89
  |---|---|---|
125
- | 1 | 建立基礎、識別 Bounded Context | Context Map、Ubiquitous Language |
126
- | 2 | 第一個 Aggregate + Value Objects | Aggregate Root、不變條件、Private Setter |
127
- | 3 | Domain Events | 事件驅動、最終一致性 |
128
- | 4 | 第二個 Aggregate + 跨 Aggregate 溝通 | Reference by ID、狀態機 |
129
- | 5 | CQRS + Application 層 | Command/Query 分離 |
130
- | 6 | Infrastructure 整合 | EF Core 設定、Repository、Event Dispatching |
131
- | 7 | 回顧 + Skill 檢視 | 流程改善 |
90
+ | **Greenfield** | You are starting a new system or a new bounded area with room to shape architecture and domain model early. | Clean spec baseline, domain model ownership, feature-by-feature implementation through SDD. |
91
+ | **Brownfield** | You are adding or changing behavior in an existing codebase where business rules may already be scattered. | Progressive domain extraction, safer change planning, and migration-ready domain knowledge. |
132
92
 
133
- ---
93
+ These tracks describe adoption style, not framework branding. Dflow should be read as a workflow system for software teams that want AI assistance without giving up domain clarity.
134
94
 
135
- ## How to adopt Dflow in your project
95
+ ## Workflow Model
136
96
 
137
- Dflow is the AI-guided SDD/DDD workflow contained in this repo (see `sdd-ddd-webforms-skill/` and `sdd-ddd-core-skill/`). In V1, project bootstrap is npm CLI first: the default entry is `npx dflow-sdd-ddd init`, which seeds `dflow/specs/` and keeps Dflow-owned documents under the `dflow/` namespace.
97
+ Dflow uses a hybrid design:
138
98
 
139
- The npm package is published as `dflow-sdd-ddd` because the unscoped `dflow` package name is already occupied on npm. The installed CLI still exposes the `dflow` binary for global installs.
99
+ | Layer | Purpose |
100
+ |---|---|
101
+ | **Command-first entry** | Developers intentionally start work with commands such as `/dflow:new-feature` or `/dflow:modify-existing`. |
102
+ | **Auto-trigger safety net** | When the conversation clearly implies a feature, phase, bug fix, verification, or review, the AI should suggest the matching Dflow flow. |
103
+ | **Transparency gates** | The AI announces flow entry, phase transitions, and important internal steps so the developer can approve direction before work expands. |
140
104
 
141
- Adopting Dflow in a project takes 4 steps:
105
+ Dflow also scales ceremony by change risk:
142
106
 
143
- 1. In your project root, run `npx dflow-sdd-ddd init`.
144
- 2. Answer the intake questions. Dflow will ask for the edition, project context, optional starter files, and the required project prose language for generated spec content.
145
- 3. Review the file-list preview and confirm the writes. Existing files are never overwritten.
146
- 4. Start your first feature with `/dflow:new-feature`, or for an existing codebase, `/dflow:modify-existing` to work from an incoming change request.
107
+ | Tier | Typical use | Expected weight |
108
+ |---|---|---|
109
+ | **T1 Lightweight** | Small bug fixes or narrow edits. | Minimal spec, focused verification. |
110
+ | **T2 Standard** | Normal feature work. | Feature spec, behavior examples, implementation plan, finish checks. |
111
+ | **T3 Full** | Cross-cutting changes, new bounded contexts, risky architecture work. | Full domain modeling, phase planning, broader drift verification, stronger review gates. |
147
112
 
148
- The generated baseline lives under `dflow/specs/`, for example `dflow/specs/shared/_conventions.md`, `dflow/specs/domain/glossary.md`, and `dflow/specs/features/active/`. The project AI guide is the one special root-level exception: `CLAUDE.md` stays at the project root so AI tools can discover it normally. If a root `CLAUDE.md` already exists, Dflow writes a mergeable snippet instead of overwriting it.
113
+ The transparency gates and T1/T2/T3 tiers are related but separate: transparency controls how the AI communicates the workflow; tiers control how much specification and verification the change needs.
149
114
 
150
- Dflow keeps template structure stable in English: headings, table headers, labels, anchors, IDs, placeholders, file paths, and code-facing terms remain canonical English. Free prose inside those sections follows the project's `Prose Language` setting in `dflow/specs/shared/_conventions.md`.
115
+ ## Documentation Model
151
116
 
152
- Advanced usage: `npm install -g dflow-sdd-ddd` may be useful for users who want a fixed global CLI, then run `dflow init`. This is not the V1 default. `npm create dflow-sdd-ddd` is not implemented in V1 and remains a V2 evaluation item.
117
+ Dflow separates documents by lifecycle:
153
118
 
154
- For what gets created at init time, how scaffolding templates are chosen, and how to re-run safely, see `sdd-ddd-webforms-skill/references/init-project-flow.md` (or the Core equivalent).
119
+ | Layer | Shape | Purpose |
120
+ |---|---|---|
121
+ | **Phase Delta** | Short-lived phase spec. | Captures what this phase changes, why, and how it will be verified. |
122
+ | **Feature Snapshot** | Feature-level summary and behavior. | Preserves the accepted behavior and implementation decisions after phases complete. |
123
+ | **System State** | Shared domain and architecture documents. | Maintains durable knowledge such as glossary, context map, rules, models, conventions, and technical debt. |
124
+
125
+ This keeps AI collaboration grounded. The phase layer gives the agent immediate execution context, the feature layer records what was delivered, and the system layer becomes the long-term source of truth for future prompts and reviews.
126
+
127
+ ## Files Created by Init
128
+
129
+ A typical initialized project receives a `dflow/` workspace:
130
+
131
+ ```text
132
+ dflow/
133
+ specs/
134
+ shared/
135
+ _overview.md
136
+ _conventions.md
137
+ Git-principles-*.md
138
+ domain/
139
+ glossary.md
140
+ context-map.md
141
+ architecture/
142
+ tech-debt.md
143
+ features/
144
+ active/
145
+ completed/
146
+ ```
155
147
 
156
- ### V2 Starter Kit and Dflow — division of labour
148
+ 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.
157
149
 
158
- Dflow is distributed alongside a sister project, **V2 Starter Kit** (`SDD-Starter-Kit`), which plays a complementary role:
150
+ When you select AI agent setup during init, Dflow writes
151
+ `dflow/specs/shared/AI-AGENT-GUIDE.md` as the canonical project guide, then
152
+ creates small tool-specific shims that point back to it:
159
153
 
160
- | | V2 Starter Kit | Dflow (this repo) |
161
- |---|---|---|
162
- | **Format** | Complete distributable starter kit (flat files + tutorial docs) | AI-guided skill (read and executed by Claude Code at runtime) |
163
- | **Onboarding documents** | Ships full onboarding pack (e.g. `SDD-AI協作開發模式介紹.md`, `使用說明.md`) | Ships minimal scaffolding templates only (`scaffolding/`) |
164
- | **Primary audience** | Humans reading + copying files manually | AI running slash commands in a live project |
165
- | **Typical use** | Teams evaluating SDD/DDD or wanting a human-readable reference | Teams who want the workflow enforced at development time |
154
+ | Tool target | Generated file |
155
+ |---|---|
156
+ | Codex / Copilot coding agent | `AGENTS.md` |
157
+ | Claude Code | `CLAUDE.md` |
158
+ | Gemini CLI | `GEMINI.md` |
159
+ | GitHub Copilot | `.github/copilot-instructions.md` |
166
160
 
167
- The two are designed to coexist: you can start with V2's onboarding docs for reading/training, then adopt Dflow in the project itself for enforcement. Dflow's `scaffolding/` is intentionally a **minimal** template set; if you want the full V2 onboarding documents, copy them from V2 separately (V2's Tutorial rebuild is tracked as Closeout C2 of this repo's work plan).
161
+ If one of those files already exists, Dflow leaves it unchanged and writes a
162
+ merge snippet under `dflow/specs/shared/` instead. The project guide stays the
163
+ single source of truth, so teams can use multiple AI tools without maintaining
164
+ multiple copies of the workflow rules.
168
165
 
169
- ---
166
+ You can run `dflow configure-agents` later to add more tool shims as the team
167
+ adopts additional AI coding agents.
170
168
 
171
- ## 如何使用
169
+ For tool-specific walk-throughs of what `init` writes and how Dflow's
170
+ workflow commands appear in a given AI tool, see the per-tool guides under
171
+ `docs/`:
172
172
 
173
- ### 在專案中採用 Dflow
173
+ - [Using Dflow with Claude Code](docs/using-with-claude-code.md)
174
+ - [Using Dflow with Codex CLI](docs/using-with-codex.md)
174
175
 
175
- 1. 在專案根目錄執行 `npx dflow-sdd-ddd init`
176
- 2. 依提示選擇 edition、starter files、project prose language
177
- 3. 預覽並確認寫入清單;Dflow 不會覆寫既有檔案
178
- 4. 啟動 AI coding agent,從 `/dflow:new-feature` 或 `/dflow:modify-existing` 開始
176
+ Guides for Gemini CLI and GitHub Copilot may follow as maintainer
177
+ experience with each tool stabilizes.
179
178
 
180
- ### 在 Claude Code 中進行 DDD 模擬練習
179
+ Init does not copy the `tutorial/` directory into your project. The
180
+ [`tutorial/`](tutorial/README.md) directory lives in this source repository
181
+ as evaluation material for understanding how Dflow works on Greenfield and
182
+ Brownfield scenarios; the tutorial index opens with an English reading guide
183
+ for non-Chinese readers.
181
184
 
182
- 1. 在練習專案根目錄執行 `npx dflow-sdd-ddd init`,選擇 Core edition
183
- 2. 啟動 Claude Code,輸入:
184
- ```
185
- 我要開始一個 DDD 模擬練習專案:員工費用報銷系統(ExpenseTracker)。
186
- 請依照 Skill 中定義的流程引導我,從 Phase 1 開始。
187
- ```
185
+ ## Main Flows
188
186
 
189
- ---
187
+ | Flow | When to use it | Typical outputs |
188
+ |---|---|---|
189
+ | `/dflow:new-feature` | A new user-visible capability or business behavior. | Feature spec, behavior examples, phase plan, domain updates. |
190
+ | `/dflow:modify-existing` | A change to behavior already present in the system. | Impact analysis, updated specs, adjusted domain rules, migration notes when needed. |
191
+ | `/dflow:bug-fix` | A defect where expected behavior can be stated narrowly. | Lightweight spec, reproduction, fix plan, regression check. |
192
+ | `/dflow:new-phase` | A feature needs another implementation slice. | Phase delta, acceptance checks, focused implementation plan. |
193
+ | `/dflow:finish-feature` | The implementation is done and needs closure. | Drift verification, feature snapshot, technical debt update, review checklist. |
194
+ | `/dflow:verify` | You need confidence that docs and code still match. | Drift report across spec, domain docs, implementation, tests, and debt records. |
195
+ | `/dflow:pr-review` | A change is ready for review. | SDD/DDD compliance review with risks, gaps, and follow-up items. |
196
+ | `/dflow:report-dflow-feedback` | You or the AI found a Dflow issue or improvement while using the workflow. | Sanitized local feedback draft for a GitHub issue or future PR; nothing is submitted automatically. |
190
197
 
191
- ## 設計理念
198
+ ## Why DDD Matters More with AI
192
199
 
193
- ### Spec Before Code(先規格、後程式碼)
194
- 每一次程式碼變更都應該有對應的規格文件。規格不是額外的負擔,而是思考的工具——在寫程式之前先想清楚要做什麼。
200
+ AI agents are strong at filling gaps. That is useful when the missing detail is mechanical, but risky when the missing detail is business meaning. If a prompt does not define the language, boundaries, and allowed behavior, the model may invent plausible rules that are hard to notice in review.
195
201
 
196
- ### AI 作為流程守衛
197
- AI 不只是回答問題的工具,它主動引導開發流程:在你開分支前確認規格存在、在你寫 Code-Behind 時提醒業務邏輯應該在 Domain 層、在 PR 時檢查架構合規性。
202
+ Dflow treats DDD as the semantic structure behind the spec. Ubiquitous language keeps names consistent. Bounded contexts keep meanings from leaking across areas. Domain rules define what is correct, allowed, or forbidden before implementation starts.
198
203
 
199
- ### 漸進式 DDD
200
- 不需要一次到位。WebForms 階段先累積術語表和領域知識,ASP.NET Core 階段再完整落地 DDD 戰術模式。現在寫的每一份規格和每一段 Domain 層程式碼,都是未來遷移的資產。
204
+ In a code-first workflow, design often appears after the fact in classes, handlers, and tests. In an AI-assisted workflow, the spec must become the precondition for generation. The practical flow becomes:
201
205
 
202
- ### 三份資產
203
- 每次開發循環都產出:**規格文件**(未來的需求文件)、**Domain 層程式碼**(可直接遷移)、**技術債記錄**(遷移指南)。
206
+ ```text
207
+ Domain meaning -> Structured spec -> AI implementation -> Code as output
208
+ ```
209
+
210
+ For a longer explanation, see [Why DDD Matters More with AI](docs/why-ddd-for-ai.md).
204
211
 
205
- ---
212
+ ## Repository Layout
206
213
 
207
- ## 授權
214
+ | Path | Purpose |
215
+ |---|---|
216
+ | `bin/` | CLI entrypoint. |
217
+ | `lib/` | Init runtime implementation. |
218
+ | `templates/` | Files copied by the init command. |
219
+ | `test/` | Smoke tests for generated output. |
220
+ | `tutorial/` | Guided learning scenarios and expected outputs. |
221
+ | `sdd-ddd-*-skill/` | Source workflow material consumed by AI coding agents. |
222
+
223
+ ## Contributing and Releases
224
+
225
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for issue and pull request guidance.
226
+ Pull requests run an automated verification workflow on GitHub before review.
227
+ Maintainer-facing release rules are documented in [Release and Versioning
228
+ Policy](docs/release-versioning-policy.md), with the manual npm flow in [npm
229
+ Publish Checklist](docs/npm-publish-checklist.md).
230
+
231
+ ## Status
232
+
233
+ Dflow is currently published as `dflow-sdd-ddd` on npm. The latest published
234
+ npm package is `0.2.0`, covering project initialization, workflow
235
+ documentation, multi-AI agent setup, AI-agent-readable SDD/DDD guidance,
236
+ public migration tooling (manual migration guide and `dflow doctor`
237
+ read-only health check), public onboarding (evaluator guide and per-tool
238
+ walkthroughs for Claude Code and Codex CLI), and a verification-only CI
239
+ workflow.
240
+
241
+ The GitHub source may include post-`0.2.0` repository changes before the
242
+ next npm release is published. See [CHANGELOG.md](CHANGELOG.md) for full
243
+ release history.
244
+
245
+ If you maintain a project that adopted an early Dflow form before
246
+ `0.1.0` was published, see [Migrating to Dflow
247
+ V1](docs/migrating-to-dflow-v1.md) for the manual migration checklist.
248
+
249
+ ## License
208
250
 
209
251
  MIT License. See [LICENSE](LICENSE).
@@ -0,0 +1,46 @@
1
+ <!-- Maintenance contract for Dflow. See archive/proposals/PROPOSAL-013-system-document-template-coverage.md §4 for origin. -->
2
+
3
+ # Template Coverage Matrix
4
+
5
+ This file is a maintenance contract for Dflow, not the runtime brain. `SKILL.md` should point to this matrix for review and maintenance work instead of duplicating the full table.
6
+
7
+ The matrix lists Brownfield / Greenfield logical template parity so reviewers can check which templates should remain aligned and which differences are intentional.
8
+
9
+ ## Matrix
10
+
11
+ | Logical document | Generated / maintained path | Brownfield template | Greenfield template | Parity requirement | Allowed differences | Section anchors |
12
+ |---|---|---|---|---|---|---|
13
+ | Feature dashboard | `dflow/specs/features/{active\|completed}/{SPEC-ID}-{slug}/_index.md` | `templates/_index.md` | `templates/_index.md` | Required sections same | Greenfield may mention Aggregate / Domain Events | `current-br-snapshot`, `lightweight-changes` |
14
+ | Phase spec | `dflow/specs/features/active/{SPEC-ID}-{slug}/phase-spec-YYYY-MM-DD-{slug}.md` | `templates/phase-spec.md` | `templates/phase-spec.md` | Lifecycle sections same | Greenfield has layer-by-layer plan + Domain Events | `implementation-tasks`, `behavior-scenarios`, `open-questions` |
15
+ | Lightweight spec | `dflow/specs/features/active/{SPEC-ID}-{slug}/lightweight-YYYY-MM-DD-{slug}.md` or `BUG-{NUMBER}-{slug}.md` | `templates/lightweight-spec.md` | `templates/lightweight-spec.md` | T2 structure and task checklist intent same | Layer tags differ | `implementation-tasks` |
16
+ | Glossary | `dflow/specs/domain/glossary.md` | `templates/glossary.md` | `templates/glossary.md` | Same columns | none | - |
17
+ | Bounded Context definition | `dflow/specs/domain/{context}/context-definition.md` | `templates/context-definition.md` | `templates/context-definition.md` | Same purpose / structural sections | Greenfield may reference Aggregate / Domain Service / Repository Interface | - |
18
+ | Rules index | `dflow/specs/domain/{context}/rules.md` | `templates/rules.md` | `templates/rules.md` | BR-ID / anchor / status format same | Greenfield may include Aggregate column | `business-rules` |
19
+ | Models catalog | `dflow/specs/domain/{context}/models.md` | `templates/models.md` | `templates/models.md` | Same purpose | Greenfield has Aggregate / Specification depth | - |
20
+ | Aggregate worksheet | `dflow/specs/domain/{context}/aggregates/{name}.md` (per Aggregate, on demand) | n/a | `templates/aggregate-design.md` | Greenfield only | Brownfield does not use the Aggregate worksheet | - |
21
+ | Behavior snapshot | `dflow/specs/domain/{context}/behavior.md` | `templates/behavior.md` | `templates/behavior.md` | BR anchor and drift-verification structure same | Greenfield may reference Domain Events | `behavior-scenarios` |
22
+ | Events catalog | `dflow/specs/domain/{context}/events.md` | n/a | `templates/events.md` | Greenfield only | Brownfield does not require event catalog | - |
23
+ | Context map | `dflow/specs/domain/context-map.md` | `templates/context-map.md` optional | `templates/context-map.md` mandatory | Similar concept | Brownfield optional / emergent | - |
24
+ | Tech debt | Brownfield: `dflow/specs/migration/tech-debt.md`; Greenfield: `dflow/specs/architecture/tech-debt.md` | `templates/tech-debt.md` | `templates/tech-debt.md` | Same backlog intent | Brownfield migration focus; Greenfield architecture focus | - |
25
+ | ADR guide | `dflow/specs/architecture/decisions/README.md` | n/a | `scaffolding/architecture-decisions-README.md` | Greenfield only | Brownfield not applicable | - |
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
+ | AI tool shims | `AGENTS.md`, `CLAUDE.md`, `GEMINI.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
+
30
+ ## Reference Flow Parity
31
+
32
+ Common reference flows under `sdd-ddd-brownfield-skill/references/` and
33
+ `sdd-ddd-greenfield-skill/references/` must stay synchronized unless a
34
+ track-specific difference is explicit. This includes
35
+ `dflow-feedback-flow.md`; it is a governance/support flow and should not grow
36
+ GitHub CLI submission behavior without a separate proposal.
37
+
38
+ ## Section Anchors
39
+
40
+ The `Section anchors` column is the single maintenance location for template section anchor coverage. Do not create a separate `SECTION-ANCHORS.md`.
41
+
42
+ When adding a new anchor:
43
+
44
+ 1. Add the anchor definition to `archive/proposals/PROPOSAL-013-system-document-template-coverage.md` §1 "Important Dflow-updated sections" (historical reference) or its successor governance document.
45
+ 2. Add the anchor id to the matching row in this matrix.
46
+ 3. Follow the anchor naming / namespacing / versioning rules defined in `archive/proposals/PROPOSAL-013-system-document-template-coverage.md` §1.