dflow-sdd-ddd 0.1.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/LICENSE +21 -0
- package/README.md +209 -0
- package/bin/dflow.js +72 -0
- package/lib/init.js +1206 -0
- package/package.json +42 -0
- package/templates/core/scaffolding/CLAUDE-md-snippet.md +168 -0
- package/templates/core/scaffolding/Git-principles-gitflow.md +350 -0
- package/templates/core/scaffolding/Git-principles-trunk.md +375 -0
- package/templates/core/scaffolding/_conventions.md +175 -0
- package/templates/core/scaffolding/_overview.md +165 -0
- package/templates/core/scaffolding/architecture-decisions-README.md +34 -0
- package/templates/core/templates/CLAUDE.md +172 -0
- package/templates/core/templates/_index.md +118 -0
- package/templates/core/templates/aggregate-design.md +58 -0
- package/templates/core/templates/behavior.md +62 -0
- package/templates/core/templates/context-definition.md +64 -0
- package/templates/core/templates/context-map.md +25 -0
- package/templates/core/templates/events.md +19 -0
- package/templates/core/templates/glossary.md +15 -0
- package/templates/core/templates/lightweight-spec.md +82 -0
- package/templates/core/templates/models.md +47 -0
- package/templates/core/templates/phase-spec.md +195 -0
- package/templates/core/templates/rules.md +24 -0
- package/templates/core/templates/tech-debt.md +15 -0
- package/templates/webforms/scaffolding/CLAUDE-md-snippet.md +167 -0
- package/templates/webforms/scaffolding/Git-principles-gitflow.md +333 -0
- package/templates/webforms/scaffolding/Git-principles-trunk.md +316 -0
- package/templates/webforms/scaffolding/_conventions.md +139 -0
- package/templates/webforms/scaffolding/_overview.md +109 -0
- package/templates/webforms/templates/CLAUDE.md +157 -0
- package/templates/webforms/templates/_index.md +110 -0
- package/templates/webforms/templates/behavior.md +58 -0
- package/templates/webforms/templates/context-definition.md +57 -0
- package/templates/webforms/templates/context-map.md +25 -0
- package/templates/webforms/templates/glossary.md +15 -0
- package/templates/webforms/templates/lightweight-spec.md +82 -0
- package/templates/webforms/templates/models.md +39 -0
- package/templates/webforms/templates/phase-spec.md +187 -0
- package/templates/webforms/templates/rules.md +24 -0
- package/templates/webforms/templates/tech-debt.md +15 -0
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
<!-- Scaffolding template maintained alongside Dflow skill. See proposals/PROPOSAL-010 for origin. -->
|
|
2
|
+
|
|
3
|
+
# Git Principles — Trunk-based / GitHub Flow edition
|
|
4
|
+
|
|
5
|
+
> Created: {YYYY-MM-DD}
|
|
6
|
+
> Scope: project Git conventions. This project adopts a **single-`main`
|
|
7
|
+
> trunk-based / GitHub Flow** branching strategy.
|
|
8
|
+
> Audience: engineers + AI assistants performing Git operations.
|
|
9
|
+
|
|
10
|
+
Dflow itself is branching-strategy-neutral — it only requires the
|
|
11
|
+
feature-branch-per-feature convention (see the Dflow skill's
|
|
12
|
+
`references/git-integration.md`). This file records the trunk-based
|
|
13
|
+
conventions chosen by this project.
|
|
14
|
+
|
|
15
|
+
If your project adopts Git Flow (develop / release / hotfix branches),
|
|
16
|
+
use `Git-principles-gitflow.md` instead.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 1. Branch Structure
|
|
21
|
+
|
|
22
|
+
Single-trunk model:
|
|
23
|
+
|
|
24
|
+
| Branch | Naming | Cut from | Merges to |
|
|
25
|
+
|--------|--------|----------|-----------|
|
|
26
|
+
| `main` | `main` | — | — (protected; feature branches merge in) |
|
|
27
|
+
| feature | `feature/{SPEC-ID}-{slug}` | `main` | `main` |
|
|
28
|
+
|
|
29
|
+
No `develop`, no `release/*`, no `hotfix/*` branches. Hotfixes are just
|
|
30
|
+
small, fast feature branches cut from `main`.
|
|
31
|
+
|
|
32
|
+
The `feature/{SPEC-ID}-{slug}` pattern is a **Dflow requirement** (not
|
|
33
|
+
a trunk-based requirement). It ties each feature branch to its
|
|
34
|
+
corresponding `dflow/specs/features/active/{SPEC-ID}-{slug}/` directory.
|
|
35
|
+
|
|
36
|
+
### Feature Branch Workflow
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# 1. Start from latest main
|
|
40
|
+
git checkout main
|
|
41
|
+
git pull origin main
|
|
42
|
+
git checkout -b feature/{SPEC-ID}-{slug}
|
|
43
|
+
|
|
44
|
+
# 2. Stay in sync with main during development (rebase preferred)
|
|
45
|
+
git fetch origin
|
|
46
|
+
git rebase origin/main
|
|
47
|
+
|
|
48
|
+
# 3. Commit as you go (see § 2 below)
|
|
49
|
+
git add .
|
|
50
|
+
git commit -m "[{SPEC-ID}] {short description}"
|
|
51
|
+
|
|
52
|
+
# 4. Push + open PR
|
|
53
|
+
git push -u origin feature/{SPEC-ID}-{slug}
|
|
54
|
+
gh pr create --base main --fill
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Key trunk-based practices
|
|
58
|
+
|
|
59
|
+
- **Short-lived feature branches**: typically hours to a few days, not
|
|
60
|
+
weeks. Encourage splitting large features into multiple phase-specs
|
|
61
|
+
and merging each phase to `main` (see Dflow's Ceremony Scaling +
|
|
62
|
+
`/dflow:new-phase`)
|
|
63
|
+
- **Main is always releasable**: feature flags or dark launches for
|
|
64
|
+
incomplete functionality; CI must be green on `main` at all times
|
|
65
|
+
- **Rebase, don't merge, during development**: keep history linear on
|
|
66
|
+
the feature branch by rebasing against `main`; use squash / rebase
|
|
67
|
+
merge (not `--no-ff`) when merging into `main`
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 2. Commit Message Format
|
|
72
|
+
|
|
73
|
+
Commits must tie back to a SPEC-ID. Conventional Commits style is
|
|
74
|
+
recommended but not strictly required:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
{type}({scope}): {short description}
|
|
78
|
+
|
|
79
|
+
[{SPEC-ID}] {longer description, optional}
|
|
80
|
+
|
|
81
|
+
Co-Authored-By: Claude <noreply@anthropic.com> ← suggested, not mandatory
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Type prefix (Conventional Commits)
|
|
85
|
+
|
|
86
|
+
| Type | Meaning |
|
|
87
|
+
|------|---------|
|
|
88
|
+
| feat | new feature |
|
|
89
|
+
| fix | bug fix |
|
|
90
|
+
| refactor | internal refactor (no behavior change) |
|
|
91
|
+
| docs | documentation only |
|
|
92
|
+
| style | formatting only |
|
|
93
|
+
| test | tests only |
|
|
94
|
+
| chore | build / tooling |
|
|
95
|
+
|
|
96
|
+
### Scope (optional)
|
|
97
|
+
|
|
98
|
+
Scope is typically a bounded context or module name, e.g.
|
|
99
|
+
`feat(expense): introduce ExpenseReport submission invariants`.
|
|
100
|
+
|
|
101
|
+
### Example
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
feat(expense): add ExpenseReport submission invariants
|
|
105
|
+
|
|
106
|
+
[SPEC-20260421-001] Introduce ExpenseReport Aggregate with submission
|
|
107
|
+
state machine; enforces non-negative Amounts and requires at least one
|
|
108
|
+
ExpenseItem before submission.
|
|
109
|
+
|
|
110
|
+
Co-Authored-By: Claude <noreply@anthropic.com>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## 3. Merge Strategy Options
|
|
116
|
+
|
|
117
|
+
Trunk-based projects typically pick **one** of the three below as the
|
|
118
|
+
default. Document which one your team uses:
|
|
119
|
+
|
|
120
|
+
### Option A — Squash merge (most common)
|
|
121
|
+
|
|
122
|
+
All commits on the feature branch are squashed into a single commit on
|
|
123
|
+
`main`. Clean history; each feature is one commit.
|
|
124
|
+
|
|
125
|
+
- Pro: Linear, easy-to-read history
|
|
126
|
+
- Pro: Cherry-picks and reverts are trivial
|
|
127
|
+
- Con: Loses intermediate commit context (though it's still available
|
|
128
|
+
via the PR)
|
|
129
|
+
|
|
130
|
+
**This project uses**: {Yes / No / Default — fill in}
|
|
131
|
+
|
|
132
|
+
### Option B — Rebase merge
|
|
133
|
+
|
|
134
|
+
Each commit on the feature branch is rebased onto `main` as-is. Linear
|
|
135
|
+
history, but more commits than squash.
|
|
136
|
+
|
|
137
|
+
- Pro: Preserves commit-by-commit history
|
|
138
|
+
- Pro: Each phase-spec can map to its own commit (trace SPEC-ID by
|
|
139
|
+
phase)
|
|
140
|
+
- Con: Noisier history
|
|
141
|
+
|
|
142
|
+
**This project uses**: {Yes / No / Default — fill in}
|
|
143
|
+
|
|
144
|
+
### Option C — Fast-forward only
|
|
145
|
+
|
|
146
|
+
Only merges when the feature branch is a direct descendant of `main`.
|
|
147
|
+
Equivalent to rebase merge when used consistently.
|
|
148
|
+
|
|
149
|
+
- Pro: Perfectly linear
|
|
150
|
+
- Con: Requires strict rebase discipline; can be inconvenient
|
|
151
|
+
|
|
152
|
+
**This project uses**: {Yes / No / Default — fill in}
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## 4. Integration Commit Message Conventions
|
|
157
|
+
|
|
158
|
+
`/dflow:finish-feature` emits a **Git-strategy-neutral Integration
|
|
159
|
+
Summary** (see `references/finish-feature-flow.md` in the Dflow skill).
|
|
160
|
+
This section specifies how to turn that Summary into the actual
|
|
161
|
+
commit message under each trunk-based merge style.
|
|
162
|
+
|
|
163
|
+
### 4.1 Squash merge commit format
|
|
164
|
+
|
|
165
|
+
When squash-merging, the single resulting commit should look like this:
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
feat({scope}): {title from Integration Summary}
|
|
169
|
+
|
|
170
|
+
{Feature Goal block, copied from Integration Summary}
|
|
171
|
+
|
|
172
|
+
Change Scope:
|
|
173
|
+
- BC: {context-name}
|
|
174
|
+
- Aggregate(s) touched: {Aggregate names}
|
|
175
|
+
- Phase Count: {N}
|
|
176
|
+
- Lightweight Changes: {n_t2} T2 + {n_t3} T3
|
|
177
|
+
|
|
178
|
+
Related BR-IDs:
|
|
179
|
+
- ADDED: BR-NN, BR-NN
|
|
180
|
+
- MODIFIED: BR-NN
|
|
181
|
+
- REMOVED: (none)
|
|
182
|
+
|
|
183
|
+
Domain Events introduced / modified: {Event names, or "(none)"}
|
|
184
|
+
|
|
185
|
+
Related SPEC-IDs: {SPEC-ID}{, follow-up SPEC-IDs if any}
|
|
186
|
+
Co-Authored-By: Claude <noreply@anthropic.com>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
GitHub PR editor can be pre-filled with this body; the merge button
|
|
190
|
+
then produces the squash commit.
|
|
191
|
+
|
|
192
|
+
### 4.2 Rebase merge (per-commit, multi-phase feature)
|
|
193
|
+
|
|
194
|
+
If the feature has N phase-specs, you can produce N commits (one per
|
|
195
|
+
phase) on `main`:
|
|
196
|
+
|
|
197
|
+
- Each commit retains its original `[{SPEC-ID}][Phase-N]` prefix from
|
|
198
|
+
development
|
|
199
|
+
- **The last commit** of the rebased chain should carry the Integration
|
|
200
|
+
Summary as its extended body, so a reader scanning the last commit
|
|
201
|
+
sees the feature-level summary:
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
feat({scope}): {Phase N title} — closes {SPEC-ID}
|
|
205
|
+
|
|
206
|
+
[{SPEC-ID}][Phase-N] {phase-level description}
|
|
207
|
+
|
|
208
|
+
--- Feature integration summary ---
|
|
209
|
+
{Feature Goal block}
|
|
210
|
+
Change Scope: ... (as in §4.1)
|
|
211
|
+
Related BR-IDs: ...
|
|
212
|
+
Domain Events: ...
|
|
213
|
+
|
|
214
|
+
Co-Authored-By: Claude <noreply@anthropic.com>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### 4.3 Fast-forward (feature has 1 commit total)
|
|
218
|
+
|
|
219
|
+
For trivial features consisting of a single commit (often a T3
|
|
220
|
+
triaged later to one small refactor / fix), the commit body itself
|
|
221
|
+
IS the integration message — use the §4.1 format.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## 5. Gate Checks
|
|
226
|
+
|
|
227
|
+
Before making key Git operations:
|
|
228
|
+
|
|
229
|
+
### Before `git commit`
|
|
230
|
+
|
|
231
|
+
- [ ] If the change corresponds to a phase-spec, that phase-spec's
|
|
232
|
+
`Implementation Tasks` section items are checked (or remaining items have
|
|
233
|
+
justification in the spec's notes section)
|
|
234
|
+
- [ ] `_index.md` status reflects the current work (Phase Specs row
|
|
235
|
+
updated, `Resume Pointer` refreshed if the commit reaches a meaningful
|
|
236
|
+
checkpoint)
|
|
237
|
+
- [ ] Clean Architecture layer rules hold (Domain has no external
|
|
238
|
+
package deps, no business logic leaked into handlers /
|
|
239
|
+
controllers)
|
|
240
|
+
|
|
241
|
+
### Before merging a feature branch to `main` (opening / merging the PR)
|
|
242
|
+
|
|
243
|
+
- [ ] `/dflow:finish-feature` has run (or the equivalent Step 8.4
|
|
244
|
+
manual archival is complete)
|
|
245
|
+
- [ ] `_index.md` status = `completed`, feature directory moved to
|
|
246
|
+
`dflow/specs/features/completed/` via `git mv`
|
|
247
|
+
- [ ] BC layer synced: `dflow/specs/domain/{context}/rules.md`,
|
|
248
|
+
`behavior.md`, `events.md`, and (if cross-context)
|
|
249
|
+
`context-map.md` reflect the feature's net changes
|
|
250
|
+
- [ ] `dflow/specs/domain/glossary.md` updated with any new terms
|
|
251
|
+
- [ ] `dflow/specs/architecture/tech-debt.md` updated with any debt discovered
|
|
252
|
+
- [ ] Domain project has zero external NuGet dependencies
|
|
253
|
+
- [ ] No ORM / serialization attributes on Domain entities
|
|
254
|
+
- [ ] Domain unit tests pass (invariants + value object equality)
|
|
255
|
+
- [ ] CI is green (all required checks passing)
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## 6. AI Collaboration Rules (Project Policy)
|
|
260
|
+
|
|
261
|
+
Three categories:
|
|
262
|
+
|
|
263
|
+
### Must-confirm operations (AI asks before running)
|
|
264
|
+
|
|
265
|
+
| Operation | Why |
|
|
266
|
+
|-----------|-----|
|
|
267
|
+
| `git commit` | Stage needs human review |
|
|
268
|
+
| `git push` | Publishing to shared remote |
|
|
269
|
+
| `gh pr merge` (squash / rebase) | Shared-branch impact |
|
|
270
|
+
| Any `git rebase` that rewrites shared history | Force-push risk |
|
|
271
|
+
|
|
272
|
+
### Forbidden operations
|
|
273
|
+
|
|
274
|
+
| Operation | Reason |
|
|
275
|
+
|-----------|--------|
|
|
276
|
+
| `git push -f` to `main` | Overwrites other people's work |
|
|
277
|
+
| `git reset --hard` to a remote branch | Irreversible |
|
|
278
|
+
| `git commit --amend` on a pushed commit | Rewrites public history |
|
|
279
|
+
| Deleting `main` | Protected branch |
|
|
280
|
+
|
|
281
|
+
### Allowed without asking
|
|
282
|
+
|
|
283
|
+
| Operation |
|
|
284
|
+
|-----------|
|
|
285
|
+
| `git status` / `git diff` / `git log` / `git show` |
|
|
286
|
+
| `git fetch` (no merge) |
|
|
287
|
+
| `git stash` (local-only) |
|
|
288
|
+
| `git branch` (listing only) |
|
|
289
|
+
| `gh pr status` / `gh pr view` |
|
|
290
|
+
|
|
291
|
+
### AI commit authorship (suggested, not enforced)
|
|
292
|
+
|
|
293
|
+
When an AI assists in producing a commit, appending a `Co-Authored-By`
|
|
294
|
+
line is **suggested** but not mandatory. The canonical form for
|
|
295
|
+
Claude is:
|
|
296
|
+
|
|
297
|
+
```
|
|
298
|
+
Co-Authored-By: Claude <noreply@anthropic.com>
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
For other AI assistants, use the vendor-documented author line (or omit
|
|
302
|
+
it). This is a project-level transparency convention, not a Dflow
|
|
303
|
+
requirement.
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## 7. Hotfixes under Trunk-based
|
|
308
|
+
|
|
309
|
+
There is no separate `hotfix/*` branch. A hotfix is:
|
|
310
|
+
|
|
311
|
+
1. A (small) feature branch cut from `main`
|
|
312
|
+
2. Named `feature/{SPEC-ID}-{slug}` where SPEC-ID is a lightweight spec
|
|
313
|
+
or a full-ceremony spec depending on severity
|
|
314
|
+
3. Merged back to `main` via the team's chosen merge strategy
|
|
315
|
+
4. Deployed via the same pipeline as any other change
|
|
316
|
+
|
|
317
|
+
**Hotfix spec requirement (team convention)**: Hotfixes often skip the
|
|
318
|
+
upfront SDD cycle for speed. This project commits to writing a
|
|
319
|
+
lightweight spec within **24 hours** after the hotfix lands, documenting
|
|
320
|
+
root cause + fix + (if applicable) a tech-debt entry in
|
|
321
|
+
`dflow/specs/architecture/tech-debt.md` if the bug reveals a systemic issue.
|
|
322
|
+
This is a **human-to-human commitment** — Dflow / AI cannot track the
|
|
323
|
+
24-hour clock; the team enforces it in retros.
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## 8. Release & Versioning
|
|
328
|
+
|
|
329
|
+
Trunk-based does not impose a release branch. Two common patterns:
|
|
330
|
+
|
|
331
|
+
### Pattern A — Tag-based release (recommended)
|
|
332
|
+
|
|
333
|
+
Each deploy-worthy state of `main` is tagged:
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
git tag -a v{major}.{minor}.{patch} -m "{release summary}"
|
|
337
|
+
git push origin --tags
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Pattern B — Release branches (only if regulatory / LTS needs)
|
|
341
|
+
|
|
342
|
+
Cut `release/{version}` from `main` only when you must maintain an
|
|
343
|
+
older version. Use sparingly; avoid if possible.
|
|
344
|
+
|
|
345
|
+
### `CHANGELOG.md`
|
|
346
|
+
|
|
347
|
+
Detailed version history lives in `CHANGELOG.md` at the repo root. One
|
|
348
|
+
section per release tag; link back to the SPEC-IDs included in that
|
|
349
|
+
release.
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## 9. CI / CD
|
|
354
|
+
|
|
355
|
+
{Fill in this project's CI/CD pipeline shape: trigger (push to main,
|
|
356
|
+
tag), stages (build → test → deploy), environments
|
|
357
|
+
(dev / staging / prod). Reference the pipeline config file if one
|
|
358
|
+
exists, e.g. `.github/workflows/ci.yml` or `azure-pipelines.yml`.}
|
|
359
|
+
|
|
360
|
+
### Suggested CI gates for Clean Architecture
|
|
361
|
+
|
|
362
|
+
- Verify Domain project has zero (or allow-listed) NuGet deps
|
|
363
|
+
- Run Domain unit tests + Application tests on every PR
|
|
364
|
+
- Run Integration tests on `main` and pre-deploy
|
|
365
|
+
- Verify EF migrations build cleanly
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
## Related Documents
|
|
370
|
+
|
|
371
|
+
- `references/git-integration.md` in the Dflow skill — canonical
|
|
372
|
+
source for feature-branch-per-feature, `git mv` mandate, Gate Checks
|
|
373
|
+
- [System overview](_overview.md)
|
|
374
|
+
- [Spec conventions](_conventions.md)
|
|
375
|
+
- `CHANGELOG.md` at repo root
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
<!-- Scaffolding template maintained alongside Dflow skill. See proposals/PROPOSAL-010 for origin. -->
|
|
2
|
+
|
|
3
|
+
# Spec Writing Conventions — {System Name}
|
|
4
|
+
|
|
5
|
+
> Created: {YYYY-MM-DD}
|
|
6
|
+
> Scope: how spec documents are authored and named in this project.
|
|
7
|
+
> Audience: engineers writing specs; AI assistants producing spec drafts.
|
|
8
|
+
|
|
9
|
+
This file captures **project-level** conventions only. Template shapes
|
|
10
|
+
and Ceremony criteria are defined by the Dflow skill; here we just
|
|
11
|
+
record how *this* project fills them in.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Where Specs Live
|
|
16
|
+
|
|
17
|
+
All spec documents live under `dflow/specs/`. The feature directory pattern
|
|
18
|
+
and file names follow Dflow (see the Dflow skill § "Project Structure"
|
|
19
|
+
for the full tree):
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
dflow/specs/features/active/{SPEC-ID}-{slug}/
|
|
23
|
+
├── _index.md # Feature dashboard
|
|
24
|
+
├── phase-spec-{YYYY-MM-DD}-{slug}.md # T1 Heavy (one per phase)
|
|
25
|
+
└── lightweight-{YYYY-MM-DD}-{slug}.md # T2 Light (or BUG-{NUMBER}-{slug}.md)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
T3 Trivial changes do **not** produce a separate file — they are
|
|
29
|
+
recorded as one row in `_index.md` Lightweight Changes.
|
|
30
|
+
|
|
31
|
+
## Prose Language
|
|
32
|
+
|
|
33
|
+
Project prose language: `{prose-language}`
|
|
34
|
+
|
|
35
|
+
Dflow templates keep canonical English structural language: headings,
|
|
36
|
+
table headers, fixed labels, placeholders, IDs, anchors, and code-facing
|
|
37
|
+
terms remain English.
|
|
38
|
+
|
|
39
|
+
Free prose written inside those sections should follow the project prose
|
|
40
|
+
language:
|
|
41
|
+
|
|
42
|
+
- `en`: write free prose in English.
|
|
43
|
+
- `zh-TW`: write free prose in Traditional Chinese.
|
|
44
|
+
- `{xx-XX}`: write free prose in that explicit BCP-47 language.
|
|
45
|
+
|
|
46
|
+
Do not translate code identifiers, DDD pattern names, BR IDs, SPEC IDs,
|
|
47
|
+
file paths, branch names, anchors, or inline code only to satisfy the
|
|
48
|
+
prose-language setting.
|
|
49
|
+
|
|
50
|
+
### SPEC-ID Format
|
|
51
|
+
|
|
52
|
+
- Pattern: `SPEC-YYYYMMDD-NNN` (e.g. `SPEC-20260421-001`)
|
|
53
|
+
- Per-day counter `NNN` resets daily, starts at `001`
|
|
54
|
+
- Once assigned, the SPEC-ID is immutable — it appears in the feature
|
|
55
|
+
directory name, the first phase-spec filename, and the git branch
|
|
56
|
+
name (see `Git-principles-*.md`)
|
|
57
|
+
|
|
58
|
+
### Slug Conventions (Project-Specific Fill-In)
|
|
59
|
+
|
|
60
|
+
- **Language**: follow the language the feature is discussed in (Dflow
|
|
61
|
+
skill policy); no translation is forced. Both Chinese and English
|
|
62
|
+
slugs are valid.
|
|
63
|
+
- **Project-specific term list**: {fill in project-specific abbreviation
|
|
64
|
+
conventions here, e.g. "bounded context name shortenings",
|
|
65
|
+
"Aggregate name → slug rules"; otherwise leave empty}
|
|
66
|
+
- **Length target**: 2–4 English words or 2–6 Chinese characters
|
|
67
|
+
(Dflow skill guidance)
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Filling the Templates
|
|
72
|
+
|
|
73
|
+
Dflow ships these templates (do **not** re-inline their content here
|
|
74
|
+
— always read the canonical template from the skill):
|
|
75
|
+
|
|
76
|
+
| Template | Used when |
|
|
77
|
+
|----------|-----------|
|
|
78
|
+
| `templates/_index.md` | Creating a feature directory (every feature) |
|
|
79
|
+
| `templates/phase-spec.md` | T1 Heavy — new feature / new phase / architectural change |
|
|
80
|
+
| `templates/lightweight-spec.md` | T2 Light — bug fix / small tweak with BR Delta |
|
|
81
|
+
| `templates/context-definition.md` | When a new Bounded Context is introduced |
|
|
82
|
+
| `templates/aggregate-design.md` | When a new Aggregate is introduced |
|
|
83
|
+
| `templates/behavior.md` | BC-level consolidated behavior spec |
|
|
84
|
+
|
|
85
|
+
Project-specific guidance when filling these templates:
|
|
86
|
+
|
|
87
|
+
### DDD-specific spec conventions
|
|
88
|
+
|
|
89
|
+
- **Aggregate identification**: every phase-spec that introduces new
|
|
90
|
+
behavior should explicitly name the Aggregate involved. If the
|
|
91
|
+
change spans Aggregates, call that out in the spec's "Domain
|
|
92
|
+
Modeling" section and explain the integration strategy (Domain
|
|
93
|
+
Event? Query? ACL?).
|
|
94
|
+
- **Domain Events documentation**: events belong in
|
|
95
|
+
`dflow/specs/domain/{context}/events.md`. When a phase-spec introduces or
|
|
96
|
+
modifies an event, update `events.md` during Step 8.3 sync — do not
|
|
97
|
+
only update it in the feature-level spec.
|
|
98
|
+
- **Aggregate state transitions**: for phase-specs that change
|
|
99
|
+
Aggregate state, include explicit "state-before → state-after"
|
|
100
|
+
descriptions (Mermaid state diagram or Given / When / Then + "And
|
|
101
|
+
the Aggregate is in state X").
|
|
102
|
+
- **CQRS split**: commands (write) vs queries (read) should be
|
|
103
|
+
identified during Phase 4 (Implementation Planning). Commands
|
|
104
|
+
generally map 1:1 to an Aggregate method; queries bypass the
|
|
105
|
+
Domain layer and read projections.
|
|
106
|
+
|
|
107
|
+
### Project-specific fill-ins
|
|
108
|
+
|
|
109
|
+
- {e.g. "All Money amounts use the `Money` value object with explicit
|
|
110
|
+
currency; do not use `decimal` for money in the Domain layer."}
|
|
111
|
+
- {e.g. "Every Aggregate has a `CreatedAt` / `LastModifiedAt`
|
|
112
|
+
shadow property; this is implemented in the Infrastructure layer
|
|
113
|
+
EF configuration, not in the Domain."}
|
|
114
|
+
- {e.g. "Pagination for queries uses `PagedResult<T>` defined in
|
|
115
|
+
SharedKernel."}
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Ceremony Scaling (Project Application)
|
|
120
|
+
|
|
121
|
+
The Dflow skill defines three tiers — **T1 Heavy / T2 Light / T3
|
|
122
|
+
Trivial**. See the Dflow skill § "Ceremony Scaling" for the full
|
|
123
|
+
criteria table. We do not re-define the tier criteria here; this
|
|
124
|
+
section records how *this* project applies them in borderline
|
|
125
|
+
situations.
|
|
126
|
+
|
|
127
|
+
| Situation (project-specific) | Tier we default to | Why |
|
|
128
|
+
|------------------------------|--------------------|-----|
|
|
129
|
+
| {e.g. New Aggregate} | T1 + `aggregate-design.md` | Crosses Aggregate boundary and needs invariant documentation |
|
|
130
|
+
| {e.g. Adding a Query only (no write)} | T2 | No Aggregate state change, but goes through Application layer; trace via lightweight-spec |
|
|
131
|
+
| {e.g. EF configuration tweak in Infrastructure} | T3 if no Domain change | Infra-only; inline row in `_index.md` |
|
|
132
|
+
| {e.g. Domain Event payload extension} | T1 | Event contract change affects cross-context consumers |
|
|
133
|
+
|
|
134
|
+
### DDD Modeling Depth (Dflow skill § Ceremony Scaling)
|
|
135
|
+
|
|
136
|
+
The Dflow skill further distinguishes:
|
|
137
|
+
|
|
138
|
+
- **Full** (new Aggregate / new BC): use `templates/aggregate-design.md`
|
|
139
|
+
+ update `context-map.md` + define events in `events.md`
|
|
140
|
+
- **Standard** (feature within existing BC, existing Aggregate):
|
|
141
|
+
confirm Aggregate ownership + update `models.md` / `rules.md`
|
|
142
|
+
- **T2 / T3**: confirm the fix lands in the correct layer; no
|
|
143
|
+
design-level updates required
|
|
144
|
+
|
|
145
|
+
Use this table to record project-specific interpretation if needed.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Glossary Consistency
|
|
150
|
+
|
|
151
|
+
All business terms in spec documents must use names defined in
|
|
152
|
+
`dflow/specs/domain/glossary.md`. When a new term appears:
|
|
153
|
+
|
|
154
|
+
1. Check glossary first
|
|
155
|
+
2. If missing, add it **before** using the term in a spec
|
|
156
|
+
3. Cross-reference the BC the term belongs to
|
|
157
|
+
4. If the term maps to a code construct (Aggregate / VO / Event), add
|
|
158
|
+
the `Code Mapping` column value
|
|
159
|
+
|
|
160
|
+
This rule is enforced by the Dflow skill during `/dflow:new-feature`
|
|
161
|
+
and `/dflow:new-phase` flows; the project-level convention is simply
|
|
162
|
+
"don't bypass the glossary update."
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Related Documents
|
|
167
|
+
|
|
168
|
+
- [System overview](_overview.md)
|
|
169
|
+
- [Git principles](Git-principles-{gitflow|trunk}.md)
|
|
170
|
+
- [Context map](../domain/context-map.md)
|
|
171
|
+
- [Glossary](../domain/glossary.md)
|
|
172
|
+
- Dflow skill `SKILL.md` — canonical source for Ceremony Scaling, flow
|
|
173
|
+
selection, and template shapes.
|
|
174
|
+
- Dflow skill `references/ddd-modeling-guide.md` — DDD tactical
|
|
175
|
+
pattern reference.
|