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
|
@@ -28,7 +28,7 @@ are not available in the current AI tool:
|
|
|
28
28
|
| `/dflow:bug-fix` | A defect can be described with expected vs actual behavior. |
|
|
29
29
|
| `/dflow:new-phase` | An active feature needs another implementation slice. |
|
|
30
30
|
| `/dflow:finish-feature` | Implementation is complete and needs drift closure. |
|
|
31
|
-
| `/dflow:verify` |
|
|
31
|
+
| `/dflow:verify` | A bounded context's domain docs (`rules.md` ↔ `behavior.md`) need a consistency / drift check. |
|
|
32
32
|
| `/dflow:pr-review` | A change is ready for SDD/DDD review. |
|
|
33
33
|
| `/dflow:report-dflow-feedback` | You found a Dflow issue or improvement and want a sanitized upstream feedback draft. |
|
|
34
34
|
| `/dflow:status` | You need the current workflow state, current step, completed work, in-progress work, remaining work, pending decision, and next valid action. |
|
|
@@ -45,7 +45,7 @@ Machine-readable source for rendering tool-specific thin wrappers:
|
|
|
45
45
|
| bug-fix | /dflow:bug-fix | Investigate a defect described by expected vs actual behavior. | expected vs actual | workflow |
|
|
46
46
|
| new-phase | /dflow:new-phase | Add another implementation slice to an active feature. | feature id or phase goal | workflow |
|
|
47
47
|
| finish-feature | /dflow:finish-feature | Close implementation with drift checks and archived feature state. | feature id | workflow |
|
|
48
|
-
| verify | /dflow:verify | Check
|
|
48
|
+
| verify | /dflow:verify | Check a bounded context's domain docs (`rules.md` ↔ `behavior.md`) for consistency. | bounded context or all | workflow |
|
|
49
49
|
| pr-review | /dflow:pr-review | Review a ready change for SDD/DDD alignment. | change or branch | workflow |
|
|
50
50
|
| report-dflow-feedback | /dflow:report-dflow-feedback | Draft sanitized upstream feedback about Dflow. | issue or improvement | workflow |
|
|
51
51
|
| status | /dflow:status | Report current workflow state and next valid action. | - | control |
|
|
@@ -53,6 +53,25 @@ Machine-readable source for rendering tool-specific thin wrappers:
|
|
|
53
53
|
| cancel | /dflow:cancel | Abort the active workflow and return to free conversation. | - | control |
|
|
54
54
|
<!-- dflow-command-registry:end -->
|
|
55
55
|
|
|
56
|
+
## Routing Non-Command Input
|
|
57
|
+
|
|
58
|
+
Not every developer message maps to a `/dflow:*` workflow. Route non-command
|
|
59
|
+
input like this (supporting files live in the workflow bundle at
|
|
60
|
+
`dflow/specs/shared/dflow-workflows/`):
|
|
61
|
+
|
|
62
|
+
- **"I'm designing a domain model" / "How should I model X?"** → read
|
|
63
|
+
`references/ddd-modeling-guide.md`.
|
|
64
|
+
- **"Quick question about..." / "How does X work?"** → check
|
|
65
|
+
`dflow/specs/domain/` first and answer from the documented domain knowledge.
|
|
66
|
+
- **"I'm creating a branch"** → read `references/git-integration.md`.
|
|
67
|
+
- **"Dflow seems wrong" / "this template is confusing"** (or you notice Dflow
|
|
68
|
+
guidance drift) → suggest `/dflow:report-dflow-feedback`; never submit
|
|
69
|
+
anything upstream automatically.
|
|
70
|
+
- **Anything else code-related** → assess whether it touches business logic. If
|
|
71
|
+
it does, use the auto-trigger safety net (suggest the matching `/dflow:*`
|
|
72
|
+
command and wait for confirmation — see § Workflow Transparency); if not, help
|
|
73
|
+
directly with no ceremony.
|
|
74
|
+
|
|
56
75
|
## Status / Control Commands
|
|
57
76
|
|
|
58
77
|
`/dflow:status` reports active workflow state. Include these fields: workflow,
|
|
@@ -71,6 +90,67 @@ workflow was cancelled.
|
|
|
71
90
|
When no workflow is active, `/dflow:next` and `/dflow:cancel` must report that
|
|
72
91
|
there is no active workflow to advance or cancel.
|
|
73
92
|
|
|
93
|
+
## Workflow Transparency
|
|
94
|
+
|
|
95
|
+
Dflow uses a hybrid interaction design: `/dflow:*` commands are the primary
|
|
96
|
+
entry, natural-language auto-trigger is a safety net, and tiered transparency
|
|
97
|
+
keeps the developer aware of where they are in a workflow.
|
|
98
|
+
|
|
99
|
+
### Auto-Trigger Safety Net
|
|
100
|
+
|
|
101
|
+
When natural language implies a development task, detect the intent — but do
|
|
102
|
+
**not** auto-enter a workflow. Instead:
|
|
103
|
+
|
|
104
|
+
1. State your judgment clearly:
|
|
105
|
+
> "I think this is a new-feature task."
|
|
106
|
+
2. Offer the developer three options:
|
|
107
|
+
- Type `/dflow:new-feature` to start explicitly
|
|
108
|
+
- Reply "OK" / "繼續" to confirm this workflow
|
|
109
|
+
- Or correct the workflow (e.g., "no, this is a bug fix")
|
|
110
|
+
3. Wait for confirmation before entering any workflow.
|
|
111
|
+
|
|
112
|
+
This addresses three failure modes of pure auto-trigger: missed triggers, wrong
|
|
113
|
+
workflow selection, and invisible state.
|
|
114
|
+
|
|
115
|
+
### Three-Tier Transparency
|
|
116
|
+
|
|
117
|
+
During an active workflow, communicate at three levels — no more, no less:
|
|
118
|
+
|
|
119
|
+
| Level | Trigger point | AI behavior |
|
|
120
|
+
|---|---|---|
|
|
121
|
+
| **Flow entry (must confirm)** | After judging the workflow from NL | Stop and wait for confirmation (command, "OK", or implicit) |
|
|
122
|
+
| **Step gate (notify + optional confirm)** | Before major milestones | Announce the transition; if the developer provides next-step input, treat it as implicit confirmation |
|
|
123
|
+
| **Step-internal (notify only)** | Step N → Step N+1 | Announce "Step N complete, entering Step N+1" — do not wait |
|
|
124
|
+
|
|
125
|
+
The specific step-gate positions for each workflow live in that flow's own file
|
|
126
|
+
(`dflow/specs/shared/dflow-workflows/references/<flow>.md`), which is the source
|
|
127
|
+
of truth for its gate sequence.
|
|
128
|
+
|
|
129
|
+
### Confirmation Signals (NL ↔ Command Equivalence)
|
|
130
|
+
|
|
131
|
+
Any of these count as "proceed to next step" — accept whichever the developer
|
|
132
|
+
uses:
|
|
133
|
+
|
|
134
|
+
- **Command**: `/dflow:next`
|
|
135
|
+
- **Verbal (English)**: OK / yes / continue / go ahead / sounds good / proceed
|
|
136
|
+
- **Verbal (Chinese)**: 好 / 對 / 繼續 / 可以 / 沒問題
|
|
137
|
+
- **Implicit**: the developer provides the information needed for the next step
|
|
138
|
+
(e.g., the AI asks "Which Aggregate?" and the developer answers with the
|
|
139
|
+
Aggregate name → implicit confirmation)
|
|
140
|
+
|
|
141
|
+
The implicit-confirmation rule matters — do not turn every transition into a
|
|
142
|
+
ceremony where the developer must say "OK" before every sentence.
|
|
143
|
+
|
|
144
|
+
### Completion Checklist Skip Guard
|
|
145
|
+
|
|
146
|
+
Completion checklists and their step ordering live in the flow files and run at
|
|
147
|
+
the gate each flow specifies (the feature-level completion gate in
|
|
148
|
+
`new-feature-flow` / `modify-existing-flow`, the phase-level gate in
|
|
149
|
+
`new-phase-flow`). Do not run a checklist opportunistically. But if the
|
|
150
|
+
developer skips the gate and commits directly, use the auto-trigger safety net
|
|
151
|
+
to prompt — "It looks like you're wrapping up — should I run the Step N
|
|
152
|
+
completion checklist?" — before giving commit guidance.
|
|
153
|
+
|
|
74
154
|
## Source of Truth
|
|
75
155
|
|
|
76
156
|
Dflow-owned project documents live under `dflow/specs/`.
|
|
@@ -85,6 +165,41 @@ Dflow-owned project documents live under `dflow/specs/`.
|
|
|
85
165
|
| Completed feature snapshots | `dflow/specs/features/completed/` |
|
|
86
166
|
| Technical debt | `dflow/specs/architecture/tech-debt.md` or `dflow/specs/migration/tech-debt.md` |
|
|
87
167
|
|
|
168
|
+
### Project Structure
|
|
169
|
+
|
|
170
|
+
The full `dflow/specs/` layout Dflow seeds and maintains:
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
dflow/specs/
|
|
174
|
+
├── shared/ # Project-level governance docs (seeded by npx dflow-sdd-ddd init)
|
|
175
|
+
│ ├── _overview.md
|
|
176
|
+
│ └── _conventions.md
|
|
177
|
+
├── domain/
|
|
178
|
+
│ ├── glossary.md
|
|
179
|
+
│ ├── context-map.md # Bounded Context relationships
|
|
180
|
+
│ └── {bounded-context}/
|
|
181
|
+
│ ├── context.md
|
|
182
|
+
│ ├── models.md # Aggregates, Entities, VOs
|
|
183
|
+
│ ├── rules.md # Business rules index (BR-ID + one-line)
|
|
184
|
+
│ ├── behavior.md # Consolidated behavior (Given/When/Then)
|
|
185
|
+
│ └── events.md # Domain Events catalog
|
|
186
|
+
├── features/
|
|
187
|
+
│ ├── active/
|
|
188
|
+
│ │ └── {SPEC-ID}-{slug}/ # One feature = one directory
|
|
189
|
+
│ │ ├── _index.md # Feature dashboard + BR Snapshot + Resume Pointer
|
|
190
|
+
│ │ ├── phase-spec-YYYY-MM-DD-{slug}.md # T1: 0..N phase specs
|
|
191
|
+
│ │ └── lightweight-YYYY-MM-DD-{slug}.md # T2: 0..N lightweight specs
|
|
192
|
+
│ │ # (or BUG-{NUMBER}-{slug}.md)
|
|
193
|
+
│ ├── completed/ # Done (whole feature directory archived here)
|
|
194
|
+
│ └── backlog/
|
|
195
|
+
│ #
|
|
196
|
+
│ # SPEC-ID format: SPEC-YYYYMMDD-NNN; slug follows discussion language (中文 / 英文 both OK).
|
|
197
|
+
│ # T3 trivial changes have NO independent file — just a row in _index.md Lightweight Changes.
|
|
198
|
+
└── architecture/
|
|
199
|
+
├── decisions/ # Architecture Decision Records
|
|
200
|
+
└── tech-debt.md
|
|
201
|
+
```
|
|
202
|
+
|
|
88
203
|
## Core Rules
|
|
89
204
|
|
|
90
205
|
1. Spec before code: meaningful behavior changes need a spec or lightweight bug spec before implementation.
|
|
@@ -93,33 +208,110 @@ Dflow-owned project documents live under `dflow/specs/`.
|
|
|
93
208
|
4. Check drift before calling work complete.
|
|
94
209
|
5. Follow `dflow/specs/shared/_conventions.md`, especially `## Prose Language`.
|
|
95
210
|
|
|
96
|
-
##
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
211
|
+
## Ceremony Scaling
|
|
212
|
+
|
|
213
|
+
Dflow uses three tiers — **T1 Heavy / T2 Light / T3 Trivial** — chosen by the AI
|
|
214
|
+
per change. `/dflow:new-feature` and `/dflow:new-phase` always default to T1 (no
|
|
215
|
+
judgement needed). The criteria below apply when `/dflow:modify-existing` or
|
|
216
|
+
`/dflow:bug-fix` decides which tier fits a modification.
|
|
217
|
+
|
|
218
|
+
| Tier | Scenario | Output | Command / Trigger |
|
|
219
|
+
|---|---|---|---|
|
|
220
|
+
| **T1 Heavy** | New feature, new phase, new Aggregate / BC, architectural change, new BR | Independent `phase-spec-YYYY-MM-DD-{slug}.md` placed in the feature directory + `_index.md` Phase Specs row + refresh BR Snapshot. For a new Aggregate / BC also create an `aggregate-design.md` from `templates/aggregate-design.md` **in the feature directory** (working worksheet; the durable summary stays in `models.md`) + update `context-map.md` + `events.md`. | `/dflow:new-feature` / `/dflow:new-phase` |
|
|
221
|
+
| **T2 Light** | Bug fix (logic error), UI input validation tweak, flow branch change — has BR Delta | Independent `lightweight-{YYYY-MM-DD}-{slug}.md` (or `BUG-{NUMBER}-{slug}.md`) inside the feature directory + `_index.md` Lightweight Changes row (outbound link) + refresh BR Snapshot. Confirm the fix lands in the correct architectural layer. | `/dflow:bug-fix` or `/dflow:modify-existing` (lightweight branch) |
|
|
222
|
+
| **T3 Trivial** | Button colour, copy/text fix, typo, formatting, pure comments — **no BR change, no Domain concept change, no data structure change** | **Inline row in `_index.md` Lightweight Changes only** (no independent spec file) | `/dflow:modify-existing` (`_index-only` branch) |
|
|
223
|
+
|
|
224
|
+
**T3 criteria** (the AI must satisfy **all four** before classifying T3):
|
|
225
|
+
|
|
226
|
+
1. No BR-ID change (no ADDED / MODIFIED / REMOVED / RENAMED business rule)
|
|
227
|
+
2. No Domain concept added or changed (Aggregate / Entity / VO / Event)
|
|
228
|
+
3. No data structure change (table, column, relation, index)
|
|
229
|
+
4. Only changes UI surface (colour, text, layout), pure comments, or pure formatting
|
|
230
|
+
|
|
231
|
+
If any criterion fails → drop to T2; if Domain / BR / data structure is touched → escalate to T1.
|
|
232
|
+
|
|
233
|
+
**Below T3 — Dflow doesn't track at all**: pure typo fixes, commit-message
|
|
234
|
+
typos, pure formatting commits (e.g. `prettier` / `dotnet format` auto-runs).
|
|
235
|
+
You can `git commit` directly without writing even a T3 inline row.
|
|
236
|
+
|
|
237
|
+
**DDD Modeling Depth (still informs T1 scope)**:
|
|
238
|
+
|
|
239
|
+
- New Aggregate / BC → **Full**: create an `aggregate-design.md` from `templates/aggregate-design.md` in the feature directory (durable summary stays in `models.md`), update `context-map.md`, define Domain Events in `events.md`
|
|
240
|
+
- Feature within an existing BC → **Standard**: confirm Aggregate ownership, update `models.md` and `rules.md`
|
|
241
|
+
- T2 / T3 → confirm the fix lands in the correct architectural layer; no design-level updates required
|
|
242
|
+
|
|
243
|
+
## Behavior Source of Truth (rules.md + behavior.md)
|
|
244
|
+
|
|
245
|
+
Each Bounded Context has two complementary files that together describe the
|
|
246
|
+
system's current behavior:
|
|
247
|
+
|
|
248
|
+
- **`rules.md`** — declarative index: lists each BR-ID with a one-line summary.
|
|
249
|
+
Quick lookup, easy to scan.
|
|
250
|
+
- **`behavior.md`** — scenario-level detail: the full Given/When/Then scenarios
|
|
251
|
+
for each BR-ID, including Aggregate state transitions and Domain Events. This
|
|
252
|
+
is the consolidated source of truth for "what does the system actually do
|
|
253
|
+
right now?"
|
|
254
|
+
|
|
255
|
+
`dflow/specs/features/completed/` is a historical archive (individual change
|
|
256
|
+
records). `behavior.md` is the **merged current state** — when a feature is
|
|
257
|
+
completed, the AI merges its scenarios into `behavior.md`; when behavior is
|
|
258
|
+
modified, the AI updates the corresponding section to reflect the new behavior
|
|
259
|
+
(git preserves history). See the `behavior.md` template in the workflow bundle
|
|
260
|
+
at `dflow/specs/shared/dflow-workflows/templates/behavior.md`.
|
|
261
|
+
|
|
262
|
+
## Guiding Questions by Activity
|
|
263
|
+
|
|
264
|
+
SDD has five conceptual activities (Understanding / Domain Modeling / Spec
|
|
265
|
+
Writing / Implementation Planning / Testing Strategy) that the AI walks the
|
|
266
|
+
developer through inside a workflow. They cut across workflow steps — Activity 2
|
|
267
|
+
(Domain Modeling) might span Step 2 and Step 3 of new-feature-flow, for example.
|
|
268
|
+
|
|
269
|
+
**Activity markers in the phase-spec template**: each section in
|
|
270
|
+
`templates/phase-spec.md` carries an HTML comment (e.g.,
|
|
271
|
+
`<!-- Fill timing: Activity 2: Domain Modeling -->`) indicating the activity in
|
|
272
|
+
which that section should be filled. These markers align with the activities
|
|
273
|
+
below and are used by `/dflow:status` and the completion checklist to track
|
|
274
|
+
progress. When guiding a developer, fill sections in activity order; do not jump
|
|
275
|
+
ahead to Activity 4 (Implementation Planning) before Activity 3 (Spec Writing)
|
|
276
|
+
is agreed. The `Implementation Tasks` section at the end of the template is
|
|
277
|
+
produced by the AI at the end of Activity 4 — see new-feature-flow.md Step 5 /
|
|
278
|
+
new-phase-flow.md Step 4 / modify-existing-flow.md Step 3.
|
|
279
|
+
|
|
280
|
+
Note: the phase-spec template HTML comments cover Activity 1–4; Activity 5
|
|
281
|
+
(Testing Strategy) is a conceptual category folded into the Test Strategy
|
|
282
|
+
section that the template marks with Activity 4 timing. In `new-phase-flow`,
|
|
283
|
+
Activity 5 is exercised operationally in Step 6 when implementation and tests
|
|
284
|
+
are verified against the phase-spec before Step 7 completion.
|
|
285
|
+
|
|
286
|
+
### Activity 1: Understanding (What & Why)
|
|
287
|
+
- What problem does this solve? Who asked for it?
|
|
288
|
+
- What's the expected behavior from the user's perspective?
|
|
289
|
+
- Are there existing specs or domain docs related to this?
|
|
290
|
+
|
|
291
|
+
### Activity 2: Domain Modeling (DDD)
|
|
292
|
+
- Which Bounded Context? (Check context-map.md)
|
|
293
|
+
- What Aggregate does this belong to? Or is it a new Aggregate?
|
|
294
|
+
- What are the invariants this Aggregate must protect?
|
|
295
|
+
- Are there Value Objects to extract? (Money, DateRange, Address...)
|
|
296
|
+
- Will this produce Domain Events? Who consumes them?
|
|
297
|
+
- Does this cross Aggregate / Context boundaries? → Need an integration strategy
|
|
298
|
+
|
|
299
|
+
### Activity 3: Spec Writing
|
|
300
|
+
- Write the spec using the template (see `templates/phase-spec.md`)
|
|
301
|
+
- Define Given/When/Then with Aggregate state transitions
|
|
302
|
+
- Document Domain Events produced and consumed
|
|
303
|
+
- Identify edge cases around Aggregate invariants
|
|
304
|
+
|
|
305
|
+
### Activity 4: Implementation Planning
|
|
306
|
+
- Domain layer: Aggregate design, Value Objects, Domain Events
|
|
307
|
+
- Application layer: Command / Query, handlers, validation
|
|
308
|
+
- Infrastructure: Repository implementation, persistence / ORM configuration
|
|
309
|
+
- Presentation: API endpoint design
|
|
310
|
+
|
|
311
|
+
### Activity 5: Testing Strategy
|
|
312
|
+
- Domain unit tests: invariants, business rules, value object equality
|
|
313
|
+
- Application tests: command / query handler behavior
|
|
314
|
+
- Integration tests: repository, external services
|
|
123
315
|
|
|
124
316
|
## Workflow Steps
|
|
125
317
|
|
|
@@ -5,12 +5,10 @@
|
|
|
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
|
-
>
|
|
9
|
-
>
|
|
10
|
-
>
|
|
11
|
-
>
|
|
12
|
-
> use that instead. New CLI init output uses `AI-AGENT-GUIDE.md` plus a
|
|
13
|
-
> generated `CLAUDE.md` shim.
|
|
8
|
+
> New CLI init output uses `dflow/specs/shared/AI-AGENT-GUIDE.md` as the
|
|
9
|
+
> canonical guide plus a thin generated `CLAUDE.md` shim. This snippet is
|
|
10
|
+
> only the older Claude-specific two-H2 layout, for when you intentionally
|
|
11
|
+
> want that shape in your project's root `CLAUDE.md`.
|
|
14
12
|
|
|
15
13
|
---
|
|
16
14
|
|
|
@@ -23,8 +21,7 @@
|
|
|
23
21
|
Claude-specific two-H2 layout in your project's root `CLAUDE.md`.
|
|
24
22
|
|
|
25
23
|
The two-H2 structure (`System Context` / `Development Workflow`) is intentional and must be
|
|
26
|
-
preserved — it
|
|
27
|
-
keeps every project's `CLAUDE.md` scannable for AI in the same shape.
|
|
24
|
+
preserved — it keeps every project's `CLAUDE.md` scannable for AI in the same shape.
|
|
28
25
|
|
|
29
26
|
---
|
|
30
27
|
|
|
@@ -67,7 +64,7 @@ Presentation → Application → Domain ← Infrastructure
|
|
|
67
64
|
|
|
68
65
|
### Project Structure
|
|
69
66
|
|
|
70
|
-
完整 specs 目錄結構見
|
|
67
|
+
完整 specs 目錄結構見 `AI-AGENT-GUIDE.md` § Source of Truth。
|
|
71
68
|
以下只列本專案當前狀態(Dflow CLI init 建立後可能還未全填):
|
|
72
69
|
|
|
73
70
|
```
|
|
@@ -161,13 +158,11 @@ AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
|
|
|
161
158
|
|
|
162
159
|
## Notes
|
|
163
160
|
|
|
164
|
-
- This snippet is intentionally
|
|
165
|
-
|
|
166
|
-
you want the full version (with detailed flow descriptions per slash
|
|
167
|
-
command), use that template instead
|
|
161
|
+
- This snippet is intentionally minimal — the older Claude-specific two-H2
|
|
162
|
+
layout, not a full restatement of Dflow's logic
|
|
168
163
|
- The snippet does NOT re-copy the Dflow decision tree, Ceremony
|
|
169
|
-
Scaling criteria, or per-flow step details — those live in
|
|
170
|
-
|
|
164
|
+
Scaling criteria, or per-flow step details — those live in
|
|
165
|
+
`AI-AGENT-GUIDE.md` and the workflow bundle, and change as Dflow evolves
|
|
171
166
|
- Re-running the Dflow CLI init command (`dflow init`, or `npx dflow-sdd-ddd init`
|
|
172
167
|
when using the no-install path) will NOT overwrite an existing `CLAUDE.md`;
|
|
173
168
|
if you want to re-sync, merge manually
|
|
@@ -58,7 +58,7 @@ gh pr create --base main --fill
|
|
|
58
58
|
|
|
59
59
|
- **Short-lived feature branches**: typically hours to a few days, not
|
|
60
60
|
weeks. Encourage splitting large features into multiple phase-specs
|
|
61
|
-
and merging each phase to `main` (see
|
|
61
|
+
and merging each phase to `main` (see `AI-AGENT-GUIDE.md` § Ceremony Scaling +
|
|
62
62
|
`/dflow:new-phase`)
|
|
63
63
|
- **Main is always releasable**: feature flags or dark launches for
|
|
64
64
|
incomplete functionality; CI must be green on `main` at all times
|
|
@@ -8,15 +8,16 @@
|
|
|
8
8
|
> Audience: engineers writing specs; AI assistants producing spec drafts.
|
|
9
9
|
|
|
10
10
|
This file captures **project-level** conventions only. Template shapes
|
|
11
|
-
and Ceremony criteria are defined by
|
|
12
|
-
|
|
11
|
+
and Ceremony criteria are defined by Dflow itself (the Ceremony tier criteria
|
|
12
|
+
live in `AI-AGENT-GUIDE.md` § Ceremony Scaling; template shapes live in the
|
|
13
|
+
workflow bundle); here we just record how *this* project fills them in.
|
|
13
14
|
|
|
14
15
|
---
|
|
15
16
|
|
|
16
17
|
## Where Specs Live
|
|
17
18
|
|
|
18
19
|
All spec documents live under `dflow/specs/`. The feature directory pattern
|
|
19
|
-
and file names follow Dflow (see
|
|
20
|
+
and file names follow Dflow (see `AI-AGENT-GUIDE.md` § Source of Truth
|
|
20
21
|
for the full tree):
|
|
21
22
|
|
|
22
23
|
```
|
|
@@ -119,8 +120,8 @@ Project-specific guidance when filling these templates:
|
|
|
119
120
|
|
|
120
121
|
## Ceremony Scaling (Project Application)
|
|
121
122
|
|
|
122
|
-
|
|
123
|
-
Trivial**. See
|
|
123
|
+
Dflow defines three tiers — **T1 Heavy / T2 Light / T3
|
|
124
|
+
Trivial**. See `AI-AGENT-GUIDE.md` § Ceremony Scaling for the full
|
|
124
125
|
criteria table. We do not re-define the tier criteria here; this
|
|
125
126
|
section records how *this* project applies them in borderline
|
|
126
127
|
situations.
|
|
@@ -132,9 +133,9 @@ situations.
|
|
|
132
133
|
| {e.g. EF configuration tweak in Infrastructure} | T3 if no Domain change | Infra-only; inline row in `_index.md` |
|
|
133
134
|
| {e.g. Domain Event payload extension} | T1 | Event contract change affects cross-context consumers |
|
|
134
135
|
|
|
135
|
-
### DDD Modeling Depth (
|
|
136
|
+
### DDD Modeling Depth (`AI-AGENT-GUIDE.md` § Ceremony Scaling)
|
|
136
137
|
|
|
137
|
-
|
|
138
|
+
Dflow further distinguishes:
|
|
138
139
|
|
|
139
140
|
- **Full** (new Aggregate / new BC): use `templates/aggregate-design.md`
|
|
140
141
|
+ update `context-map.md` + define events in `events.md`
|
|
@@ -170,7 +171,7 @@ and `/dflow:new-phase` flows; the project-level convention is simply
|
|
|
170
171
|
- [Git principles](Git-principles-{gitflow|trunk}.md)
|
|
171
172
|
- [Context map](../domain/context-map.md)
|
|
172
173
|
- [Glossary](../domain/glossary.md)
|
|
173
|
-
-
|
|
174
|
+
- `AI-AGENT-GUIDE.md` — canonical source for Ceremony Scaling, flow
|
|
174
175
|
selection, and template shapes.
|
|
175
176
|
- Dflow skill `references/ddd-modeling-guide.md` — DDD tactical
|
|
176
177
|
pattern reference.
|
|
@@ -89,7 +89,7 @@ Template note (for AI):
|
|
|
89
89
|
> T3 行:inline 完整描述一句話 + 標籤(如 `[cosmetic]` / `[text]` /
|
|
90
90
|
> `[format]`);T3 不產獨立 spec 檔
|
|
91
91
|
>
|
|
92
|
-
> Tier 判準見
|
|
92
|
+
> Tier 判準見 AI-AGENT-GUIDE.md § Ceremony Scaling 三層表。
|
|
93
93
|
|
|
94
94
|
| Date | Tier | Description | Commit |
|
|
95
95
|
|---|---|---|---|
|
|
@@ -13,6 +13,12 @@ created: {YYYY-MM-DD}
|
|
|
13
13
|
## Invariants
|
|
14
14
|
|
|
15
15
|
> 必須永遠為真的規則。這是 Aggregate 存在的理由。
|
|
16
|
+
> 主體列 **boundary invariants**(需同時看到 Aggregate 內多個物件的狀態才能判的規則)。
|
|
17
|
+
> 單一物件可判的 local constraint 不列這裡 — 純格式/必填走 Validator、有 domain
|
|
18
|
+
> 語意走 VO / Entity constructor。跨 instance 的規則(唯一性、僅一筆 active)可列,
|
|
19
|
+
> 但標 `set-based` 並在 Behavior on Violation 寫明 store-level guard(unique /
|
|
20
|
+
> partial index、concurrency token;見 ddd-modeling-guide 的 Invariant
|
|
21
|
+
> Classification 與 Set-Based 段)。
|
|
16
22
|
|
|
17
23
|
| ID | Invariant | Behavior on Violation |
|
|
18
24
|
|---|---|---|
|
|
@@ -6,15 +6,24 @@
|
|
|
6
6
|
|
|
7
7
|
## Contexts
|
|
8
8
|
|
|
9
|
-
| Bounded Context | Responsibility | Owner / Team | Primary Module | Notes |
|
|
10
|
-
|
|
11
|
-
| {Context name} | {業務責任} | {owner} | `{module/project}` | {optional notes} |
|
|
9
|
+
| Bounded Context | Responsibility | Subdomain Type | Owner / Team | Primary Module | Notes |
|
|
10
|
+
|---|---|---|---|---|---|
|
|
11
|
+
| {Context name} | {業務責任} | core / supporting / generic | {owner} | `{module/project}` | {optional notes} |
|
|
12
|
+
|
|
13
|
+
> **Subdomain Type** — 判別問句:「這塊功能換成現成 SaaS / 套件,系統的差異化會消失嗎?」
|
|
14
|
+
> (差異化不限商業競爭優勢;內部系統指獨特的營運優勢 / 任務成果。)會 → `core`;
|
|
15
|
+
> 不會、但需要為自家流程客製 → `supporting`(必要、常需客製、非差異化);
|
|
16
|
+
> 不會、且現成方案存在 → `generic`。多數 BC 是 supporting,`core` 通常只有 1–2 個;
|
|
17
|
+
> 全標 core = 沒分類。分類是可修訂的初判,改判時更新本欄並在 Notes 留一行理由。
|
|
18
|
+
> 它決定建模深度(見 `references/ddd-modeling-guide.md`
|
|
19
|
+
> § Subdomain-Aware Modeling Depth),但**不**降低 BR 紀錄、Tier ceremony、
|
|
20
|
+
> 或安全 / 測試 / 可靠性要求。
|
|
12
21
|
|
|
13
22
|
## Relationships
|
|
14
23
|
|
|
15
24
|
| Upstream | Downstream | Relationship Type | Published Language | ACL | Events |
|
|
16
25
|
|---|---|---|---|---|---|
|
|
17
|
-
| {Upstream context} | {Downstream context} | {Customer/Supplier, Conformist, ACL, Shared Kernel, etc.} | {shared terms / contract} | {Yes/No + location} | {event names or n/a} |
|
|
26
|
+
| {Upstream context} | {Downstream context} | {Customer/Supplier, Conformist, ACL, Shared Kernel, Separate Ways, Big Ball of Mud (BBoM), OHS, etc.} | {shared terms / contract} | {Yes/No + location} | {event names or n/a} |
|
|
18
27
|
|
|
19
28
|
## Integration Notes
|
|
20
29
|
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
## Event Flow Notes
|
|
14
14
|
|
|
15
|
-
- {
|
|
15
|
+
- {事件發生時序、交易邊界、重試或一致性注意事項;跨 aggregate 的 async(eventual
|
|
16
|
+
consistency)event chain,handler 重試耗盡的最終失敗若造成 business-visible 後果
|
|
17
|
+
(補償/權益/金流/庫存/合規/人工對帳)→ 升級為 BR/EC 寫進 behavior.md 與 spec,
|
|
18
|
+
best-effort 副作用(通知/logging)記這裡或 tech-debt 即可}
|
|
16
19
|
|
|
17
20
|
## Open Questions
|
|
18
21
|
|
|
@@ -11,7 +11,7 @@ branch: bugfix/BUG-{NUMBER}-{short-description}
|
|
|
11
11
|
Template note (for AI):
|
|
12
12
|
This is the **lightweight-spec** template — it corresponds to T2 Light
|
|
13
13
|
ceremony in the three-tier Ceremony Scaling (T1 Heavy / T2 Light /
|
|
14
|
-
T3 Trivial; see
|
|
14
|
+
T3 Trivial; see AI-AGENT-GUIDE.md § Ceremony Scaling for the tier criteria).
|
|
15
15
|
|
|
16
16
|
- T1 Heavy → use templates/phase-spec.md instead
|
|
17
17
|
- T2 Light → THIS template; produces an independent file
|
|
@@ -21,7 +21,7 @@ Template note (for AI):
|
|
|
21
21
|
|
|
22
22
|
Each section below carries an HTML comment indicating its fill-in activity (Activity 1-4).
|
|
23
23
|
These activity markers let /dflow:status and the completion checklist track progress.
|
|
24
|
-
Activities correspond to
|
|
24
|
+
Activities correspond to AI-AGENT-GUIDE.md § Guiding Questions by Activity:
|
|
25
25
|
Activity 1: Understanding (What & Why)
|
|
26
26
|
Activity 2: Domain Modeling (BC, Aggregate, VO, Events)
|
|
27
27
|
Activity 3: Spec Writing (Behavior + Rules + Edge Cases)
|