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.
- package/CHANGELOG.md +26 -0
- package/docs/evaluating-dflow.en.md +14 -5
- package/docs/evaluating-dflow.md +14 -5
- package/docs/using-with-claude-code.en.md +17 -9
- package/docs/using-with-claude-code.md +15 -8
- package/lib/init.js +263 -52
- package/package.json +1 -1
- package/templates/brownfield/references/dflow-feedback-flow.md +179 -0
- package/templates/brownfield/references/drift-verification.md +183 -0
- package/templates/brownfield/references/finish-feature-flow.md +259 -0
- package/templates/brownfield/references/git-integration.md +312 -0
- package/templates/brownfield/references/init-project-flow.md +413 -0
- package/templates/brownfield/references/modify-existing-flow.md +444 -0
- package/templates/brownfield/references/new-feature-flow.md +367 -0
- package/templates/brownfield/references/new-phase-flow.md +259 -0
- package/templates/brownfield/references/pr-review-checklist.md +179 -0
- package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +31 -4
- package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +12 -8
- package/templates/brownfield/scaffolding/Git-principles-gitflow.md +1 -1
- package/templates/brownfield/scaffolding/Git-principles-trunk.md +1 -1
- package/templates/brownfield/scaffolding/_conventions.md +1 -1
- package/templates/brownfield/scaffolding/_overview.md +3 -3
- package/templates/brownfield/templates/context-map.md +1 -1
- package/templates/brownfield/templates/glossary.md +1 -1
- package/templates/brownfield/templates/models.md +1 -1
- package/templates/brownfield/templates/rules.md +1 -1
- package/templates/brownfield/templates/tech-debt.md +1 -1
- package/templates/common/skill/SKILL.md +35 -0
- package/templates/greenfield/references/ddd-modeling-guide.md +351 -0
- package/templates/greenfield/references/dflow-feedback-flow.md +179 -0
- package/templates/greenfield/references/drift-verification.md +195 -0
- package/templates/greenfield/references/finish-feature-flow.md +280 -0
- package/templates/greenfield/references/git-integration.md +285 -0
- package/templates/greenfield/references/init-project-flow.md +447 -0
- package/templates/greenfield/references/modify-existing-flow.md +362 -0
- package/templates/greenfield/references/new-feature-flow.md +397 -0
- package/templates/greenfield/references/new-phase-flow.md +273 -0
- package/templates/greenfield/references/pr-review-checklist.md +130 -0
- package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +31 -4
- package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +15 -13
- package/templates/greenfield/scaffolding/Git-principles-gitflow.md +1 -1
- package/templates/greenfield/scaffolding/Git-principles-trunk.md +1 -1
- package/templates/greenfield/scaffolding/_conventions.md +1 -1
- package/templates/greenfield/scaffolding/_overview.md +5 -3
- package/templates/greenfield/scaffolding/architecture-decisions-README.md +1 -1
- package/templates/greenfield/templates/context-map.md +1 -1
- package/templates/greenfield/templates/events.md +1 -1
- package/templates/greenfield/templates/glossary.md +1 -1
- package/templates/greenfield/templates/models.md +1 -1
- package/templates/greenfield/templates/rules.md +1 -1
- package/templates/greenfield/templates/tech-debt.md +1 -1
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
# New Feature Workflow
|
|
2
|
+
|
|
3
|
+
Step-by-step guide for when a developer triggers `/dflow:new-feature` (or natural language implying a new-feature task — see SKILL.md § Workflow Transparency for the auto-trigger safety net behavior).
|
|
4
|
+
|
|
5
|
+
**Step Gates** in this flow (stop-and-confirm before proceeding):
|
|
6
|
+
- Step 3 → Step 3.5 (domain concepts captured → confirm slug + directory + branch names)
|
|
7
|
+
- Step 4 → Step 5 (spec written → plan implementation)
|
|
8
|
+
- Step 6 → Step 7 (branch ready → start implementation)
|
|
9
|
+
- Step 7 → Step 8 (implementation done → completion)
|
|
10
|
+
|
|
11
|
+
All other step transitions are **step-internal**: announce "Step N complete, entering Step N+1" and proceed without waiting. See SKILL.md § Workflow Transparency for the full transparency protocol and confirmation signals.
|
|
12
|
+
|
|
13
|
+
**Ceremony**: this flow always defaults to **T1 Heavy** — the first phase of a brand-new feature is by definition a full SDD cycle. Tier judgement (T1 / T2 / T3) only applies to `/dflow:modify-existing` (see `references/modify-existing-flow.md` and SKILL.md § Ceremony Scaling).
|
|
14
|
+
|
|
15
|
+
## Step 1: Intake — Understand the Request
|
|
16
|
+
|
|
17
|
+
Before producing any spec prose, read `dflow/specs/shared/_conventions.md`
|
|
18
|
+
and apply the `## Prose Language` setting. If the setting is missing or not
|
|
19
|
+
an explicit language tag, ask the developer to update `_conventions.md`
|
|
20
|
+
before continuing.
|
|
21
|
+
|
|
22
|
+
Ask these questions (naturally, not as a checklist dump):
|
|
23
|
+
|
|
24
|
+
1. **What's the feature?** Get a plain-language description.
|
|
25
|
+
2. **Who needs it?** Identify the stakeholder or user role.
|
|
26
|
+
3. **Why now?** Understand priority and urgency (affects ceremony level).
|
|
27
|
+
|
|
28
|
+
Then check existing assets:
|
|
29
|
+
- Search `dflow/specs/domain/` for related concepts
|
|
30
|
+
- Search `dflow/specs/features/` for related or overlapping features
|
|
31
|
+
- Check `dflow/specs/domain/glossary.md` for relevant terms
|
|
32
|
+
|
|
33
|
+
Share what you found: "I see we already have [X] documented. This new feature seems to extend
|
|
34
|
+
that — is that right?"
|
|
35
|
+
|
|
36
|
+
**→ Transition (step-internal)**: Step 1 complete. Announce "Step 1 complete (intake). Entering Step 2: Identify the Bounded Context." and continue.
|
|
37
|
+
|
|
38
|
+
## Step 2: Identify the Bounded Context
|
|
39
|
+
|
|
40
|
+
Guide the developer to place this feature in the right context:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
"This feature involves [concepts]. Looking at our domain structure,
|
|
44
|
+
it seems to fit in the [Context] bounded context. Does that match
|
|
45
|
+
your understanding?"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If no matching context exists:
|
|
49
|
+
1. Propose a new context name
|
|
50
|
+
2. Create `dflow/specs/domain/{new-context}/context.md` using the context-definition template
|
|
51
|
+
3. Get developer confirmation before proceeding
|
|
52
|
+
|
|
53
|
+
**→ Transition (step-internal)**: Step 2 complete. Announce "Step 2 complete (BC identified). Entering Step 3: Domain Concept Discovery." and continue.
|
|
54
|
+
|
|
55
|
+
## Step 3: Domain Concept Discovery
|
|
56
|
+
|
|
57
|
+
Walk through these questions:
|
|
58
|
+
|
|
59
|
+
- **What are the key nouns?** → Potential Entities or Value Objects
|
|
60
|
+
- **What are the key verbs?** → Potential Domain Services or Entity behaviors
|
|
61
|
+
- **What are the rules/constraints?** → Business Rules to document
|
|
62
|
+
- **What are the states/statuses?** → State machines to model
|
|
63
|
+
- **What external data is needed?** → Interfaces to define
|
|
64
|
+
|
|
65
|
+
For each new concept:
|
|
66
|
+
1. Check glossary — add if missing
|
|
67
|
+
2. Check if it already exists in models.md — extend if needed
|
|
68
|
+
3. If entirely new, add to the appropriate context's models.md
|
|
69
|
+
|
|
70
|
+
If foundational domain docs are missing, create them from templates before writing content:
|
|
71
|
+
- `dflow/specs/domain/glossary.md` → `templates/glossary.md`
|
|
72
|
+
- `dflow/specs/domain/{context}/models.md` → `templates/models.md`
|
|
73
|
+
- `dflow/specs/domain/{context}/rules.md` → `templates/rules.md`
|
|
74
|
+
- `dflow/specs/domain/{context}/behavior.md` → `templates/behavior.md` — at this step create only the skeleton + one section anchor per `BR-*`; the Given/When/Then scenarios are merged in later at Step 8.3 (finish-feature), not now
|
|
75
|
+
|
|
76
|
+
**→ Step Gate: Step 3 → Step 3.5**
|
|
77
|
+
|
|
78
|
+
Announce to developer:
|
|
79
|
+
> "Domain concepts captured. Before I create any files, let me confirm the SPEC-ID, slug, directory name, and branch name with you (Step 3.5). `/dflow:next` to proceed."
|
|
80
|
+
|
|
81
|
+
Wait for confirmation before entering Step 3.5.
|
|
82
|
+
|
|
83
|
+
## Step 3.5: Slug Confirmation
|
|
84
|
+
|
|
85
|
+
AI proposes the SPEC-ID, slug, feature directory path, and branch name in
|
|
86
|
+
one message and asks the developer to confirm before any directory or
|
|
87
|
+
branch is created. Slug follows the language of the discussion (中文 or
|
|
88
|
+
English — both are valid; see `references/git-integration.md` for the slug
|
|
89
|
+
language rule).
|
|
90
|
+
|
|
91
|
+
Before confirming, surface the path-encoding caveat: a non-ASCII (e.g. 中文)
|
|
92
|
+
slug yields non-ASCII feature-directory and branch paths. These work on common
|
|
93
|
+
Git hosts but a handful of CI runners / toolchains mishandle them. If the
|
|
94
|
+
project's pipeline is unknown, offer an ASCII slug as an alternative. See
|
|
95
|
+
`references/git-integration.md` for the full risk note.
|
|
96
|
+
|
|
97
|
+
Example (中文 discussion):
|
|
98
|
+
|
|
99
|
+
> 「依我們的討論:
|
|
100
|
+
> - SPEC-ID: `SPEC-20260424-001`
|
|
101
|
+
> - slug: `報表調整`(跟隨中文討論)
|
|
102
|
+
> - feature 目錄: `dflow/specs/features/active/SPEC-20260424-001-報表調整/`
|
|
103
|
+
> - git branch: `feature/SPEC-20260424-001-報表調整`
|
|
104
|
+
>
|
|
105
|
+
> 這樣可以嗎?或你想改 slug?」
|
|
106
|
+
|
|
107
|
+
Example (English discussion):
|
|
108
|
+
|
|
109
|
+
> "Per our discussion:
|
|
110
|
+
> - SPEC-ID: `SPEC-20260424-002`
|
|
111
|
+
> - slug: `jpy-currency-support` (English following our discussion)
|
|
112
|
+
> - feature directory: `dflow/specs/features/active/SPEC-20260424-002-jpy-currency-support/`
|
|
113
|
+
> - git branch: `feature/SPEC-20260424-002-jpy-currency-support`
|
|
114
|
+
>
|
|
115
|
+
> Sound good? Or would you prefer a different slug?"
|
|
116
|
+
|
|
117
|
+
Wait for explicit confirmation. The slug agreed here is reused for:
|
|
118
|
+
- The feature directory name
|
|
119
|
+
- The first phase-spec filename (`phase-spec-{date}-{slug}.md`)
|
|
120
|
+
- The git branch (Step 6)
|
|
121
|
+
|
|
122
|
+
If the developer asks to change the slug, re-propose and re-confirm.
|
|
123
|
+
|
|
124
|
+
**→ Transition (step-internal)**: Step 3.5 complete. Announce "Step 3.5 complete (slug confirmed). Entering Step 4: Write the Spec." and continue.
|
|
125
|
+
|
|
126
|
+
## Step 4: Write the Spec
|
|
127
|
+
|
|
128
|
+
Create the **feature directory** + **`_index.md`** + **first phase-spec**:
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
dflow/specs/features/active/{SPEC-ID}-{slug}/
|
|
132
|
+
├── _index.md
|
|
133
|
+
└── phase-spec-{YYYY-MM-DD}-{slug}.md
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
1. **Create the directory**: `dflow/specs/features/active/{SPEC-ID}-{slug}/`
|
|
137
|
+
2. **Create `_index.md`** using `templates/_index.md`:
|
|
138
|
+
- Metadata: fill `spec-id`, `slug`, `status: in-progress`, `created`, `branch`
|
|
139
|
+
- Goals & Scope: 1-3 sentences capturing what / for whom / boundary
|
|
140
|
+
- Phase Specs: one row for the first phase
|
|
141
|
+
(`| 1 | {date} | {slug} | in-progress | [phase-spec-{date}-{slug}.md](./phase-spec-{date}-{slug}.md) |`)
|
|
142
|
+
- Current BR Snapshot: initialise from the first phase's planned BRs
|
|
143
|
+
(will be refreshed when the phase-spec finalises)
|
|
144
|
+
- Lightweight Changes: empty table at start
|
|
145
|
+
- Resume Pointer: "phase-1 in progress: drafting phase-spec." / "Next Action: finish phase-spec, then implement."
|
|
146
|
+
3. **Create the first phase-spec** at `phase-spec-{YYYY-MM-DD}-{slug}.md`
|
|
147
|
+
using `templates/phase-spec.md`. The "Delta from prior phases" section
|
|
148
|
+
is filled with "首 phase,無前置 Delta" (first phase has nothing to
|
|
149
|
+
delta against).
|
|
150
|
+
|
|
151
|
+
Guide the developer through each section:
|
|
152
|
+
|
|
153
|
+
### Behavior Specification (Given/When/Then)
|
|
154
|
+
This is the most important part. Help the developer think through scenarios:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
"Let's walk through the main success scenario first.
|
|
158
|
+
Given [initial state], when the user [does action], then [what should happen]?"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Then probe for variations:
|
|
162
|
+
- "What if [input is invalid]?"
|
|
163
|
+
- "What if [related data doesn't exist]?"
|
|
164
|
+
- "What happens with [boundary values]?"
|
|
165
|
+
- "Are there permission/role requirements?"
|
|
166
|
+
|
|
167
|
+
### Business Rules
|
|
168
|
+
Extract explicit rules from the scenarios:
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
"From what you've described, I see these business rules:
|
|
172
|
+
BR-01: [rule]
|
|
173
|
+
BR-02: [rule]
|
|
174
|
+
Do these capture the logic correctly? Anything I'm missing?"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Edge Cases
|
|
178
|
+
Specifically ask about:
|
|
179
|
+
- Empty/null inputs
|
|
180
|
+
- Concurrent modifications
|
|
181
|
+
- Large data volumes
|
|
182
|
+
- Currency/decimal precision (if financial)
|
|
183
|
+
- Date/timezone boundaries
|
|
184
|
+
- Character encoding (CJK, special characters)
|
|
185
|
+
|
|
186
|
+
**→ Step Gate: Step 4 → Step 5**
|
|
187
|
+
|
|
188
|
+
Announce to developer:
|
|
189
|
+
> "Spec is drafted — behavior scenarios, business rules, and edge cases are captured. Ready to plan the implementation (Domain layer design, interfaces, thin delivery/entrypoint code — presentation/UI layer, controllers, handlers, jobs, message consumers, data pipelines, or stored procedures)? `/dflow:next` or reply 'OK' to continue, or tell me if the spec needs another iteration first."
|
|
190
|
+
|
|
191
|
+
Wait for confirmation (`/dflow:next`, verbal OK, or implicit — see SKILL.md § Confirmation Signals) before entering Step 5.
|
|
192
|
+
|
|
193
|
+
## Step 5: Plan the Implementation
|
|
194
|
+
|
|
195
|
+
### Domain Layer First
|
|
196
|
+
Identify what goes into `src/Domain/`:
|
|
197
|
+
|
|
198
|
+
```csharp
|
|
199
|
+
// Example guidance:
|
|
200
|
+
// "For this feature, I'd suggest:
|
|
201
|
+
// - A new Value Object: Money(Amount, Currency)
|
|
202
|
+
// - A new interface: IExchangeRateService
|
|
203
|
+
// - A Domain Service: ExpenseCalculationService
|
|
204
|
+
// All framework-pure, no delivery-framework dependencies."
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Delivery/Entrypoint Thin Layer
|
|
208
|
+
Plan how the current delivery/entrypoint layer will call the Domain layer:
|
|
209
|
+
|
|
210
|
+
```csharp
|
|
211
|
+
// Ideal delivery/entrypoint pattern:
|
|
212
|
+
protected void btnSubmit_Click(object sender, EventArgs e)
|
|
213
|
+
{
|
|
214
|
+
// 1. Parse UI inputs
|
|
215
|
+
var input = ParseFormInput();
|
|
216
|
+
|
|
217
|
+
// 2. Call Domain layer
|
|
218
|
+
var result = _domainService.Process(input);
|
|
219
|
+
|
|
220
|
+
// 3. Display result
|
|
221
|
+
BindResult(result);
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Interface Definitions
|
|
226
|
+
For any external dependency (database, API, file system), define an interface
|
|
227
|
+
in `src/Domain/{Context}/Interfaces/`:
|
|
228
|
+
|
|
229
|
+
```csharp
|
|
230
|
+
// src/Domain/Expense/Interfaces/IExpenseRepository.cs
|
|
231
|
+
public interface IExpenseRepository
|
|
232
|
+
{
|
|
233
|
+
ExpenseItem GetById(int id);
|
|
234
|
+
void Save(ExpenseItem item);
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Generate Implementation Tasks List
|
|
239
|
+
|
|
240
|
+
After the plan is agreed, AI generates a concrete task list and writes it into the spec's `Implementation Tasks` section (see `templates/phase-spec.md`). Each task follows the format `[LAYER]-[NUMBER]:description`:
|
|
241
|
+
|
|
242
|
+
- `DOMAIN` — Domain classes, VOs, Services, Interfaces
|
|
243
|
+
- `DELIVERY` — Delivery-layer code (entrypoints, controllers, handlers, UI/API adapters)
|
|
244
|
+
- `DATA` — Table schema or Repository impl
|
|
245
|
+
- `TEST` — Test cases
|
|
246
|
+
|
|
247
|
+
Example seed (replace with feature-specific tasks):
|
|
248
|
+
|
|
249
|
+
```markdown
|
|
250
|
+
- [ ] DOMAIN-1:Create Money value object with currency conversion
|
|
251
|
+
- [ ] DOMAIN-2:Define IExchangeRateService interface
|
|
252
|
+
- [ ] DELIVERY-1:Thin the relevant delivery/entrypoint code to call the domain service
|
|
253
|
+
- [ ] DATA-1:Add ExchangeRate table + Repository
|
|
254
|
+
- [ ] TEST-1:Money equality and conversion unit tests
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
The list becomes the execution punch-list for Step 7 and the completion checklist in Step 8.
|
|
258
|
+
|
|
259
|
+
**→ Transition (step-internal)**: Step 5 complete. Announce "Step 5 complete (implementation plan + task list ready). Entering Step 6: Git Branch." and continue.
|
|
260
|
+
|
|
261
|
+
## Step 6: Git Branch
|
|
262
|
+
|
|
263
|
+
After the spec is written and reviewed:
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
Branch naming: feature/{SPEC-ID}-{slug}
|
|
267
|
+
Examples:
|
|
268
|
+
feature/SPEC-20260424-002-jpy-currency-support (English slug)
|
|
269
|
+
feature/SPEC-20260424-001-報表調整 (Chinese slug)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
The slug **must match the slug agreed in Step 3.5** (which is also the
|
|
273
|
+
feature directory name). The SPEC-ID + slug links the branch to its
|
|
274
|
+
feature directory and `_index.md`.
|
|
275
|
+
|
|
276
|
+
**→ Step Gate: Step 6 → Step 7**
|
|
277
|
+
|
|
278
|
+
Announce to developer:
|
|
279
|
+
> "Branch `feature/{SPEC-ID}-{description}` is created. Ready to start implementation? `/dflow:next` to proceed, or discuss implementation order / scope first."
|
|
280
|
+
|
|
281
|
+
Wait for confirmation before entering Step 7.
|
|
282
|
+
|
|
283
|
+
## Step 7: Implementation
|
|
284
|
+
|
|
285
|
+
During implementation, continuously check:
|
|
286
|
+
- [ ] Is business logic going into src/Domain/ (not delivery/entrypoint code)?
|
|
287
|
+
- [ ] Are new terms in the glossary?
|
|
288
|
+
- [ ] Does delivery/entrypoint code only do input parsing, orchestration, and output binding?
|
|
289
|
+
- [ ] Are interfaces used for external dependencies?
|
|
290
|
+
- [ ] Did we discover any tech debt? → Record in tech-debt.md
|
|
291
|
+
|
|
292
|
+
**→ Step Gate: Step 7 → Step 8**
|
|
293
|
+
|
|
294
|
+
Announce to developer:
|
|
295
|
+
> "Implementation appears complete. Ready to run the completion checklist (verify against spec, update domain docs, archive the spec)? `/dflow:next` to proceed."
|
|
296
|
+
|
|
297
|
+
Wait for confirmation before entering Step 8. This step gate is where the completion checklist is triggered — do not skip.
|
|
298
|
+
|
|
299
|
+
## Step 8: Completion
|
|
300
|
+
|
|
301
|
+
Triggered by the Step 7 → Step 8 Step Gate. AI runs the completion checklist in the order below; do **not** skip a section.
|
|
302
|
+
|
|
303
|
+
### 8.1 Verification — AI runs independently
|
|
304
|
+
|
|
305
|
+
AI reports `✓` / `✗` for every item before touching docs. Items marked *(post-8.3)* are re-verified after the documentation merge in 8.3 lands:
|
|
306
|
+
|
|
307
|
+
- [ ] `Implementation Tasks` section: all tasks checked, or unchecked items explicitly labelled as follow-up (linked to spec / tech-debt entry)
|
|
308
|
+
- [ ] Every `Given/When/Then` scenario in the spec is covered by implementation or tests
|
|
309
|
+
- [ ] Every `BR-*` business rule is covered by implementation or tests
|
|
310
|
+
- [ ] Every `EC-*` edge case is handled
|
|
311
|
+
- [ ] Domain layer has **no** delivery-framework references (grep `src/Domain/`)
|
|
312
|
+
- [ ] *(post-8.3)* `dflow/specs/domain/{context}/behavior.md` contains a section anchor for every `BR-*` introduced by this spec (mechanical input for `/dflow:verify`)
|
|
313
|
+
- [ ] *(post-8.3)* `dflow/specs/domain/{context}/behavior.md` `last-updated` is later than this spec's `created` date (mechanical drift guard)
|
|
314
|
+
|
|
315
|
+
If any item fails, report the gap and pause — don't proceed to 8.2.
|
|
316
|
+
|
|
317
|
+
### 8.2 Verification — needs developer confirmation
|
|
318
|
+
|
|
319
|
+
AI lists findings one at a time and waits for the developer to confirm each:
|
|
320
|
+
|
|
321
|
+
- [ ] Does the implementation faithfully express the **intent** of each BR? (AI lists BR → impl location; developer judges fit)
|
|
322
|
+
- [ ] Are the edge case handling decisions appropriate? (AI lists EC → handling; developer judges)
|
|
323
|
+
- [ ] Did we miss any tech debt worth recording? (AI lists what it saw; developer adds misses)
|
|
324
|
+
- [ ] Do the scenarios merged into `behavior.md` faithfully express the intended behavior? (AI lists merged anchors; developer judges)
|
|
325
|
+
- [ ] Should the `Implementation Tasks` section in the spec be collapsed / removed now that it's complete? (team convention — developer decides)
|
|
326
|
+
|
|
327
|
+
Ask these one-by-one; do not dump all five at once.
|
|
328
|
+
|
|
329
|
+
### 8.3 Documentation updates
|
|
330
|
+
|
|
331
|
+
- [ ] `dflow/specs/domain/glossary.md` — new terms added
|
|
332
|
+
- [ ] `dflow/specs/domain/{context}/models.md` — model definitions updated
|
|
333
|
+
- [ ] `dflow/specs/domain/{context}/rules.md` — business rules updated
|
|
334
|
+
- [ ] `dflow/specs/domain/{context}/behavior.md` — merge completed spec's Given/When/Then scenarios into consolidated behavior. Sub-steps:
|
|
335
|
+
- Promote any Activity 3 (Spec Writing) draft sections (from B3 mid-sync) to formal sections
|
|
336
|
+
- Update the corresponding `rules.md` anchor's `last-updated` date (B4)
|
|
337
|
+
- [ ] `behavior.md` draft cleanup — if the spec was abandoned mid-way, keep the `## 提案中變更` section's history or explicitly REMOVE it
|
|
338
|
+
- [ ] `dflow/specs/migration/tech-debt.md` — tech debt discovered during implementation recorded
|
|
339
|
+
|
|
340
|
+
### 8.4 Archival
|
|
341
|
+
|
|
342
|
+
For a single-phase feature, this is the closeout point. For a multi-phase
|
|
343
|
+
feature, the developer typically reaches this point at the end of the
|
|
344
|
+
final phase — at which time `/dflow:finish-feature` is the recommended
|
|
345
|
+
trigger (it bundles steps 8.1 / 8.2 verification, BC sync, and archival
|
|
346
|
+
into one explicit ceremony). Either path is acceptable; pick the one
|
|
347
|
+
that matches the developer's habit.
|
|
348
|
+
|
|
349
|
+
- [ ] `_index.md` `status` field changed to `completed`
|
|
350
|
+
- [ ] All `phase-spec-*.md` files in the feature directory have `status:
|
|
351
|
+
completed` in their frontmatter
|
|
352
|
+
- [ ] **Whole feature directory** moved from `dflow/specs/features/active/`
|
|
353
|
+
to `dflow/specs/features/completed/` using `git mv` (preserves rename
|
|
354
|
+
tracking — see `references/git-integration.md` § "Directory Moves
|
|
355
|
+
Must Use git mv"):
|
|
356
|
+
```
|
|
357
|
+
git mv dflow/specs/features/active/{SPEC-ID}-{slug} \
|
|
358
|
+
dflow/specs/features/completed/{SPEC-ID}-{slug}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
> **Recommended path for multi-phase features**: instead of doing
|
|
362
|
+
> 8.1–8.4 manually at the end of every phase, run `/dflow:finish-feature`
|
|
363
|
+
> once the feature's last phase is complete. It executes the same checks
|
|
364
|
+
> + BC sync + `git mv` + emits an Integration Summary. See
|
|
365
|
+
> `references/finish-feature-flow.md`.
|
|
366
|
+
|
|
367
|
+
Only announce "feature complete" after 8.4 is done.
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# New Phase Workflow
|
|
2
|
+
|
|
3
|
+
Step-by-step guide for when a developer triggers `/dflow:new-phase` —
|
|
4
|
+
adding a new phase-spec to an **active** feature directory.
|
|
5
|
+
|
|
6
|
+
A phase-spec captures one full "Kickoff → Domain → Design → Build → Verify"
|
|
7
|
+
cycle. A feature can have N phase-specs over its lifetime; together they
|
|
8
|
+
build up the feature in iterations. The `_index.md` dashboard aggregates
|
|
9
|
+
their state.
|
|
10
|
+
|
|
11
|
+
**Distinction from `/dflow:new-feature`**: this command does NOT create a
|
|
12
|
+
branch and does NOT create a feature directory. Both must already exist
|
|
13
|
+
(produced by the original `/dflow:new-feature` invocation). This command
|
|
14
|
+
adds a new phase to an in-progress feature only.
|
|
15
|
+
|
|
16
|
+
**Step Gates** in this flow (stop-and-confirm before proceeding):
|
|
17
|
+
- Step 3 → Step 4 (phase scope confirmed → write the phase-spec)
|
|
18
|
+
- Step 4 → Step 5 (phase-spec drafted → refresh `_index.md`)
|
|
19
|
+
- Step 5 → Step 6 (`_index.md` refreshed → start implementation)
|
|
20
|
+
- Step 6 → Step 7 (implementation done → complete the phase)
|
|
21
|
+
|
|
22
|
+
All other step transitions are **step-internal**: announce "Step N complete,
|
|
23
|
+
entering Step N+1" and proceed without waiting. See SKILL.md § Workflow
|
|
24
|
+
Transparency for the full transparency protocol and confirmation signals.
|
|
25
|
+
|
|
26
|
+
## Step 1: Read Active Feature Context
|
|
27
|
+
|
|
28
|
+
Before producing any spec prose, read `dflow/specs/shared/_conventions.md`
|
|
29
|
+
and apply the `## Prose Language` setting. If the setting is missing or not
|
|
30
|
+
an explicit language tag, ask the developer to update `_conventions.md`
|
|
31
|
+
before continuing.
|
|
32
|
+
|
|
33
|
+
AI must locate the target feature and load its current state:
|
|
34
|
+
|
|
35
|
+
1. **Identify the target feature**
|
|
36
|
+
- If the developer is on a `feature/{SPEC-ID}-{slug}` branch → infer the
|
|
37
|
+
feature directory at `dflow/specs/features/active/{SPEC-ID}-{slug}/`
|
|
38
|
+
- Otherwise → ask the developer which feature this phase is for
|
|
39
|
+
|
|
40
|
+
2. **Refuse if the feature is in `completed/`**
|
|
41
|
+
|
|
42
|
+
`/dflow:new-phase` strictly applies to **active features only**. If the
|
|
43
|
+
target feature directory is found at `dflow/specs/features/completed/...`
|
|
44
|
+
instead of `dflow/specs/features/active/...`, refuse with:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
"Feature `{SPEC-ID}-{slug}` is in completed/ — completed features are
|
|
48
|
+
frozen history and cannot accept new phases.
|
|
49
|
+
|
|
50
|
+
If you need to extend this feature's behavior, run /dflow:modify-existing
|
|
51
|
+
and choose the 'follow-up' branch — that creates a new follow-up feature
|
|
52
|
+
with a fresh SPEC-ID and a `follow-up-of: {SPEC-ID}` link back to this
|
|
53
|
+
one."
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Do NOT offer to `git mv` the feature back to `active/` — that breaks the
|
|
57
|
+
completed = frozen-history semantic and produces confusing dir-rename
|
|
58
|
+
history. The follow-up path is the only correct route.
|
|
59
|
+
|
|
60
|
+
3. **Load context for the new phase**
|
|
61
|
+
- Read the feature's `_index.md` — Metadata, Goals & Scope, Phase Specs,
|
|
62
|
+
Current BR Snapshot, Resume Pointer
|
|
63
|
+
- Read the most recent phase-spec to understand where the prior phase
|
|
64
|
+
left off (its Business Rules and Delta-from-prior-phases sections in
|
|
65
|
+
particular)
|
|
66
|
+
|
|
67
|
+
Share what you found:
|
|
68
|
+
|
|
69
|
+
> "OK — `{SPEC-ID}-{slug}` has {N} prior phases. The most recent
|
|
70
|
+
> (phase-{N}) ended with {一句話 from Resume Pointer}. Current BR Snapshot has
|
|
71
|
+
> {count} active BRs. Ready to scope the new phase."
|
|
72
|
+
|
|
73
|
+
**→ Transition (step-internal)**: Step 1 complete. Announce "Step 1 complete (active feature context loaded). Entering Step 2: Confirm Phase Scope." and continue.
|
|
74
|
+
|
|
75
|
+
## Step 2: Confirm the Phase Scope
|
|
76
|
+
|
|
77
|
+
Walk the developer through what the new phase covers:
|
|
78
|
+
|
|
79
|
+
1. **What does this phase add or change?** Plain-language description.
|
|
80
|
+
2. **Which BRs are touched?** Compare against the current BR Snapshot. New
|
|
81
|
+
BRs (ADDED), changed BRs (MODIFIED), removed BRs (REMOVED), renamed
|
|
82
|
+
(RENAMED). Items not mentioned stay UNCHANGED implicitly.
|
|
83
|
+
3. **Any Domain concepts introduced or changed?** New Entities / Value
|
|
84
|
+
Objects / Services touching `src/Domain/{context}/`?
|
|
85
|
+
4. **Data structure impact?** New tables, columns, indices?
|
|
86
|
+
5. **Why now?** Priority — informs sequencing relative to other phases.
|
|
87
|
+
|
|
88
|
+
This is also the moment to ask: "Should this be its own follow-up feature
|
|
89
|
+
instead of a phase here?" — useful when the scope drift suggests a
|
|
90
|
+
separate concern.
|
|
91
|
+
|
|
92
|
+
**→ Transition (step-internal)**: Step 2 complete. Announce "Step 2 complete (phase scope agreed). Entering Step 3: Phase Slug Confirmation." and continue.
|
|
93
|
+
|
|
94
|
+
## Step 3: Phase Slug Confirmation
|
|
95
|
+
|
|
96
|
+
AI proposes the new phase-spec filename and asks the developer to confirm
|
|
97
|
+
before any file is written.
|
|
98
|
+
|
|
99
|
+
> "Proposed phase-spec for `{SPEC-ID}-{slug}`:
|
|
100
|
+
>
|
|
101
|
+
> phase-spec-{YYYY-MM-DD}-{phase-slug}.md
|
|
102
|
+
>
|
|
103
|
+
> Phase slug follows our discussion language (中文/英文皆可). Do you want
|
|
104
|
+
> to keep `{phase-slug}`, or use a different slug?"
|
|
105
|
+
|
|
106
|
+
Slug rules (matches the feature-level slug rule):
|
|
107
|
+
- Follows the language the developer / AI discuss the phase in (no forced
|
|
108
|
+
translation)
|
|
109
|
+
- Keep it short (2–4 words / 2–6 中文字)
|
|
110
|
+
- Avoid characters that would break filesystems on the developer's
|
|
111
|
+
platform (slashes, colons, etc.)
|
|
112
|
+
|
|
113
|
+
Wait for the developer to confirm before proceeding.
|
|
114
|
+
|
|
115
|
+
**→ Step Gate: Step 3 → Step 4**
|
|
116
|
+
|
|
117
|
+
Announce to developer:
|
|
118
|
+
> "Phase slug confirmed as `{phase-slug}`. Ready to draft the phase-spec
|
|
119
|
+
> (`phase-spec-{date}-{phase-slug}.md`) — I'll cover problem / domain
|
|
120
|
+
> concepts / behavior / business rules / Delta-from-prior-phases / edge
|
|
121
|
+
> cases / implementation plan? `/dflow:next` to proceed, or adjust the
|
|
122
|
+
> scope first."
|
|
123
|
+
|
|
124
|
+
Wait for confirmation before entering Step 4.
|
|
125
|
+
|
|
126
|
+
## Step 4: Write the Phase Spec
|
|
127
|
+
|
|
128
|
+
Create the file at:
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
dflow/specs/features/active/{SPEC-ID}-{slug}/phase-spec-{YYYY-MM-DD}-{phase-slug}.md
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Use the `templates/phase-spec.md` template and set the phase-spec
|
|
135
|
+
frontmatter `status` to `in-progress`. Phase-2-onward specs **must** fill
|
|
136
|
+
in the **Delta from prior phases** section (the first phase typically has
|
|
137
|
+
just "首 phase,無前置 Delta"; this is phase 2+, so the section is required).
|
|
138
|
+
|
|
139
|
+
Walk the developer through each section, in the same way `new-feature-flow`
|
|
140
|
+
Step 4 does — Behavior / Business Rules / Delta / Edge Cases — but only
|
|
141
|
+
list NEW or MODIFIED BRs in Business Rules; UNCHANGED BRs from prior phases stay
|
|
142
|
+
in the Current BR Snapshot table on `_index.md` and are NOT re-copied
|
|
143
|
+
here. The Delta section uses the same ADDED / MODIFIED / REMOVED / RENAMED
|
|
144
|
+
+ optional UNCHANGED format defined in `references/modify-existing-flow.md`.
|
|
145
|
+
|
|
146
|
+
After the spec body is drafted, generate the `Implementation Tasks` section
|
|
147
|
+
(format `[LAYER]-[NUMBER]:description` with Brownfield layer tags
|
|
148
|
+
DOMAIN / DELIVERY / DATA / TEST. `DELIVERY` covers delivery/entrypoint code:
|
|
149
|
+
presentation/UI layer, controllers, handlers, jobs, message consumers, data
|
|
150
|
+
pipelines, or stored procedures. See `new-feature-flow.md` Step 5 for the
|
|
151
|
+
detailed list).
|
|
152
|
+
|
|
153
|
+
**→ Step Gate: Step 4 → Step 5**
|
|
154
|
+
|
|
155
|
+
Announce to developer:
|
|
156
|
+
> "Phase-spec drafted at
|
|
157
|
+
> `dflow/specs/features/active/{SPEC-ID}-{slug}/phase-spec-{date}-{phase-slug}.md`.
|
|
158
|
+
> Ready to refresh `_index.md` (add Phase Specs row, regenerate Current BR
|
|
159
|
+
> Snapshot from the Delta)? `/dflow:next` to proceed."
|
|
160
|
+
|
|
161
|
+
Wait for confirmation before entering Step 5.
|
|
162
|
+
|
|
163
|
+
## Step 5: Refresh `_index.md`
|
|
164
|
+
|
|
165
|
+
Update the feature's `_index.md`:
|
|
166
|
+
|
|
167
|
+
1. **Phase Specs table** — add a new row for this phase:
|
|
168
|
+
```
|
|
169
|
+
| {N+1} | {YYYY-MM-DD} | {phase-slug} | in-progress | [phase-spec-{date}-{phase-slug}.md](./phase-spec-{date}-{phase-slug}.md) |
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
2. **Current BR Snapshot table** — regenerate to reflect the new phase's
|
|
173
|
+
Delta:
|
|
174
|
+
- **ADDED** entries → new rows (First Seen = `phase-{N+1}`, Last Updated =
|
|
175
|
+
`phase-{N+1}`, Status = `active`)
|
|
176
|
+
- **MODIFIED** entries → update Current Rule + bump Last Updated to `phase-{N+1}`
|
|
177
|
+
- **REMOVED** entries → flip Status to `removed`, bump Last Updated to
|
|
178
|
+
`phase-{N+1}` (do NOT delete the row — keep the audit trail)
|
|
179
|
+
- **RENAMED** entries → update BR-ID / Current Rule as appropriate; bump
|
|
180
|
+
Last Updated
|
|
181
|
+
|
|
182
|
+
3. **Resume Pointer** — update to "phase-{N+1} in progress:
|
|
183
|
+
{one-line about what's actively being worked on}" and "Next Action:
|
|
184
|
+
implement DOMAIN-1 / write spec for ... / etc."
|
|
185
|
+
|
|
186
|
+
The Snapshot is the feature-level CURRENT STATE, not history. Do not let
|
|
187
|
+
it grow into a cumulative log; the per-phase Delta sections are the
|
|
188
|
+
historical audit trail.
|
|
189
|
+
|
|
190
|
+
After the refresh, summarize for the developer:
|
|
191
|
+
> "Phase-spec ready, `_index.md` refreshed. Snapshot now shows
|
|
192
|
+
> {n_active} active BRs ({n_added} added in this phase, {n_modified}
|
|
193
|
+
> modified, {n_removed} removed). Ready to enter Step 6 —
|
|
194
|
+
> follow the phase-spec's Implementation Tasks list? `/dflow:next` to proceed,
|
|
195
|
+
> or adjust the plan first."
|
|
196
|
+
|
|
197
|
+
**→ Step Gate: Step 5 → Step 6**
|
|
198
|
+
|
|
199
|
+
Wait for confirmation before entering Step 6.
|
|
200
|
+
|
|
201
|
+
## Step 6: Implement and Verify the Phase
|
|
202
|
+
|
|
203
|
+
Follow the phase-spec's `Implementation Tasks` using the Brownfield layer tags:
|
|
204
|
+
DOMAIN / DELIVERY / DATA / TEST.
|
|
205
|
+
|
|
206
|
+
During implementation, continuously verify:
|
|
207
|
+
|
|
208
|
+
- [ ] `Implementation Tasks` are checked off as they complete, or unchecked
|
|
209
|
+
items are explicitly labelled as follow-up
|
|
210
|
+
- [ ] Every ADDED / MODIFIED / REMOVED / RENAMED Delta entry is covered by
|
|
211
|
+
implementation or tests
|
|
212
|
+
- [ ] Every affected `BR-*` business rule is covered by implementation or tests
|
|
213
|
+
- [ ] Every affected Given/When/Then scenario is covered by implementation or tests
|
|
214
|
+
- [ ] Business logic stays in `src/Domain/`, not delivery/entrypoint code
|
|
215
|
+
- [ ] Delivery/entrypoint code remains input parsing, orchestration, and output binding only
|
|
216
|
+
- [ ] Domain code has no delivery-framework dependency
|
|
217
|
+
- [ ] Data access changes do not introduce business rules into infrastructure
|
|
218
|
+
- [ ] Test failures have been resolved or explicitly recorded as follow-up
|
|
219
|
+
|
|
220
|
+
If implementation changes the agreed Delta, update the phase-spec before
|
|
221
|
+
continuing. Do not let code and spec diverge silently.
|
|
222
|
+
|
|
223
|
+
**→ Step Gate: Step 6 → Step 7**
|
|
224
|
+
|
|
225
|
+
Announce to developer:
|
|
226
|
+
> "Phase implementation appears complete and verified against the phase-spec.
|
|
227
|
+
> Ready to mark this phase completed and update `_index.md`? `/dflow:next`
|
|
228
|
+
> to proceed."
|
|
229
|
+
|
|
230
|
+
Wait for confirmation before entering Step 7.
|
|
231
|
+
|
|
232
|
+
## Step 7: Complete the Phase
|
|
233
|
+
|
|
234
|
+
Update the feature artifacts:
|
|
235
|
+
|
|
236
|
+
1. **Phase spec status** — change this phase-spec's frontmatter `status`
|
|
237
|
+
from `in-progress` to `completed`.
|
|
238
|
+
2. **Implementation Tasks** — keep completed tasks checked. If any task is not
|
|
239
|
+
done, mark it explicitly as follow-up and link to the relevant future
|
|
240
|
+
phase, issue, or migration debt entry.
|
|
241
|
+
3. **Phase Specs table** — update this phase's `_index.md` row from
|
|
242
|
+
`in-progress` to `completed`.
|
|
243
|
+
4. **Current BR Snapshot** — reconcile the snapshot against the implemented
|
|
244
|
+
Delta. If implementation changed the Delta, update the phase-spec first,
|
|
245
|
+
then regenerate the snapshot.
|
|
246
|
+
5. **Resume Pointer** — update to one of:
|
|
247
|
+
- "phase-{N+1} completed; next action: run `/dflow:new-phase` for the next
|
|
248
|
+
slice"
|
|
249
|
+
- "phase-{N+1} completed; next action: run `/dflow:finish-feature` if the
|
|
250
|
+
feature is ready to wrap up"
|
|
251
|
+
|
|
252
|
+
System-level domain docs, migration debt sync, and the feature directory move
|
|
253
|
+
to `completed/` remain `/dflow:finish-feature` responsibilities. Do not sync
|
|
254
|
+
system-level current state or archive the whole feature from `/dflow:new-phase`.
|
|
255
|
+
|
|
256
|
+
After completion, summarize for the developer:
|
|
257
|
+
> "Phase {N+1} is implemented and marked completed. `_index.md` is refreshed.
|
|
258
|
+
> If another slice is needed, run `/dflow:new-phase`; if the feature is done,
|
|
259
|
+
> run `/dflow:finish-feature`."
|