dflow-sdd-ddd 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +2055 -0
  2. package/CONTRIBUTING.md +123 -0
  3. package/README.en.md +345 -0
  4. package/README.md +222 -102
  5. package/TEMPLATE-COVERAGE.md +46 -0
  6. package/TEMPLATE-LANGUAGE-GLOSSARY.md +52 -0
  7. package/bin/dflow.js +37 -1
  8. package/docs/evaluating-dflow.en.md +238 -0
  9. package/docs/evaluating-dflow.md +169 -0
  10. package/docs/migrating-to-dflow-v1.md +230 -0
  11. package/docs/npm-publish-checklist.md +93 -0
  12. package/docs/release-versioning-policy.md +99 -0
  13. package/docs/using-with-claude-code.en.md +210 -0
  14. package/docs/using-with-claude-code.md +191 -0
  15. package/docs/using-with-codex.en.md +248 -0
  16. package/docs/using-with-codex.md +224 -0
  17. package/docs/using-with-gemini-cli.en.md +200 -0
  18. package/docs/using-with-gemini-cli.md +184 -0
  19. package/docs/using-with-github-copilot.en.md +136 -0
  20. package/docs/using-with-github-copilot.md +177 -0
  21. package/docs/why-ddd-for-ai.en.md +37 -0
  22. package/docs/why-ddd-for-ai.md +19 -17
  23. package/lib/init.js +97 -1
  24. package/package.json +5 -1
  25. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +29 -0
  26. package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +8 -7
  27. package/templates/brownfield/scaffolding/_conventions.md +1 -0
  28. package/templates/brownfield/templates/CLAUDE.md +1 -1
  29. package/templates/brownfield/templates/phase-spec.md +23 -20
  30. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +29 -0
  31. package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +9 -7
  32. package/templates/greenfield/scaffolding/_conventions.md +2 -1
  33. package/templates/greenfield/templates/CLAUDE.md +1 -1
  34. package/templates/greenfield/templates/phase-spec.md +24 -21
@@ -0,0 +1,123 @@
1
+ # Contributing to Dflow
2
+
3
+ Thanks for taking the time to improve Dflow. This project is a spec-first
4
+ SDD/DDD workflow kit for AI-assisted development, so changes are reviewed for
5
+ both implementation correctness and workflow clarity.
6
+
7
+ ## Before You Start
8
+
9
+ Please read:
10
+
11
+ - `README.md` for the public project overview and installation flow.
12
+ - `TEMPLATE-COVERAGE.md` before changing templates, scaffolding, or generated
13
+ document structure.
14
+ - `TEMPLATE-LANGUAGE-GLOSSARY.md` before changing template headings or field
15
+ labels.
16
+ - The relevant Greenfield or Brownfield skill source when changing workflow
17
+ behavior.
18
+
19
+ The public source is kept intentionally smaller than the development workspace.
20
+ Internal planning notes, proposal handoffs, and review artifacts are maintainer
21
+ records; public issues and pull requests should be understandable without them.
22
+
23
+ ## What to Open
24
+
25
+ Open a bug report when an existing command, generated file, or documented flow
26
+ does not behave as described.
27
+
28
+ Open a workflow change request when you want to change Dflow behavior, template
29
+ shape, generated scaffolding, DDD guidance, or the contract of a `/dflow:*`
30
+ flow.
31
+
32
+ Open docs feedback when the current documentation is confusing, incomplete, or
33
+ hard to follow.
34
+
35
+ Open a question when you need help deciding how Dflow applies to your project.
36
+ Questions are welcome, but this project does not promise a general support SLA.
37
+
38
+ If an AI assistant notices a possible Dflow issue while helping in your project,
39
+ you can ask it to run `/dflow:report-dflow-feedback`. That flow should produce a
40
+ sanitized local draft that you review before opening a GitHub issue or PR. It
41
+ must not submit private project details or publish anything automatically.
42
+
43
+ ## Pull Request Expectations
44
+
45
+ Keep pull requests focused. A good PR explains:
46
+
47
+ - What changed and why.
48
+ - Which files or workflow contracts are affected.
49
+ - Whether the change affects Greenfield, Brownfield, or both tracks.
50
+ - Whether common flow files were synchronized across both tracks.
51
+ - Whether generated templates, tutorial material, or coverage docs need updates.
52
+ - What verification was run.
53
+
54
+ For code or packaging changes, run:
55
+
56
+ ```bash
57
+ npm test
58
+ npm pack --dry-run
59
+ git diff --check
60
+ ```
61
+
62
+ For documentation-only changes, at minimum run:
63
+
64
+ ```bash
65
+ git diff --check
66
+ ```
67
+
68
+ If a command cannot be run in your environment, note that in the PR.
69
+
70
+ GitHub Actions runs the same verification commands on every pull request to
71
+ `main` and on every push to `main`. The CI is verification-only — it does not
72
+ publish releases, change versions, or create tags.
73
+
74
+ When changing templates or scaffolding, keep both source surfaces aligned:
75
+
76
+ - skill source under `sdd-ddd-greenfield-skill/` or
77
+ `sdd-ddd-brownfield-skill/`
78
+ - packaged templates under `templates/greenfield/` or `templates/brownfield/`
79
+
80
+ If you are unsure which surface to edit, describe that uncertainty in the PR.
81
+
82
+ ## Greenfield and Brownfield Synchronization
83
+
84
+ Several Dflow flows are shared between the Greenfield and Brownfield tracks. If
85
+ you change a common SDD flow, update both copies unless the change is
86
+ intentionally track-specific.
87
+
88
+ Common shared flows include:
89
+
90
+ - `dflow-feedback-flow.md`
91
+ - `init-project-flow.md`
92
+ - `new-feature-flow.md`
93
+ - `modify-existing-flow.md`
94
+ - `new-phase-flow.md`
95
+ - `finish-feature-flow.md`
96
+ - `drift-verification.md`
97
+ - `pr-review-checklist.md`
98
+ - `git-integration.md`
99
+
100
+ Track-specific behavior is fine, but it should be named explicitly in the PR.
101
+
102
+ ## Template and Heading Changes
103
+
104
+ Dflow templates use canonical English structure so AI agents can locate sections
105
+ reliably across projects. User-authored prose inside generated documents may use
106
+ the team's chosen prose language.
107
+
108
+ Do not localize template headings or structural field labels as a drive-by
109
+ change. Localized headings require a separate design decision because they
110
+ affect templates, anchors, tutorial output, and verification strategy.
111
+
112
+ ## Release Changes
113
+
114
+ If your change affects published behavior, generated files, CLI commands, or
115
+ workflow contracts, mention the expected version impact in the PR:
116
+
117
+ - Patch: bug fix, docs clarification, release metadata, or non-breaking wording.
118
+ - Minor: new command, new generated file, workflow contract expansion, or
119
+ materially changed template shape.
120
+ - Breaking change: anything that can make existing Dflow projects or automation
121
+ need manual adjustment.
122
+
123
+ See `docs/release-versioning-policy.md` for the maintainer release policy.
package/README.en.md ADDED
@@ -0,0 +1,345 @@
1
+ # Dflow
2
+
3
+ [繁體中文](README.md) | **English**
4
+
5
+ > **AI collaboration without DDD = accelerated chaos; with DDD = AI constrained inside the domain model upfront.**
6
+ > A Rich Domain Model (business rules encoded into domain objects themselves, not scattered across services or prompts) puts invariants, business rules, and Aggregate boundaries inside the objects — every line of code the AI writes must pass through that contract. Dflow treats DDD as the semantic backbone of SDD.
7
+
8
+ Dflow is a spec-first workflow kit for AI-assisted software development. It gives your AI coding agent a concrete process for turning change requests into structured specs, domain language, implementation plans, drift checks, and reviewable code instead of jumping straight from prompt to code.
9
+
10
+ The goal is not the process itself, but repeatable software change with clearer meaning, fewer scattered rules, and less prompt-dependent behavior.
11
+
12
+ ## Key Features
13
+
14
+ | Feature | What it gives engineering teams |
15
+ |---|---|
16
+ | **Spec-first development** | Pushes alignment to before implementation — avoids the round-trip where AI jumps from an ambiguous prompt straight to code, then has to be redirected after the wrong direction lands. |
17
+ | **Greenfield and Brownfield tracks** | Not limited to new projects; an existing codebase doesn't need a big-bang refactor first — you can change behavior while progressively extracting scattered domain rules. |
18
+ | **Hybrid workflow control** | Not autopilot, not pure manual — commands for explicit entry, AI nudges when you forget to start a flow, and pauses at key decisions to confirm direction. The three layers together keep AI from running off-track without turning every step into bureaucratic overhead. |
19
+ | **DDD semantic backbone** | AI is most likely to invent plausible-but-wrong business rules (when a discount is valid, what an account can or cannot do) — review rarely catches this. Write the domain language, boundaries, and rules down first, and AI fills in details under project constraints instead of by guess. |
20
+ | **Three-layer documentation model** | Matches how feature branches actually evolve: phase (one propose-implement-archive cycle) / feature (the whole branch's running state and resume pointer) / system (cross-feature long-term knowledge). Many spec tools only ship phase + system, which breaks down when a feature branch spans multiple phases. Detailed below. |
21
+ | **Change-depth-based tiers (T1/T2/T3)** | AI scales specification and verification by change depth: color/typo gets one inline row in `_index.md`; bug fixes get a lightweight spec plus focused verification; new features or bounded-context-level changes go through a full phase-spec plus layer-by-layer implementation planning / verification. Small changes don't get dragged down by the process. |
22
+ | **Drift verification** | `/dflow:verify` cross-checks specs, domain documents, implementation, tests, and tech-debt records to surface the "documentation still describes the old behavior" drift that PR review by eye usually misses. |
23
+ | **Multi-AI-tool rule sharing** | A canonical project guide plus thin tool-specific shims (`CLAUDE.md` / `AGENTS.md` / `GEMINI.md` / Copilot instructions) — teams switching between Claude, Codex, Gemini, and Copilot don't have to maintain multiple copies of workflow rules. |
24
+
25
+ ## Get Started
26
+
27
+ Prerequisites: Node.js / npm installed, with the global npm bin directory on
28
+ your `PATH`.
29
+
30
+ Install Dflow globally, then run it from the root of the project you want to
31
+ adopt it in:
32
+
33
+ ```bash
34
+ npm install -g dflow-sdd-ddd
35
+ dflow init
36
+ ```
37
+
38
+ The init flow asks whether the project is greenfield or brownfield, then
39
+ previews the files it will create. Existing files are not overwritten. Init
40
+ creates workflow documentation and AI instruction files; it does not inspect,
41
+ refactor, or migrate your application code.
42
+
43
+ If the project is already initialized and you later add another AI coding
44
+ tool, run:
45
+
46
+ ```bash
47
+ dflow configure-agents
48
+ ```
49
+
50
+ This command only configures AI instruction files. It does not rerun project
51
+ initialization or touch existing specs.
52
+
53
+ ### Alternative: try without installing
54
+
55
+ If you cannot or do not want to do a global install (no admin rights,
56
+ ephemeral environment, or one-shot evaluation), every Dflow CLI command is
57
+ also available through `npx`:
58
+
59
+ ```bash
60
+ npx dflow-sdd-ddd init
61
+ npx dflow-sdd-ddd doctor
62
+ npx dflow-sdd-ddd configure-agents
63
+ ```
64
+
65
+ When using this path, all commands in the same session must also use the full
66
+ `npx dflow-sdd-ddd <subcommand>` form. The bare `dflow` alias is only
67
+ available after a global install.
68
+
69
+ ### Check legacy artifacts (optional)
70
+
71
+ To check whether the project still has legacy or pre-V1 artifacts (such as
72
+ a top-level `specs/` directory or a `_共用/` directory left over from older
73
+ Dflow forms), run:
74
+
75
+ ```bash
76
+ dflow doctor
77
+ ```
78
+
79
+ `doctor` is a read-only health check. It never modifies files; it only
80
+ reports findings and points at the migration guide. Freshly initialized
81
+ projects won't have legacy artifacts and can skip this step.
82
+
83
+ ### Start using the Dflow workflow
84
+
85
+ After init, start work through the Dflow workflow in your AI coding agent:
86
+
87
+ ```text
88
+ /dflow:new-feature
89
+ /dflow:modify-existing
90
+ /dflow:bug-fix
91
+ /dflow:new-phase
92
+ /dflow:finish-feature
93
+ /dflow:verify
94
+ /dflow:pr-review
95
+ ```
96
+
97
+ If your tool does not support custom slash commands, use the same command names as plain instructions in chat. Dflow is Markdown-based workflow material plus a scaffolding CLI, so it can be used with AI coding agents that can read project instructions and repository context.
98
+
99
+ For the first adoption pass, use a branch or disposable sample project so your
100
+ team can inspect the generated `dflow/specs/` workspace before bringing the
101
+ workflow into an active codebase.
102
+
103
+ For a guided evaluation walk-through — what `init` creates, AI tool support,
104
+ track choice, and a 30-minute sample-project playbook — see [Evaluating
105
+ Dflow](docs/evaluating-dflow.en.md). For end-to-end scenario walk-throughs of
106
+ Greenfield and Brownfield workflows with worked spec outputs, see the
107
+ [`tutorial/`](tutorial/README.md) index.
108
+
109
+ ## Project Tracks
110
+
111
+ | Track | Use it when | Main outcome |
112
+ |---|---|---|
113
+ | **Greenfield** | You are starting a new system or a new bounded area with room to shape architecture and domain model early. | Clean spec baseline, domain model ownership, feature-by-feature implementation through SDD. |
114
+ | **Brownfield** | You are adding or changing behavior in an existing codebase where business rules may already be scattered. | Progressive domain extraction, safer change planning, and migration-ready domain knowledge. |
115
+
116
+ These tracks describe adoption style, not framework branding. Dflow should be read as a workflow system for software teams that want AI assistance without giving up domain clarity.
117
+
118
+ ### Track Choice and Migration
119
+
120
+ > The "rewrite to ASP.NET Core" path below is the default migration story baked into the current Dflow templates (reflecting Dflow's initial C# / ASP.NET use case), but the design itself is language- and framework-agnostic — the workflow, tier system, and documentation model work for any stack.
121
+
122
+ Track is fixed at `dflow init` time and **cannot be switched in-place** (there is no `/dflow:switch-to-greenfield` command). Brownfield is by design a preparation path toward Greenfield: pure C# code extracted into `src/Domain/` and the domain documents under `dflow/specs/domain/` (glossary, rules, models, events) are all migration-ready assets — at the eventual rewrite (new ASP.NET Core project + fresh `dflow init` with Greenfield track), they can be lifted directly. `dflow/specs/migration/tech-debt.md` is the brownfield-specific migration debt log.
123
+
124
+ Per-BC migration is also supported — once a Bounded Context's logic is fully extracted into `src/Domain/` and the Code-Behind is reduced to UI binding, that BC is already in a Clean Architecture state; the whole system doesn't have to switch in one go. The brownfield `/dflow:modify-existing`'s "assess Code-Behind" step becomes a no-op for that BC naturally.
125
+
126
+ ## Workflow Model
127
+
128
+ Dflow uses a hybrid design with three layers of user-AI interaction:
129
+
130
+ | Layer | Purpose |
131
+ |---|---|
132
+ | **Command-first entry** | Developers intentionally start work with commands such as `/dflow:new-feature` or `/dflow:modify-existing`. |
133
+ | **Auto-trigger safety net** | When the conversation clearly implies a feature, phase, bug fix, verification, or review, the AI should suggest the matching Dflow flow. |
134
+ | **Transparent decision checkpoints** | At key moments (flow entry, Step Gates between major steps, important internal steps), the AI stops to announce what it is about to do and waits for the developer to approve direction, preventing autopilot drift. |
135
+
136
+ ### Workflow Internal Structure
137
+
138
+ Each time you issue a `/dflow:xxx` command, a **Workflow run** starts. Inside a Workflow run there are numbered **Step**s (e.g. `/dflow:new-feature` has 8 Steps). Step-to-Step boundaries come in two kinds:
139
+
140
+ - **Step Gate** — AI must stop, announce the upcoming Step, and wait for the developer to confirm direction. Confirmation can be `/dflow:next`, natural-language "OK / continue", or implicit (developer just provides the data the next Step needs).
141
+ - **Step-internal transition** — AI announces "Step N complete, entering Step N+1" and proceeds without waiting.
142
+
143
+ Step Gates are not placed between every Step. In `/dflow:new-feature`'s 8 Steps, only 4 are Step Gates; the rest are step-internal transitions.
144
+
145
+ ### Change-depth-based tiers
146
+
147
+ Dflow scales specification, implementation planning, and verification by the depth of the change (T1 / T2 / T3 tiers):
148
+
149
+ | Tier | Typical use | Expected weight |
150
+ |---|---|---|
151
+ | **T1 Heavy** | New feature, new phase, new Aggregate / Bounded Context, architectural change, new business rule | Full phase-spec, domain modeling, behavior examples, implementation plan, verification and completion checks |
152
+ | **T2 Light** | Bug fix (logic error), UI input validation tweak, narrow change with a BR (business rule) delta | Lightweight spec, focused verification, confirm the fix lands in the correct architectural layer |
153
+ | **T3 Trivial** | Button color, copy/text fix, typo, pure formatting — **no business rule change, no Domain concept change, no data structure change** | One inline row in `_index.md`, no separate spec file |
154
+
155
+ Tier choice is not always up to the developer — `/dflow:new-feature` and `/dflow:new-phase` always default to T1, while `/dflow:modify-existing` and `/dflow:bug-fix` let the AI judge T1/T2/T3 based on the actual change.
156
+
157
+ **Not every change goes through Dflow**: pure typo / pure formatting commits (e.g. `prettier` / `dotnet format` autoruns) don't even need a T3 inline row — `git commit` directly. Dflow is for changes that carry business meaning or structural impact, not for tooling-driven noise.
158
+
159
+ Transparent decision checkpoints and the Tier system are related but separate: checkpoints govern how the AI communicates the workflow; tiers govern how much specification, implementation planning, and verification the change needs.
160
+
161
+ ## Documentation Model
162
+
163
+ In practice a feature branch usually goes through several propose → implement → complete cycles before it fully finishes — multiple milestones, multiple iterations, multiple commits. Dflow's three-layer documentation model matches that rhythm:
164
+
165
+ | Layer | File | Purpose | git analogue |
166
+ |---|---|---|---|
167
+ | **Phase Delta** | `phase-spec-{date}-{slug}.md` (or a lightweight spec) | Records what this cycle changes, why, and how it will be implemented and verified | A milestone slice inside a feature branch |
168
+ | **Feature Snapshot** | `_index.md` (one per feature directory) | Feature-level dashboard: phase list, cumulative BR Snapshot, Resume Pointer | The feature branch's own "current state" |
169
+ | **System State** | `rules.md` / `behavior.md` / `glossary.md` / `context-map.md` | Cross-feature long-term knowledge: glossary, business rules, models, conventions, tech debt | The accumulated "what the system actually is right now" on main / trunk |
170
+
171
+ `_index.md` is the key middle layer. Many spec tools only ship phase + system, but feature branches that span multiple phases are the norm, and without a middle layer three problems show up:
172
+
173
+ - You have to read every phase-spec to know "what has this feature accumulated so far"
174
+ - Picking up the work in a new conversation means rebuilding context — you can't tell where the previous session left off
175
+ - The archival granularity is either too fine or too coarse — archive each phase individually and you lose the feature-level view, or fold everything into the system layer and you lose the phase trail
176
+
177
+ Dflow solves these with `_index.md`: the Current BR Snapshot regenerates after each completed phase, the Resume Pointer carries continuation instructions, and the whole feature directory is the natural archival unit. At `/dflow:finish-feature`, Dflow reconciles the BR Snapshot into `rules.md` / `behavior.md` (promoting the feature layer into the system layer) and then `git mv`s the whole feature directory to `completed/`.
178
+
179
+ ## Files Created by Init
180
+
181
+ A typical initialized project receives a `dflow/` workspace:
182
+
183
+ ```text
184
+ dflow/
185
+ └── specs/
186
+ ├── shared/
187
+ │ ├── _overview.md
188
+ │ ├── _conventions.md
189
+ │ └── Git-principles-*.md
190
+ ├── domain/
191
+ │ ├── glossary.md
192
+ │ └── context-map.md
193
+ ├── architecture/
194
+ │ └── tech-debt.md
195
+ └── features/
196
+ ├── active/
197
+ └── completed/
198
+ ```
199
+
200
+ Dflow also creates or provides a mergeable project instruction file for your AI coding agent. The exact file depends on the target tool and existing project setup; Dflow avoids overwriting existing project instructions.
201
+
202
+ When you select AI agent setup during init, Dflow writes
203
+ `dflow/specs/shared/AI-AGENT-GUIDE.md` as the canonical project guide, then
204
+ creates small tool-specific **pointer files** (often called "shims" — short
205
+ files whose only job is to redirect the tool to the canonical guide):
206
+
207
+ | Tool target | Generated file |
208
+ |---|---|
209
+ | Codex / Copilot coding agent | `AGENTS.md` |
210
+ | Claude Code | `CLAUDE.md` |
211
+ | Gemini CLI | `GEMINI.md` |
212
+ | GitHub Copilot | `.github/copilot-instructions.md` |
213
+
214
+ If one of those files already exists, Dflow leaves it unchanged and writes a
215
+ merge snippet under `dflow/specs/shared/` instead. The project guide stays the
216
+ single source of truth, so teams can use multiple AI tools without maintaining
217
+ multiple copies of the workflow rules.
218
+
219
+ You can run `dflow configure-agents` later to add more tool shims as the team
220
+ adopts additional AI coding agents.
221
+
222
+ For tool-specific walk-throughs of what `init` writes and how Dflow's
223
+ workflow commands appear in a given AI tool, see the per-tool guides under
224
+ `docs/`:
225
+
226
+ - [Using Dflow with Claude Code](docs/using-with-claude-code.en.md)
227
+ - [Using Dflow with Codex CLI](docs/using-with-codex.en.md)
228
+ - [Using Dflow with Gemini CLI](docs/using-with-gemini-cli.en.md)
229
+ - [Using Dflow with GitHub Copilot](docs/using-with-github-copilot.en.md)
230
+
231
+ Init does not copy the `tutorial/` directory into your project. The
232
+ [`tutorial/`](tutorial/README.md) directory lives in this source repository
233
+ as evaluation material for understanding how Dflow works on Greenfield and
234
+ Brownfield scenarios.
235
+
236
+ ## Main Flows
237
+
238
+ Dflow commands fall into four categories by role. A "what should I run?" cheat sheet appears at the end.
239
+
240
+ ### Entry commands (start a workflow)
241
+
242
+ Start a Workflow run; can be invoked without any pre-existing feature. The three are independent — none is a prerequisite for the others.
243
+
244
+ | Flow | When to use it | Typical outputs |
245
+ |---|---|---|
246
+ | `/dflow:new-feature` | A completely new feature, or a new piece of business logic the system needs to support | Feature directory + `_index.md` + first phase-spec (always T1) |
247
+ | `/dflow:modify-existing` | Change to existing behavior — **when you're not sure which category the change belongs to**, AI dispatches internally | T1 → escalates to new-phase / new-feature; T2 → lightweight-spec; T3 → inline row in `_index.md` |
248
+ | `/dflow:bug-fix` | A defect where expected behavior can be stated narrowly | AI judges tier (typically T2 lightweight-spec). Orphan bugs build a minimal feature directory automatically |
249
+
250
+ ### Feature-internal commands (active feature only)
251
+
252
+ Usable only inside an already-started active feature. Targets pointing at `completed/` are refused.
253
+
254
+ | Flow | When to use it | Typical outputs |
255
+ |---|---|---|
256
+ | `/dflow:new-phase` | An active feature needs another implementation slice | New `phase-spec-{date}-{slug}.md` + Implementation Tasks + implementation / verification + phase marked completed (always T1) |
257
+ | `/dflow:finish-feature` | All phases of a feature are done and need closure | `git mv` the whole feature directory to `completed/`, sync BR Snapshot into the BC layer, emit an Integration Summary (does not auto-merge) |
258
+
259
+ ### Workflow control (manage an in-progress workflow run)
260
+
261
+ | Flow | When to use it |
262
+ |---|---|
263
+ | `/dflow:status` | See which workflow / Step / progress you are at |
264
+ | `/dflow:next` | Confirm to pass a Step Gate (equivalent to natural-language "OK" / "continue") |
265
+ | `/dflow:cancel` | Abort the current workflow run and return to free conversation. Artifacts created so far are kept |
266
+
267
+ ### Standalone tools (callable any time, not tied to any feature or workflow)
268
+
269
+ | Flow | When to use it | Typical outputs |
270
+ |---|---|---|
271
+ | `/dflow:verify` | Need to confirm docs, code, tests, and tech-debt records are still in sync | Drift report across spec, domain docs, implementation, tests, and debt records |
272
+ | `/dflow:pr-review` | A change is ready for review | SDD/DDD compliance review checklist with risks, gaps, and follow-up items |
273
+ | `/dflow:report-dflow-feedback` | You or the AI found a Dflow issue or improvement while using it | Sanitized local feedback draft; nothing is submitted automatically |
274
+
275
+ ### What should I run? (rule of thumb)
276
+
277
+ | What I want to do | Run |
278
+ |---|---|
279
+ | Completely new feature (unrelated to any existing feature) | `/dflow:new-feature` |
280
+ | Add the next planned phase to an active feature | `/dflow:new-phase` |
281
+ | Fix a specific bug | `/dflow:bug-fix` |
282
+ | **Not sure** what category — just changing existing behavior | `/dflow:modify-existing` |
283
+ | All phases of a feature are done, need closure | `/dflow:finish-feature` |
284
+ | Run a change review | `/dflow:pr-review` |
285
+ | Check doc vs code drift | `/dflow:verify` |
286
+
287
+ ### Completed features are frozen history
288
+
289
+ Once `/dflow:finish-feature` moves a feature directory into `completed/`, **no direct writes are allowed** — not new phase-specs, not lightweight-specs, not even inline rows in `_index.md`. To change anything later, you build a **follow-up feature**: a new feature directory with a fresh SPEC-ID and `follow-up-of: {original SPEC-ID}` metadata pointing back to the original.
290
+
291
+ Why: "completed = frozen history" is a core Dflow guarantee. Accepting post-completion edits would erase the feature-lifecycle endpoint and make `_index.md`'s BR Snapshot unreliable. `/dflow:modify-existing` detects when the target is a completed feature and prompts the developer with three choices: A — follow-up; B — independent new feature via `/dflow:new-feature`; C (refused, re-directed to A).
292
+
293
+ ## Why DDD Matters More with AI
294
+
295
+ AI agents are strong at filling in missing details. When the missing detail is something the AI can derive from rules or patterns (naming conventions, boilerplate syntax), that is useful. When the missing detail is **business meaning** — what a "valid" discount looks like, what an account should not be allowed to do — the AI can invent plausible rules that pass review by looking reasonable but are actually wrong.
296
+
297
+ Dflow treats DDD as the semantic structure behind the spec. Ubiquitous language keeps names consistent. Bounded contexts keep meanings from leaking across areas. Domain rules define what is correct, allowed, or forbidden before implementation starts.
298
+
299
+ In a code-first workflow, design often appears after the fact in classes, handlers, and tests. In an AI-assisted workflow, the spec must become the precondition for generation. The practical flow becomes:
300
+
301
+ ```text
302
+ Domain meaning -> Structured spec -> AI implementation -> Code as output
303
+ ```
304
+
305
+ For a longer explanation, see [Why DDD Matters More with AI](docs/why-ddd-for-ai.en.md).
306
+
307
+ ## Repository Layout
308
+
309
+ | Path | Purpose |
310
+ |---|---|
311
+ | `bin/` | CLI entrypoint. |
312
+ | `lib/` | Init runtime implementation. |
313
+ | `templates/` | Files copied by the init command. |
314
+ | `test/` | Smoke tests for generated output. |
315
+ | `tutorial/` | Guided learning scenarios and expected outputs. |
316
+ | `sdd-ddd-*-skill/` | Source workflow material consumed by AI coding agents. |
317
+
318
+ ## Contributing and Releases
319
+
320
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for issue and pull request guidance.
321
+ Pull requests run an automated verification workflow on GitHub before review.
322
+ Maintainer-facing release rules are documented in [Release and Versioning
323
+ Policy](docs/release-versioning-policy.md), with the manual npm flow in [npm
324
+ Publish Checklist](docs/npm-publish-checklist.md).
325
+
326
+ ## Status
327
+
328
+ Dflow is currently published as `dflow-sdd-ddd` on npm. The latest published
329
+ npm package is `0.2.0`, covering:
330
+
331
+ - Project initialization (`dflow init`)
332
+ - Workflow documentation (the `/dflow:*` flows)
333
+ - Multi-AI agent setup (CLAUDE.md / AGENTS.md / GEMINI.md / Copilot instructions shims)
334
+ - AI-agent-readable SDD/DDD guidance
335
+ - Public migration tooling: manual migration guide plus `dflow doctor` read-only health check
336
+ - Public onboarding: evaluator guide and per-tool walkthroughs for Claude Code and Codex CLI
337
+ - A verification-only CI workflow (it does not execute publish)
338
+
339
+ The GitHub source may include post-`0.2.0` repository changes before the
340
+ next npm release is published. See [CHANGELOG.md](CHANGELOG.md) for full
341
+ release history.
342
+
343
+ ## License
344
+
345
+ MIT License. See [LICENSE](LICENSE).