dflow-sdd-ddd 0.7.0 → 0.8.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 (51) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/docs/evaluating-dflow.en.md +14 -5
  3. package/docs/evaluating-dflow.md +14 -5
  4. package/docs/using-with-claude-code.en.md +17 -9
  5. package/docs/using-with-claude-code.md +15 -8
  6. package/lib/init.js +263 -52
  7. package/package.json +1 -1
  8. package/templates/brownfield/references/dflow-feedback-flow.md +179 -0
  9. package/templates/brownfield/references/drift-verification.md +183 -0
  10. package/templates/brownfield/references/finish-feature-flow.md +259 -0
  11. package/templates/brownfield/references/git-integration.md +312 -0
  12. package/templates/brownfield/references/init-project-flow.md +413 -0
  13. package/templates/brownfield/references/modify-existing-flow.md +444 -0
  14. package/templates/brownfield/references/new-feature-flow.md +367 -0
  15. package/templates/brownfield/references/new-phase-flow.md +259 -0
  16. package/templates/brownfield/references/pr-review-checklist.md +179 -0
  17. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +31 -4
  18. package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +12 -8
  19. package/templates/brownfield/scaffolding/Git-principles-gitflow.md +1 -1
  20. package/templates/brownfield/scaffolding/Git-principles-trunk.md +1 -1
  21. package/templates/brownfield/scaffolding/_conventions.md +1 -1
  22. package/templates/brownfield/scaffolding/_overview.md +3 -3
  23. package/templates/brownfield/templates/context-map.md +1 -1
  24. package/templates/brownfield/templates/glossary.md +1 -1
  25. package/templates/brownfield/templates/models.md +1 -1
  26. package/templates/brownfield/templates/rules.md +1 -1
  27. package/templates/brownfield/templates/tech-debt.md +1 -1
  28. package/templates/common/skill/SKILL.md +35 -0
  29. package/templates/greenfield/references/ddd-modeling-guide.md +351 -0
  30. package/templates/greenfield/references/dflow-feedback-flow.md +179 -0
  31. package/templates/greenfield/references/drift-verification.md +195 -0
  32. package/templates/greenfield/references/finish-feature-flow.md +280 -0
  33. package/templates/greenfield/references/git-integration.md +285 -0
  34. package/templates/greenfield/references/init-project-flow.md +447 -0
  35. package/templates/greenfield/references/modify-existing-flow.md +362 -0
  36. package/templates/greenfield/references/new-feature-flow.md +397 -0
  37. package/templates/greenfield/references/new-phase-flow.md +273 -0
  38. package/templates/greenfield/references/pr-review-checklist.md +130 -0
  39. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +31 -4
  40. package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +15 -13
  41. package/templates/greenfield/scaffolding/Git-principles-gitflow.md +1 -1
  42. package/templates/greenfield/scaffolding/Git-principles-trunk.md +1 -1
  43. package/templates/greenfield/scaffolding/_conventions.md +1 -1
  44. package/templates/greenfield/scaffolding/_overview.md +5 -3
  45. package/templates/greenfield/scaffolding/architecture-decisions-README.md +1 -1
  46. package/templates/greenfield/templates/context-map.md +1 -1
  47. package/templates/greenfield/templates/events.md +1 -1
  48. package/templates/greenfield/templates/glossary.md +1 -1
  49. package/templates/greenfield/templates/models.md +1 -1
  50. package/templates/greenfield/templates/rules.md +1 -1
  51. package/templates/greenfield/templates/tech-debt.md +1 -1
@@ -0,0 +1,130 @@
1
+ # PR Review Checklist — Greenfield Clean Architecture
2
+
3
+ `/dflow:pr-review` enters this checklist starting from **Step 0**. Do not skip Step 0 — reviewing code without first understanding spec intent breaks the SDD feedback loop (all the upstream spec work loses its verification mechanism).
4
+
5
+ ## Step 0: Understand the Change Intent (before code review)
6
+
7
+ Ground yourself in the spec *before* looking at the diff. A feature
8
+ directory may contain multiple spec files; identify which ones this PR
9
+ touches and read them all.
10
+
11
+ - [ ] Locate the feature directory at
12
+ `dflow/specs/features/active/{SPEC-ID}-{slug}/` (or
13
+ `dflow/specs/features/completed/{SPEC-ID}-{slug}/` if the PR is the
14
+ closeout commit and the dir was already `git mv`d)
15
+ - [ ] Read `_index.md` first — it gives you the feature-level overview,
16
+ Current BR Snapshot, list of phase-specs, and Resume Pointer (where the
17
+ author left off)
18
+ - [ ] Identify which **phase-spec(s)** and / or **lightweight-spec(s)**
19
+ this PR diff touches. There may be:
20
+ - A new phase-spec being introduced (T1) — read in full,
21
+ including Aggregate state transitions and Domain Events
22
+ - An existing phase-spec being marked `completed` — verify its
23
+ Delta-from-prior-phases section reads correctly relative to the
24
+ prior phase
25
+ - A new lightweight-spec (T2) — read in full
26
+ - Just T3 inline rows added to `_index.md` Lightweight Changes (no
27
+ spec file changed) — confirm the row description is precise
28
+ - [ ] If a `Behavior Delta` / Delta-from-prior-phases section exists,
29
+ read **ADDED / MODIFIED / REMOVED / RENAMED** — pay attention to
30
+ any Aggregate state transitions and Domain Events listed in the
31
+ Delta; note any **UNCHANGED** scope declaration
32
+ - [ ] State in one sentence: "This PR intends to {change} because
33
+ {reason}." (If you can't, pause and ask the author.)
34
+ - [ ] Cross-reference `dflow/specs/domain/{context}/behavior.md` if it exists
35
+ — confirm the Delta has been reflected or is scheduled to be
36
+ (draft vs finalized; finalisation usually happens at
37
+ `/dflow:finish-feature` time)
38
+ - [ ] Only then proceed to the code-review sections below
39
+
40
+ If the PR has no spec or no `_index.md`:
41
+ ```
42
+ "I don't see a feature directory or _index.md for this PR. Before I
43
+ review the code, can you point me to it, or run /dflow:new-feature
44
+ (or /dflow:bug-fix for a small fix) to create the feature directory
45
+ and at least a lightweight spec? SDD relies on the spec being the
46
+ review anchor."
47
+ ```
48
+
49
+ ## Spec Compliance
50
+
51
+ Per-feature checks:
52
+ - [ ] **Feature directory exists** with `_index.md` + at least one
53
+ phase-spec (or one lightweight-spec for a T2-only feature)
54
+ - [ ] **`_index.md` Current BR Snapshot is up to date** — reflects
55
+ the cumulative effect of all phase-specs / lightweight-specs in
56
+ the directory
57
+ - [ ] **`_index.md` Phase Specs table** — every row's referenced
58
+ phase-spec file exists and its `status` matches the row's claim
59
+ - [ ] **For follow-up features**: `_index.md` Metadata has `follow-up-of:
60
+ {原 SPEC-ID}` AND the original feature's `_index.md`
61
+ Follow-up Tracking row references this feature
62
+
63
+ Per-phase-spec / lightweight-spec checks (run for **each** spec file the
64
+ PR touches, not just one):
65
+ - [ ] Spec matches code
66
+ - [ ] Implementation matches Given/When/Then scenarios (including
67
+ Aggregate state transitions and Domain Events)
68
+ - [ ] All business rules (BR-*) in this spec implemented
69
+ - [ ] Edge cases (EC-*) in this spec handled
70
+ - [ ] **Delta integrity** (phase 2+ only) — the Delta-from-prior-phases
71
+ section's ADDED / MODIFIED / REMOVED / RENAMED entries actually
72
+ match the diff against the prior phase-spec's BR set
73
+
74
+ If the closeout commit is in this PR (`/dflow:finish-feature` was run):
75
+ - [ ] **BC layer sync landed** — `dflow/specs/domain/{context}/rules.md` /
76
+ `behavior.md` / `events.md` / `context-map.md` reflect the
77
+ feature's net effect (compare against `_index.md` Current BR
78
+ Snapshot)
79
+ - [ ] **Whole feature directory `git mv`'d** to `completed/` — git
80
+ shows `renamed:` (not `deleted:` + `new file:`)
81
+ - [ ] **Integration Summary** was emitted to the conversation (not
82
+ written to a file — it's ephemeral)
83
+
84
+ ## Domain Layer Quality
85
+
86
+ - [ ] **Zero external dependencies** — check the Domain package/module manifest; no external dependencies beyond the language/runtime baseline
87
+ - [ ] **No ORM attributes** — no [Table], [Column], [Key] on domain classes
88
+ - [ ] **No serialization attributes** — no [JsonProperty], [JsonIgnore]
89
+ - [ ] **Private setters** — state changes through methods only
90
+ - [ ] **Invariants enforced** — constructor and methods reject invalid state
91
+ - [ ] **Value Objects immutable** — using `record` or readonly properties
92
+ - [ ] **Domain Events raised** — significant state changes produce events
93
+ - [ ] **Other Aggregates referenced by ID** — not by direct object reference
94
+
95
+ ## Application Layer Quality
96
+
97
+ - [ ] **No business logic** — handlers only orchestrate, not decide
98
+ - [ ] **CQRS respected** — Commands for writes, Queries for reads
99
+ - [ ] **Validation in Validator** — not in handler or controller
100
+ - [ ] **No Domain objects in DTOs** — proper mapping between layers
101
+ - [ ] **Event handlers are idempotent** — safe to replay
102
+
103
+ ## Infrastructure Layer Quality
104
+
105
+ - [ ] **EF config in Fluent API** — not attributes on Domain entities
106
+ - [ ] **Repository only for Aggregate Roots** — not for child entities
107
+ - [ ] **No business logic in SQL/LINQ** — complex filtering via Specifications
108
+ - [ ] **External service behind interface** — mockable for tests
109
+
110
+ ## Presentation Layer Quality
111
+
112
+ - [ ] **Thin controllers** — parse, dispatch, respond
113
+ - [ ] **No domain objects exposed** — only DTOs/ViewModels in API
114
+ - [ ] **Proper status codes** — 201 Created, 404 Not Found, 422 Unprocessable
115
+ - [ ] **No business logic** — not even validation beyond format checking
116
+
117
+ ## Cross-Cutting
118
+
119
+ - [ ] **Glossary consistency** — new terms documented?
120
+ - [ ] **Context boundaries respected** — no reaching into another context's internals
121
+ - [ ] **Domain Events documented** — events.md updated?
122
+ - [ ] **Tests cover invariants** — not just happy path
123
+
124
+ ## Architecture Score
125
+
126
+ - **A**: Clean layer separation, Domain-first design, full spec, comprehensive tests
127
+ - **B**: Mostly clean, minor layer bleed, spec exists, good test coverage
128
+ - **C**: Some business logic in wrong layer, spec exists
129
+ - **D**: Working code but architecture concerns, needs refactoring
130
+ - **F**: Business logic in controller/infrastructure, no spec — push back
@@ -121,12 +121,39 @@ Recommend `docs/migrating-to-dflow-v1.md` for the manual migration
121
121
  checklist. Migration affects every spec the team has written; manual
122
122
  review is required.
123
123
 
124
+ ## Workflow Steps
125
+
126
+ This guide is the **command registry, routing rules, and project context**.
127
+ Executable workflow steps (Step 1→N, step gates, completion checklists) are
128
+ **not** defined here. They live in the vendored workflow bundle projected into
129
+ this project at:
130
+
131
+ - `dflow/specs/shared/dflow-workflows/`
132
+
133
+ When executing a `/dflow:*` command, read the matching flow file from that
134
+ directory first. For example:
135
+
136
+ | Command | Flow file |
137
+ |---|---|
138
+ | `/dflow:new-feature` | `dflow/specs/shared/dflow-workflows/references/new-feature-flow.md` |
139
+ | `/dflow:modify-existing` | `dflow/specs/shared/dflow-workflows/references/modify-existing-flow.md` |
140
+ | `/dflow:bug-fix` | `dflow/specs/shared/dflow-workflows/references/modify-existing-flow.md` (lightweight-ceremony branch) |
141
+ | `/dflow:new-phase` | `dflow/specs/shared/dflow-workflows/references/new-phase-flow.md` |
142
+ | `/dflow:finish-feature` | `dflow/specs/shared/dflow-workflows/references/finish-feature-flow.md` |
143
+ | `/dflow:verify` | `dflow/specs/shared/dflow-workflows/references/drift-verification.md` |
144
+ | `/dflow:pr-review` | `dflow/specs/shared/dflow-workflows/references/pr-review-checklist.md` |
145
+ | `/dflow:report-dflow-feedback` | `dflow/specs/shared/dflow-workflows/references/dflow-feedback-flow.md` |
146
+
147
+ Supporting files (templates, domain modeling guide, drift checklist) are also
148
+ in `dflow/specs/shared/dflow-workflows/` under the same relative paths used
149
+ by the flow files.
150
+
124
151
  ## Tool-Specific Notes
125
152
 
126
- This file is the canonical Dflow guide. Root-level files such as
127
- `AGENTS.md`, `CLAUDE.md`, and `.github/copilot-instructions.md`
153
+ This file is the canonical Dflow guide (registry + rules + router). Root-level
154
+ files such as `AGENTS.md`, `CLAUDE.md`, and `.github/copilot-instructions.md`
128
155
  should stay thin and point back here.
129
156
 
130
157
  If a tool does not support Dflow slash commands, treat the command names as
131
- plain workflow names. This guide contains the installed runtime behavior
132
- contract; execute the workflow semantics defined here directly.
158
+ plain workflow names and follow the matching flow file from the workflow bundle
159
+ at `dflow/specs/shared/dflow-workflows/`.
@@ -1,14 +1,16 @@
1
- <!-- Scaffolding template maintained alongside Dflow skill. See archive/proposals/PROPOSAL-010 for origin. -->
1
+ <!-- Seeded by Dflow. -->
2
2
 
3
3
  # CLAUDE.md Snippet — Dflow Adoption (Greenfield track)
4
4
 
5
5
  > Source: `scaffolding/CLAUDE-md-snippet.md`
6
6
  > Purpose: a minimal block you paste into (or replace with) your
7
7
  > project's root `CLAUDE.md` when adopting Dflow.
8
- > For the Greenfield track, the full reference template lives at
9
- > `sdd-ddd-greenfield-skill/templates/CLAUDE.md` — if you want the complete
10
- > legacy Claude-specific version, use that instead. New CLI init output uses
11
- > `AI-AGENT-GUIDE.md` plus a generated `CLAUDE.md` shim.
8
+ > For the Greenfield track, the full reference template lives in the
9
+ > in-project bundle at
10
+ > `dflow/specs/shared/dflow-workflows/templates/CLAUDE.md` (projected by
11
+ > `dflow init`) — if you want the complete legacy Claude-specific version,
12
+ > use that instead. New CLI init output uses `AI-AGENT-GUIDE.md` plus a
13
+ > generated `CLAUDE.md` shim.
12
14
 
13
15
  ---
14
16
 
@@ -91,14 +93,14 @@ dflow/specs/
91
93
 
92
94
  > SDD 流程、Git 整合、Domain 層規範、AI 協作
93
95
 
94
- ### Dflow Skill — Canonical Decision Logic Lives in the Skill
96
+ ### Dflow Skill — Canonical Decision Logic Lives in the Project
95
97
 
96
98
  AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
97
99
  (T1 Heavy / T2 Light / T3 Trivial)、所有 slash command 的 step-by-step
98
- 流程 **不在此重述**,請以 Dflow skill 本體為準:
100
+ 流程 **不在此重述**,請以本專案內的 Dflow 工件為準(init 時投影):
99
101
 
100
- - `sdd-ddd-greenfield-skill/SKILL.md`(決策樹 + Slash Commands 總表)
101
- - `sdd-ddd-greenfield-skill/references/` 內各 flow 文件
102
+ - `dflow/specs/shared/AI-AGENT-GUIDE.md`(決策樹 + Slash Commands 總表 + 路由規則)
103
+ - `dflow/specs/shared/dflow-workflows/references/` 內各 flow 文件(執行步驟定義)
102
104
 
103
105
  本專案採用的 Dflow entry points:
104
106
  - Dflow CLI init command (`dflow init`, or `npx dflow-sdd-ddd init` when using the no-install path) — 專案初始化(一次性,已執行過)
@@ -159,10 +161,10 @@ AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
159
161
 
160
162
  ## Notes
161
163
 
162
- - This snippet is intentionally lighter than
163
- `sdd-ddd-greenfield-skill/templates/CLAUDE.md`. If you want the full version
164
- (with detailed flow descriptions per slash command), use that
165
- template instead
164
+ - This snippet is intentionally lighter than the in-project bundle
165
+ template at `dflow/specs/shared/dflow-workflows/templates/CLAUDE.md`. If
166
+ you want the full version (with detailed flow descriptions per slash
167
+ command), use that template instead
166
168
  - The snippet does NOT re-copy the Dflow decision tree, Ceremony
167
169
  Scaling criteria, or per-flow step details — those live in the
168
170
  skill and change when the skill evolves
@@ -1,4 +1,4 @@
1
- <!-- Scaffolding template maintained alongside Dflow skill. See archive/proposals/PROPOSAL-010 for origin. -->
1
+ <!-- Seeded by Dflow. -->
2
2
 
3
3
  # Git Principles — Git Flow edition
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Scaffolding template maintained alongside Dflow skill. See archive/proposals/PROPOSAL-010 for origin. -->
1
+ <!-- Seeded by Dflow. -->
2
2
 
3
3
  # Git Principles — Trunk-based / GitHub Flow edition
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Scaffolding template maintained alongside Dflow skill. See archive/proposals/PROPOSAL-010 for origin. -->
1
+ <!-- Seeded by Dflow. -->
2
2
 
3
3
  # Spec Writing Conventions — {System Name}
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Scaffolding template maintained alongside Dflow skill. See archive/proposals/PROPOSAL-010 for origin. -->
1
+ <!-- Seeded by Dflow. -->
2
2
 
3
3
  # System Overview — {System Name}
4
4
 
@@ -179,5 +179,7 @@ Initial ADRs that typically exist:
179
179
  - [Glossary](../domain/glossary.md)
180
180
  - [Tech debt backlog](../architecture/tech-debt.md)
181
181
  - [Architecture decisions](../architecture/decisions/)
182
- - Dflow skill: see `CLAUDE.md` and the `sdd-ddd-greenfield-skill/` bundle
183
- for the full AI workflow guidance.
182
+ - Dflow workflow guidance: see `CLAUDE.md` (project-level AI rules) and the
183
+ in-project vendored bundle at `dflow/specs/shared/AI-AGENT-GUIDE.md` +
184
+ `dflow/specs/shared/dflow-workflows/references/` for the full AI workflow
185
+ decision tree, slash commands, and step-by-step flow definitions.
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Seeded by Dflow. -->
2
2
 
3
3
  # Architecture Decisions
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Seeded by Dflow. -->
2
2
 
3
3
  # Context Map
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Seeded by Dflow. -->
2
2
 
3
3
  # Domain Events
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Seeded by Dflow. -->
2
2
 
3
3
  # Glossary
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Seeded by Dflow. -->
2
2
 
3
3
  # Domain Models
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Seeded by Dflow. -->
2
2
 
3
3
  # Business Rules
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Seeded by Dflow. -->
2
2
 
3
3
  # Architecture Tech Debt
4
4