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
|
@@ -13,6 +13,42 @@ This project uses Dflow for spec-first AI-assisted development.
|
|
|
13
13
|
| Migration / legacy context | {migration-context} |
|
|
14
14
|
| Prose language | {prose-language} |
|
|
15
15
|
|
|
16
|
+
## Why This Matters
|
|
17
|
+
|
|
18
|
+
This project has business logic embedded in delivery/entrypoint code
|
|
19
|
+
(presentation/UI layer, controllers, handlers, jobs, message consumers, data
|
|
20
|
+
pipelines, or stored procedures), direct SQL in entrypoints, and duplicated
|
|
21
|
+
calculations across multiple flows. Every feature developed without specs makes
|
|
22
|
+
the target architecture harder to reach; every spec written and every domain
|
|
23
|
+
concept extracted makes it easier to reach.
|
|
24
|
+
|
|
25
|
+
Your role is not to lecture — it's to ask the right questions at the right time
|
|
26
|
+
so developers naturally produce three assets with every change:
|
|
27
|
+
|
|
28
|
+
1. **Spec documents** — future requirements documentation
|
|
29
|
+
2. **Domain layer code** — portable to a cleaner future architecture
|
|
30
|
+
3. **Tech debt records** — migration guide entries
|
|
31
|
+
|
|
32
|
+
## Scope: When Brownfield Applies
|
|
33
|
+
|
|
34
|
+
Dflow Brownfield is designed for existing systems where:
|
|
35
|
+
|
|
36
|
+
- **Business rules and domain concepts** can be extracted and re-expressed as
|
|
37
|
+
portable code (entities, value objects, services, repository interfaces)
|
|
38
|
+
- **Business logic is currently embedded in delivery/entrypoint code** —
|
|
39
|
+
presentation/UI layer, controllers, handlers, jobs, message consumers, data
|
|
40
|
+
pipelines, or stored procedures — making changes risky and slow
|
|
41
|
+
- The team wants to **gradually move toward a cleaner architecture** without a
|
|
42
|
+
full rewrite
|
|
43
|
+
|
|
44
|
+
It is **not** a fit for:
|
|
45
|
+
|
|
46
|
+
- Pure infrastructure scripts (deployment, monitoring) without a stable domain
|
|
47
|
+
model
|
|
48
|
+
- Data pipelines or batch jobs that are purely transformational with no
|
|
49
|
+
business-rule complexity
|
|
50
|
+
- Greenfield projects (use the Greenfield track instead)
|
|
51
|
+
|
|
16
52
|
## Before Editing Code
|
|
17
53
|
|
|
18
54
|
Do not jump from a request directly to code. First identify the matching
|
|
@@ -28,7 +64,7 @@ are not available in the current AI tool:
|
|
|
28
64
|
| `/dflow:bug-fix` | A defect can be described with expected vs actual behavior. |
|
|
29
65
|
| `/dflow:new-phase` | An active feature needs another implementation slice. |
|
|
30
66
|
| `/dflow:finish-feature` | Implementation is complete and needs drift closure. |
|
|
31
|
-
| `/dflow:verify` |
|
|
67
|
+
| `/dflow:verify` | A bounded context's domain docs (`rules.md` ↔ `behavior.md`) need a consistency / drift check. |
|
|
32
68
|
| `/dflow:pr-review` | A change is ready for SDD/DDD review. |
|
|
33
69
|
| `/dflow:report-dflow-feedback` | You found a Dflow issue or improvement and want a sanitized upstream feedback draft. |
|
|
34
70
|
| `/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 +81,7 @@ Machine-readable source for rendering tool-specific thin wrappers:
|
|
|
45
81
|
| bug-fix | /dflow:bug-fix | Investigate a defect described by expected vs actual behavior. | expected vs actual | workflow |
|
|
46
82
|
| new-phase | /dflow:new-phase | Add another implementation slice to an active feature. | feature id or phase goal | workflow |
|
|
47
83
|
| finish-feature | /dflow:finish-feature | Close implementation with drift checks and archived feature state. | feature id | workflow |
|
|
48
|
-
| verify | /dflow:verify | Check
|
|
84
|
+
| verify | /dflow:verify | Check a bounded context's domain docs (`rules.md` ↔ `behavior.md`) for consistency. | bounded context or all | workflow |
|
|
49
85
|
| pr-review | /dflow:pr-review | Review a ready change for SDD/DDD alignment. | change or branch | workflow |
|
|
50
86
|
| report-dflow-feedback | /dflow:report-dflow-feedback | Draft sanitized upstream feedback about Dflow. | issue or improvement | workflow |
|
|
51
87
|
| status | /dflow:status | Report current workflow state and next valid action. | - | control |
|
|
@@ -53,6 +89,33 @@ Machine-readable source for rendering tool-specific thin wrappers:
|
|
|
53
89
|
| cancel | /dflow:cancel | Abort the active workflow and return to free conversation. | - | control |
|
|
54
90
|
<!-- dflow-command-registry:end -->
|
|
55
91
|
|
|
92
|
+
## Routing Non-Command Input
|
|
93
|
+
|
|
94
|
+
Not every developer message maps to a `/dflow:*` workflow. Route non-command
|
|
95
|
+
input like this (supporting files live in the workflow bundle at
|
|
96
|
+
`dflow/specs/shared/dflow-workflows/`):
|
|
97
|
+
|
|
98
|
+
- **"Quick question about..." / "How does X work?"** → check
|
|
99
|
+
`dflow/specs/domain/` first and answer from the documented domain knowledge.
|
|
100
|
+
If no spec exists yet, suggest documenting the answer as domain knowledge.
|
|
101
|
+
- **"What should I work on next?" / sprint planning** → review
|
|
102
|
+
`dflow/specs/features/backlog/` and suggest work based on migration value.
|
|
103
|
+
- **"I'm creating a branch"** → read `references/git-integration.md`; verify
|
|
104
|
+
branch naming and ensure a spec exists before coding starts.
|
|
105
|
+
- **"I'm designing a domain model" / "How should I model X?" / building or
|
|
106
|
+
reshaping an Aggregate** → read `references/ddd-modeling-guide.md` (DDD
|
|
107
|
+
tactical patterns: aggregates, invariants, value objects, domain events). It
|
|
108
|
+
is written with Greenfield artifact names; see its **Edition note** for where
|
|
109
|
+
Brownfield records the same decisions (`models.md` / `rules.md` /
|
|
110
|
+
`behavior.md` / `migration/tech-debt.md`).
|
|
111
|
+
- **"Dflow seems wrong" / "this template is confusing"** (or you notice Dflow
|
|
112
|
+
guidance drift) → suggest `/dflow:report-dflow-feedback`; never submit
|
|
113
|
+
anything upstream automatically.
|
|
114
|
+
- **Anything else code-related** → assess whether it touches business logic. If
|
|
115
|
+
it does, use the auto-trigger safety net (suggest the matching `/dflow:*`
|
|
116
|
+
command and wait for confirmation — see § Workflow Transparency); if not, help
|
|
117
|
+
directly with no ceremony.
|
|
118
|
+
|
|
56
119
|
## Status / Control Commands
|
|
57
120
|
|
|
58
121
|
`/dflow:status` reports active workflow state. Include these fields: workflow,
|
|
@@ -71,6 +134,67 @@ workflow was cancelled.
|
|
|
71
134
|
When no workflow is active, `/dflow:next` and `/dflow:cancel` must report that
|
|
72
135
|
there is no active workflow to advance or cancel.
|
|
73
136
|
|
|
137
|
+
## Workflow Transparency
|
|
138
|
+
|
|
139
|
+
Dflow uses a hybrid interaction design: `/dflow:*` commands are the primary
|
|
140
|
+
entry, natural-language auto-trigger is a safety net, and tiered transparency
|
|
141
|
+
keeps the developer aware of where they are in a workflow.
|
|
142
|
+
|
|
143
|
+
### Auto-Trigger Safety Net
|
|
144
|
+
|
|
145
|
+
When natural language implies a development task, detect the intent — but do
|
|
146
|
+
**not** auto-enter a workflow. Instead:
|
|
147
|
+
|
|
148
|
+
1. State your judgment clearly:
|
|
149
|
+
> "I think this is a new-feature task."
|
|
150
|
+
2. Offer the developer three options:
|
|
151
|
+
- Type `/dflow:new-feature` to start explicitly
|
|
152
|
+
- Reply "OK" / "繼續" to confirm this workflow
|
|
153
|
+
- Or correct the workflow (e.g., "no, this is a bug fix")
|
|
154
|
+
3. Wait for confirmation before entering any workflow.
|
|
155
|
+
|
|
156
|
+
This addresses three failure modes of pure auto-trigger: missed triggers, wrong
|
|
157
|
+
workflow selection, and invisible state.
|
|
158
|
+
|
|
159
|
+
### Three-Tier Transparency
|
|
160
|
+
|
|
161
|
+
During an active workflow, communicate at three levels — no more, no less:
|
|
162
|
+
|
|
163
|
+
| Level | Trigger point | AI behavior |
|
|
164
|
+
|---|---|---|
|
|
165
|
+
| **Flow entry (must confirm)** | After judging the workflow from NL | Stop and wait for confirmation (command, "OK", or implicit) |
|
|
166
|
+
| **Step gate (notify + optional confirm)** | Before major milestones | Announce the transition; if the developer provides next-step input, treat it as implicit confirmation |
|
|
167
|
+
| **Step-internal (notify only)** | Step N → Step N+1 | Announce "Step N complete, entering Step N+1" — do not wait |
|
|
168
|
+
|
|
169
|
+
The specific step-gate positions for each workflow live in that flow's own file
|
|
170
|
+
(`dflow/specs/shared/dflow-workflows/references/<flow>.md`), which is the source
|
|
171
|
+
of truth for its gate sequence.
|
|
172
|
+
|
|
173
|
+
### Confirmation Signals (NL ↔ Command Equivalence)
|
|
174
|
+
|
|
175
|
+
Any of these count as "proceed to next step" — accept whichever the developer
|
|
176
|
+
uses:
|
|
177
|
+
|
|
178
|
+
- **Command**: `/dflow:next`
|
|
179
|
+
- **Verbal (English)**: OK / yes / continue / go ahead / sounds good / proceed
|
|
180
|
+
- **Verbal (Chinese)**: 好 / 對 / 繼續 / 可以 / 沒問題
|
|
181
|
+
- **Implicit**: the developer provides the information needed for the next step
|
|
182
|
+
(e.g., the AI asks "Which Bounded Context?" and the developer answers with the
|
|
183
|
+
Bounded Context name → implicit confirmation)
|
|
184
|
+
|
|
185
|
+
The implicit-confirmation rule matters — do not turn every transition into a
|
|
186
|
+
ceremony where the developer must say "OK" before every sentence.
|
|
187
|
+
|
|
188
|
+
### Completion Checklist Skip Guard
|
|
189
|
+
|
|
190
|
+
Completion checklists and their step ordering live in the flow files and run at
|
|
191
|
+
the gate each flow specifies (the feature-level completion gate in
|
|
192
|
+
`new-feature-flow` / `modify-existing-flow`, the phase-level gate in
|
|
193
|
+
`new-phase-flow`). Do not run a checklist opportunistically. But if the
|
|
194
|
+
developer skips the gate and commits directly, use the auto-trigger safety net
|
|
195
|
+
to prompt — "It looks like you're wrapping up — should I run the Step N
|
|
196
|
+
completion checklist?" — before giving commit guidance.
|
|
197
|
+
|
|
74
198
|
## Source of Truth
|
|
75
199
|
|
|
76
200
|
Dflow-owned project documents live under `dflow/specs/`.
|
|
@@ -85,6 +209,38 @@ Dflow-owned project documents live under `dflow/specs/`.
|
|
|
85
209
|
| Completed feature snapshots | `dflow/specs/features/completed/` |
|
|
86
210
|
| Technical debt | `dflow/specs/architecture/tech-debt.md` or `dflow/specs/migration/tech-debt.md` |
|
|
87
211
|
|
|
212
|
+
### Project Structure
|
|
213
|
+
|
|
214
|
+
The `dflow/specs/` layout Dflow seeds and maintains (Brownfield track):
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
dflow/specs/
|
|
218
|
+
├── shared/ # Project-level governance docs (seeded by npx dflow-sdd-ddd init)
|
|
219
|
+
│ ├── _overview.md # System status & migration strategy
|
|
220
|
+
│ └── _conventions.md # Spec writing conventions
|
|
221
|
+
├── domain/ # Domain knowledge (DDD preparation)
|
|
222
|
+
│ ├── glossary.md # Ubiquitous Language
|
|
223
|
+
│ └── {bounded-context}/ # e.g., expense/, hr/, leave/
|
|
224
|
+
│ ├── context.md # Context boundary & responsibilities
|
|
225
|
+
│ ├── models.md # Entity, VO, Aggregate definitions
|
|
226
|
+
│ ├── rules.md # Business rules index (BR-ID + one-line)
|
|
227
|
+
│ └── behavior.md # Consolidated behavior (Given/When/Then)
|
|
228
|
+
├── features/
|
|
229
|
+
│ ├── active/ # Currently in development
|
|
230
|
+
│ │ └── {SPEC-ID}-{slug}/ # One feature = one directory
|
|
231
|
+
│ │ ├── _index.md # Feature dashboard + BR Snapshot + Resume Pointer
|
|
232
|
+
│ │ ├── phase-spec-YYYY-MM-DD-{slug}.md # T1: 0..N phase specs
|
|
233
|
+
│ │ └── lightweight-YYYY-MM-DD-{slug}.md # T2: 0..N lightweight specs
|
|
234
|
+
│ │ # (or BUG-{NUMBER}-{slug}.md)
|
|
235
|
+
│ ├── completed/ # Done (whole feature directory archived here)
|
|
236
|
+
│ └── backlog/ # Planned
|
|
237
|
+
│ #
|
|
238
|
+
│ # SPEC-ID format: SPEC-YYYYMMDD-NNN; slug follows discussion language (中文 / 英文 both OK).
|
|
239
|
+
│ # T3 trivial changes have NO independent file — just a row in _index.md Lightweight Changes.
|
|
240
|
+
└── migration/
|
|
241
|
+
└── tech-debt.md # Issues to fix in the target system
|
|
242
|
+
```
|
|
243
|
+
|
|
88
244
|
## Core Rules
|
|
89
245
|
|
|
90
246
|
1. Spec before code: meaningful behavior changes need a spec or lightweight bug spec before implementation.
|
|
@@ -93,33 +249,106 @@ Dflow-owned project documents live under `dflow/specs/`.
|
|
|
93
249
|
4. Check drift before calling work complete.
|
|
94
250
|
5. Follow `dflow/specs/shared/_conventions.md`, especially `## Prose Language`.
|
|
95
251
|
|
|
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
|
-
|
|
252
|
+
## Ceremony Scaling
|
|
253
|
+
|
|
254
|
+
Not everything needs full ceremony — match effort to impact. Dflow uses three
|
|
255
|
+
tiers — **T1 Heavy / T2 Light / T3 Trivial** — chosen by the AI per change.
|
|
256
|
+
`/dflow:new-feature` and `/dflow:new-phase` always default to T1 (no judgement
|
|
257
|
+
needed). The criteria below apply when `/dflow:modify-existing` or
|
|
258
|
+
`/dflow:bug-fix` decides which tier fits a modification.
|
|
259
|
+
|
|
260
|
+
| Tier | Scenario | Output | Command / Trigger |
|
|
261
|
+
|---|---|---|---|
|
|
262
|
+
| **T1 Heavy** | New feature, new phase, 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 | `/dflow:new-feature` / `/dflow:new-phase` |
|
|
263
|
+
| **T2 Light** | Bug fix, 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 | `/dflow:bug-fix` or `/dflow:modify-existing` (lightweight branch) |
|
|
264
|
+
| **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) |
|
|
265
|
+
|
|
266
|
+
**T3 criteria** (the AI must satisfy **all four** before classifying T3):
|
|
267
|
+
|
|
268
|
+
1. No BR-ID change (no ADDED / MODIFIED / REMOVED / RENAMED business rule)
|
|
269
|
+
2. No Domain concept added or changed (Aggregate / Entity / VO / Event)
|
|
270
|
+
3. No data structure change (table, column, relation, index)
|
|
271
|
+
4. Only changes UI surface (colour, text, layout), pure comments, or pure formatting
|
|
272
|
+
|
|
273
|
+
If any criterion fails → drop to T2; if Domain / BR / data structure is touched → escalate to T1.
|
|
274
|
+
|
|
275
|
+
**Below T3 — Dflow doesn't track at all**: pure typo fixes, commit-message
|
|
276
|
+
typos, pure formatting commits (e.g. `prettier` / `dotnet format` auto-runs).
|
|
277
|
+
You can `git commit` directly without writing even a T3 inline row.
|
|
278
|
+
|
|
279
|
+
**Lightweight spec** = Problem + Expected behavior + 1–2 Given/When/Then. The
|
|
280
|
+
instantiated file is placed inside the feature directory (see
|
|
281
|
+
`templates/lightweight-spec.md`).
|
|
282
|
+
|
|
283
|
+
## Behavior Source of Truth (rules.md + behavior.md)
|
|
284
|
+
|
|
285
|
+
Each Bounded Context has two complementary files that together describe the
|
|
286
|
+
system's current behavior:
|
|
287
|
+
|
|
288
|
+
- **`rules.md`** — declarative index: lists each BR-ID with a one-line summary.
|
|
289
|
+
Quick lookup, easy to scan.
|
|
290
|
+
- **`behavior.md`** — scenario-level detail: the full Given/When/Then scenarios
|
|
291
|
+
for each BR-ID. This is the consolidated source of truth for "what does the
|
|
292
|
+
system actually do right now?"
|
|
293
|
+
|
|
294
|
+
`dflow/specs/features/completed/` is a historical archive (individual change
|
|
295
|
+
records). `behavior.md` is the **merged current state** — when a feature is
|
|
296
|
+
completed, the AI merges its scenarios into `behavior.md`; when behavior is
|
|
297
|
+
modified, the AI updates the corresponding section to reflect the new behavior
|
|
298
|
+
(git preserves history). See the `behavior.md` template in the workflow bundle
|
|
299
|
+
at `dflow/specs/shared/dflow-workflows/templates/behavior.md`.
|
|
300
|
+
|
|
301
|
+
## Guiding Questions by Activity
|
|
302
|
+
|
|
303
|
+
SDD has five conceptual activities (Understanding / Domain Analysis / Spec
|
|
304
|
+
Writing / Implementation Planning / Tech Debt Awareness) that the AI walks the
|
|
305
|
+
developer through inside a workflow. They cut across workflow steps — Activity 2
|
|
306
|
+
(Domain Analysis) might span Step 2 and Step 3 of new-feature-flow, for example.
|
|
307
|
+
|
|
308
|
+
When a developer starts working, guide them with these questions in order. Don't
|
|
309
|
+
dump all questions at once — ask naturally as the conversation progresses.
|
|
310
|
+
|
|
311
|
+
**Activity markers in the phase-spec template**: each section in
|
|
312
|
+
`templates/phase-spec.md` carries an HTML comment (e.g.,
|
|
313
|
+
`<!-- Fill timing: Activity 2: Domain Analysis -->`) indicating the activity in
|
|
314
|
+
which that section should be filled. These markers align with the activities
|
|
315
|
+
below and are used by `/dflow:status` and the completion checklist to track
|
|
316
|
+
progress. When guiding a developer, fill sections in activity order; do not jump
|
|
317
|
+
ahead to Activity 4 (Implementation Planning) before Activity 3 (Spec Writing)
|
|
318
|
+
is agreed. The `Implementation Tasks` section at the end of the template is
|
|
319
|
+
produced by the AI at the end of Activity 4 — see new-feature-flow.md Step 5 /
|
|
320
|
+
new-phase-flow.md Step 4 / modify-existing-flow.md Step 4.
|
|
321
|
+
|
|
322
|
+
Note: the phase-spec template HTML comments cover Activity 1–4; Activity 5 (Tech
|
|
323
|
+
Debt Awareness) is a closeout-time concern handled when updating `tech-debt.md`
|
|
324
|
+
during the completion checklist, not via template section markers.
|
|
325
|
+
|
|
326
|
+
### Activity 1: Understanding (What & Why)
|
|
327
|
+
- What problem does this solve? Who asked for it?
|
|
328
|
+
- What's the expected behavior from the user's perspective?
|
|
329
|
+
- Are there existing specs or domain docs related to this?
|
|
330
|
+
|
|
331
|
+
### Activity 2: Domain Analysis (Where does it live?)
|
|
332
|
+
- Which Bounded Context does this belong to? (Check dflow/specs/domain/)
|
|
333
|
+
- What domain concepts are involved? (Entities, Value Objects, Services)
|
|
334
|
+
- Are there new terms? → Update glossary.md
|
|
335
|
+
- Are there new or changed business rules? → Document in rules.md
|
|
336
|
+
|
|
337
|
+
### Activity 3: Spec Writing (Document before coding)
|
|
338
|
+
- Write the spec using the template (see `templates/phase-spec.md`)
|
|
339
|
+
- Define Given/When/Then scenarios for key behaviors
|
|
340
|
+
- Identify edge cases and business rule interactions
|
|
341
|
+
|
|
342
|
+
### Activity 4: Implementation Planning (How to build it)
|
|
343
|
+
- Can the business logic live in `src/Domain/` as framework-pure code?
|
|
344
|
+
- What interfaces are needed? (Repository, external services)
|
|
345
|
+
- How thin can the delivery/entrypoint code be? (Ideally: parse input → call Domain → return or display result)
|
|
346
|
+
|
|
347
|
+
### Activity 5: Tech Debt Awareness (What did we find?)
|
|
348
|
+
- Did we discover scattered business logic? → Record in tech-debt.md
|
|
349
|
+
- Are there duplicated calculations? → Record
|
|
350
|
+
- Direct SQL in delivery/entrypoint code? → Record
|
|
351
|
+
- Magic numbers or undocumented statuses? → Record and add to glossary
|
|
123
352
|
|
|
124
353
|
## Workflow Steps
|
|
125
354
|
|
|
@@ -11,10 +11,9 @@
|
|
|
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
|
|
|
14
|
-
The snippet
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
into an existing `CLAUDE.md`.
|
|
14
|
+
The snippet uses a two-H2 segmentation: **System Context** (what the
|
|
15
|
+
system is) and **Development Workflow** (how we work). Keep those two H2
|
|
16
|
+
sections as the backbone when merging into an existing `CLAUDE.md`.
|
|
18
17
|
|
|
19
18
|
---
|
|
20
19
|
|
|
@@ -159,9 +158,7 @@ AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
|
|
|
159
158
|
When merging this snippet into an existing `CLAUDE.md`:
|
|
160
159
|
|
|
161
160
|
1. **Keep the two H2 sections** (`System Context` / `Development Workflow`) as the
|
|
162
|
-
backbone
|
|
163
|
-
`templates/CLAUDE.md` is important — AI assistants navigate by
|
|
164
|
-
these headings.
|
|
161
|
+
backbone — AI assistants navigate by these headings.
|
|
165
162
|
2. **Under `System Context`**: merge the background paragraph and the
|
|
166
163
|
directory tree. If your project already documents directory
|
|
167
164
|
structure elsewhere, keep the tree pointing to `dflow/specs/` and
|
|
@@ -172,7 +169,7 @@ When merging this snippet into an existing `CLAUDE.md`:
|
|
|
172
169
|
cross-referenced from the scaffolding `Git-principles-*.md`.
|
|
173
170
|
4. **Avoid duplication**: do not re-inline the Dflow skill's decision
|
|
174
171
|
tree, Workflow Transparency rules, or Ceremony Scaling criteria
|
|
175
|
-
into `CLAUDE.md`. Let `CLAUDE.md` point to the
|
|
172
|
+
into `CLAUDE.md`. Let `CLAUDE.md` point to `AI-AGENT-GUIDE.md` and the workflow bundle, not
|
|
176
173
|
duplicate it.
|
|
177
174
|
|
|
178
175
|
If you are starting from scratch (no existing `CLAUDE.md`), the
|
|
@@ -8,16 +8,17 @@
|
|
|
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
|
-
|
|
20
|
+
and file names follow Dflow (see `AI-AGENT-GUIDE.md` § Source of Truth
|
|
21
|
+
for the full tree):
|
|
21
22
|
|
|
22
23
|
```
|
|
23
24
|
dflow/specs/features/active/{SPEC-ID}-{slug}/
|
|
@@ -98,8 +99,8 @@ Project-specific guidance when filling these templates:
|
|
|
98
99
|
|
|
99
100
|
## Ceremony Scaling (Project Application)
|
|
100
101
|
|
|
101
|
-
|
|
102
|
-
Trivial**. See
|
|
102
|
+
Dflow defines three tiers — **T1 Heavy / T2 Light / T3
|
|
103
|
+
Trivial**. See `AI-AGENT-GUIDE.md` § Ceremony Scaling for the full
|
|
103
104
|
criteria table. We do not re-define the tier criteria here; this
|
|
104
105
|
section records how *this* project applies them in borderline
|
|
105
106
|
situations.
|
|
@@ -111,8 +112,8 @@ situations.
|
|
|
111
112
|
| {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
113
|
|
|
113
114
|
If the team disagrees on tier classification for a specific change,
|
|
114
|
-
run through the T3 four-criteria checklist (in
|
|
115
|
-
record the decision here the first time it arises.
|
|
115
|
+
run through the T3 four-criteria checklist (in `AI-AGENT-GUIDE.md` §
|
|
116
|
+
Ceremony Scaling) and record the decision here the first time it arises.
|
|
116
117
|
|
|
117
118
|
---
|
|
118
119
|
|
|
@@ -136,5 +137,5 @@ and `/dflow:new-phase` flows; the project-level convention is simply
|
|
|
136
137
|
- [System overview](_overview.md)
|
|
137
138
|
- [Git principles](Git-principles-{gitflow|trunk}.md)
|
|
138
139
|
- [Glossary](../domain/glossary.md)
|
|
139
|
-
-
|
|
140
|
+
- `AI-AGENT-GUIDE.md` — canonical source for Ceremony Scaling, flow
|
|
140
141
|
selection, and template shapes.
|
|
@@ -81,7 +81,7 @@ Template note (for AI):
|
|
|
81
81
|
> T3 行:inline 完整描述一句話 + 標籤(如 `[cosmetic]` / `[text]` /
|
|
82
82
|
> `[format]`);T3 不產獨立 spec 檔
|
|
83
83
|
>
|
|
84
|
-
> Tier 判準見
|
|
84
|
+
> Tier 判準見 AI-AGENT-GUIDE.md § Ceremony Scaling 三層表。
|
|
85
85
|
|
|
86
86
|
| Date | Tier | Description | Commit |
|
|
87
87
|
|---|---|---|---|
|
|
@@ -6,15 +6,23 @@
|
|
|
6
6
|
|
|
7
7
|
## Context List
|
|
8
8
|
|
|
9
|
-
| Bounded Context | Responsibility | Owner / Team | Primary Code Area | Notes |
|
|
10
|
-
|
|
11
|
-
| {Context name} | {業務責任} | {owner} | `{project/path/or/namespace}` | {optional notes} |
|
|
9
|
+
| Bounded Context | Responsibility | Subdomain Type | Owner / Team | Primary Code Area | Notes |
|
|
10
|
+
|---|---|---|---|---|---|
|
|
11
|
+
| {Context name} | {業務責任} | core / supporting / generic | {owner} | `{project/path/or/namespace}` | {optional notes} |
|
|
12
|
+
|
|
13
|
+
> **Subdomain Type** — 判別問句:「這塊功能換成現成 SaaS / 套件,系統的差異化會消失嗎?」
|
|
14
|
+
> (差異化不限商業競爭優勢;內部系統指獨特的營運優勢 / 任務成果。)會 → `core`;
|
|
15
|
+
> 不會、但需要為自家流程客製 → `supporting`(必要、常需客製、非差異化);
|
|
16
|
+
> 不會、且現成方案存在 → `generic`。多數 BC 是 supporting,`core` 通常只有 1–2 個;
|
|
17
|
+
> 全標 core = 沒分類。分類是可修訂的初判,改判時更新本欄並在 Notes 留一行理由。
|
|
18
|
+
> 它影響漸進抽離的取捨(`generic` 傾向整塊替換而非逐條抽離,見 modify-existing-flow
|
|
19
|
+
> Step 4),但**不**降低 BR 紀錄、Tier ceremony、或安全 / 測試 / 可靠性要求。
|
|
12
20
|
|
|
13
21
|
## Relationships
|
|
14
22
|
|
|
15
23
|
| Source Context | Target Context | Relationship Type | Integration Mechanism | Notes |
|
|
16
24
|
|---|---|---|---|---|
|
|
17
|
-
| {Source} | {Target} | {Customer/Supplier, Conformist, ACL, Shared Kernel, etc.} | {DB table, service call, file, manual process} | {optional notes} |
|
|
25
|
+
| {Source} | {Target} | {Customer/Supplier, Conformist, ACL, Shared Kernel, Separate Ways, Big Ball of Mud (BBoM), OHS, etc.} | {DB table, service call, file, manual process} | {optional notes} |
|
|
18
26
|
|
|
19
27
|
## Integration Notes
|
|
20
28
|
|
|
@@ -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 Analysis (Where does it live?)
|
|
27
27
|
Activity 3: Spec Writing (Behavior + Rules + Edge Cases)
|