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.
Files changed (40) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +209 -0
  3. package/bin/dflow.js +72 -0
  4. package/lib/init.js +1206 -0
  5. package/package.json +42 -0
  6. package/templates/core/scaffolding/CLAUDE-md-snippet.md +168 -0
  7. package/templates/core/scaffolding/Git-principles-gitflow.md +350 -0
  8. package/templates/core/scaffolding/Git-principles-trunk.md +375 -0
  9. package/templates/core/scaffolding/_conventions.md +175 -0
  10. package/templates/core/scaffolding/_overview.md +165 -0
  11. package/templates/core/scaffolding/architecture-decisions-README.md +34 -0
  12. package/templates/core/templates/CLAUDE.md +172 -0
  13. package/templates/core/templates/_index.md +118 -0
  14. package/templates/core/templates/aggregate-design.md +58 -0
  15. package/templates/core/templates/behavior.md +62 -0
  16. package/templates/core/templates/context-definition.md +64 -0
  17. package/templates/core/templates/context-map.md +25 -0
  18. package/templates/core/templates/events.md +19 -0
  19. package/templates/core/templates/glossary.md +15 -0
  20. package/templates/core/templates/lightweight-spec.md +82 -0
  21. package/templates/core/templates/models.md +47 -0
  22. package/templates/core/templates/phase-spec.md +195 -0
  23. package/templates/core/templates/rules.md +24 -0
  24. package/templates/core/templates/tech-debt.md +15 -0
  25. package/templates/webforms/scaffolding/CLAUDE-md-snippet.md +167 -0
  26. package/templates/webforms/scaffolding/Git-principles-gitflow.md +333 -0
  27. package/templates/webforms/scaffolding/Git-principles-trunk.md +316 -0
  28. package/templates/webforms/scaffolding/_conventions.md +139 -0
  29. package/templates/webforms/scaffolding/_overview.md +109 -0
  30. package/templates/webforms/templates/CLAUDE.md +157 -0
  31. package/templates/webforms/templates/_index.md +110 -0
  32. package/templates/webforms/templates/behavior.md +58 -0
  33. package/templates/webforms/templates/context-definition.md +57 -0
  34. package/templates/webforms/templates/context-map.md +25 -0
  35. package/templates/webforms/templates/glossary.md +15 -0
  36. package/templates/webforms/templates/lightweight-spec.md +82 -0
  37. package/templates/webforms/templates/models.md +39 -0
  38. package/templates/webforms/templates/phase-spec.md +187 -0
  39. package/templates/webforms/templates/rules.md +24 -0
  40. package/templates/webforms/templates/tech-debt.md +15 -0
@@ -0,0 +1,139 @@
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
+ Reference" 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. "payroll → pr", "expense report → exp-rpt"
65
+ if your team has house-style shortenings; otherwise leave this
66
+ section empty}
67
+ - **Length target**: 2–4 English words or 2–6 Chinese characters
68
+ (Dflow skill guidance)
69
+
70
+ ---
71
+
72
+ ## Filling the Templates
73
+
74
+ Dflow ships these templates (do **not** re-inline their content here
75
+ — always read the canonical template from the skill):
76
+
77
+ | Template | Used when |
78
+ |----------|-----------|
79
+ | `templates/_index.md` | Creating a feature directory (every feature) |
80
+ | `templates/phase-spec.md` | T1 Heavy — new feature / new phase / architectural change |
81
+ | `templates/lightweight-spec.md`| T2 Light — bug fix / small tweak with BR Delta |
82
+ | `templates/context-definition.md` | When a new Bounded Context is introduced |
83
+ | `templates/behavior.md` | BC-level consolidated behavior spec |
84
+
85
+ Project-specific guidance when filling these templates:
86
+
87
+ - {e.g. "Always reference existing BRs in the BR Snapshot inherited
88
+ column if the feature extends existing rules. Check `dflow/specs/domain/
89
+ {context}/rules.md` first."}
90
+ - {e.g. "For financial scenarios, currency and precision must be
91
+ explicit in every Given/When/Then."}
92
+ - {e.g. "When a phase-spec touches the Expense context, mention
93
+ Payroll integration in Delta if the rule affects month-end
94
+ processing."}
95
+
96
+ ---
97
+
98
+ ## Ceremony Scaling (Project Application)
99
+
100
+ The Dflow skill defines three tiers — **T1 Heavy / T2 Light / T3
101
+ Trivial**. See the Dflow skill § "Ceremony Scaling" for the full
102
+ criteria table. We do not re-define the tier criteria here; this
103
+ section records how *this* project applies them in borderline
104
+ situations.
105
+
106
+ | Situation (project-specific) | Tier we default to | Why |
107
+ |------------------------------|--------------------|-----|
108
+ | {e.g. Year-end reporting tweak without BR change} | T2 | Touches logic path even though no new BR; extract to `lightweight-spec.md` for trace |
109
+ | {e.g. Pure label / display text translation} | T3 | No BR change; inline row in `_index.md` |
110
+ | {e.g. UI refresh across multiple pages} | T1 (project convention) | We treat multi-page UI refresh as T1 for this project even though Dflow default would be T2, because our WebForms UI changes often leak into Code-Behind |
111
+
112
+ If the team disagrees on tier classification for a specific change,
113
+ run through the T3 four-criteria checklist (in the Dflow skill) and
114
+ record the decision here the first time it arises.
115
+
116
+ ---
117
+
118
+ ## Glossary Consistency
119
+
120
+ All business terms in spec documents must use names defined in
121
+ `dflow/specs/domain/glossary.md`. When a new term appears:
122
+
123
+ 1. Check glossary first
124
+ 2. If missing, add it **before** using the term in a spec
125
+ 3. Cross-reference the BC the term belongs to
126
+
127
+ This rule is enforced by the Dflow skill during `/dflow:new-feature`
128
+ and `/dflow:new-phase` flows; the project-level convention is simply
129
+ "don't bypass the glossary update."
130
+
131
+ ---
132
+
133
+ ## Related Documents
134
+
135
+ - [System overview](_overview.md)
136
+ - [Git principles](Git-principles-{gitflow|trunk}.md)
137
+ - [Glossary](../domain/glossary.md)
138
+ - Dflow skill SKILL.md — canonical source for Ceremony Scaling, flow
139
+ selection, and template shapes.
@@ -0,0 +1,109 @@
1
+ <!-- Scaffolding template maintained alongside Dflow skill. See proposals/PROPOSAL-010 for origin. -->
2
+
3
+ # System Overview — {System Name}
4
+
5
+ > Created: {YYYY-MM-DD}
6
+ > Scope: current state and migration direction of {System Name}
7
+ > Audience: team members onboarding to the system + AI assistants reading
8
+ > `dflow/specs/` for context.
9
+
10
+ This file is a **project-level starting point**. It does not duplicate
11
+ Dflow's workflow rules (see `CLAUDE.md` and the Dflow skill for those) —
12
+ it captures the unique context of *this* system so that new engineers (or
13
+ AI) can quickly understand what they are working on.
14
+
15
+ ---
16
+
17
+ ## System Summary
18
+
19
+ {One paragraph: what this system does, who uses it, what business value it
20
+ delivers. Keep it non-technical enough that a new hire can skim it in
21
+ 30 seconds.}
22
+
23
+ ### Business Domain
24
+
25
+ - **Primary domain**: {e.g. expense management, HR, order processing}
26
+ - **Key stakeholders**: {e.g. finance team, HR admins, end-user employees}
27
+ - **User scale**: {e.g. ~200 internal users, 5 countries}
28
+
29
+ ---
30
+
31
+ ## Technical Architecture (Current)
32
+
33
+ This project runs on ASP.NET WebForms. The SDD/DDD workflow is used to
34
+ progressively prepare for migration (see "Migration Strategy" below).
35
+
36
+ | Item | Current |
37
+ |------|---------|
38
+ | Framework | ASP.NET WebForms ({.NET Framework version}) |
39
+ | Language | C# {version} |
40
+ | Database | {e.g. SQL Server 2019, MySQL 8.0} |
41
+ | ORM / data access | {e.g. Entity Framework 6, ADO.NET, stored procedures} |
42
+ | UI | WebForms Pages + Code-Behind + {CSS framework if any} |
43
+ | Auth | {e.g. Forms authentication, Windows auth} |
44
+ | Hosting | {e.g. IIS on-prem, Azure App Service} |
45
+
46
+ ### Code Layout (High Level)
47
+
48
+ ```
49
+ src/
50
+ ├── Domain/ # Extracted domain logic (pure C#; migration target)
51
+ │ ├── {BoundedContext}/
52
+ │ └── SharedKernel/
53
+ └── Pages/ # WebForms pages (.aspx + Code-Behind)
54
+ ```
55
+
56
+ The `src/Domain/` directory is where business logic lives **as it is
57
+ extracted** from Code-Behind. Everything in `src/Domain/` must be pure
58
+ C# with no `System.Web` dependencies (see `CLAUDE.md` and the Dflow
59
+ skill for the full rule set).
60
+
61
+ ---
62
+
63
+ ## Existing Issues / Known Pain Points
64
+
65
+ {Optional but strongly recommended for brownfield adoption. List the
66
+ top 3–5 known issues the team wants to address as part of migration.
67
+ Link each to `migration/tech-debt.md` entries if they exist.}
68
+
69
+ 1. {e.g. Business logic scattered across Code-Behind; duplicated
70
+ calculations in multiple pages}
71
+ 2. {e.g. Direct SQL in Code-Behind; inconsistent error handling}
72
+ 3. {e.g. Magic numbers / undocumented statuses}
73
+
74
+ ---
75
+
76
+ ## Migration Strategy
77
+
78
+ This system is being prepared for migration to ASP.NET Core. The
79
+ migration follows four principles; expand / adapt each to this project:
80
+
81
+ - **Migration Awareness** — Every feature decision considers future
82
+ migration. We ask "does this make the migration harder or easier?"
83
+ - **Domain Extraction** — Business logic gradually moves from
84
+ Code-Behind to `src/Domain/`. Each feature is an opportunity to
85
+ extract a little more.
86
+ - **Dual-Track Parallel** — We do not force-rewrite existing code; new
87
+ development preferentially uses the Domain layer, and legacy pages
88
+ get touched only when they are being modified.
89
+ - **Pragmatic First** — Migration does not block feature delivery. If
90
+ a deadline is tight, record the debt in `migration/tech-debt.md`
91
+ and continue.
92
+
93
+ ### Target Architecture (Post-Migration)
94
+
95
+ {1-2 sentences describing where this system is heading: e.g. "ASP.NET
96
+ Core 8 + Clean Architecture + EF Core, deployed to Azure App Service."
97
+ Link to any ADR or migration plan doc if one exists.}
98
+
99
+ ---
100
+
101
+ ## Related Documents
102
+
103
+ - [Spec conventions](_conventions.md)
104
+ - [Git principles](Git-principles-{gitflow|trunk}.md) — choose the
105
+ branching-strategy-specific file that matches this project
106
+ - [Glossary](../domain/glossary.md)
107
+ - [Tech debt backlog](../migration/tech-debt.md)
108
+ - Dflow skill: see `CLAUDE.md` and the `sdd-ddd-webforms-skill/` bundle
109
+ for the full AI workflow guidance.
@@ -0,0 +1,157 @@
1
+ # Project: {系統名稱} — ASP.NET WebForms
2
+
3
+ **重要:所有開發工作都必須遵循本文件定義的流程。**
4
+
5
+ ---
6
+
7
+ ## System Context
8
+
9
+ > 技術棧、業務領域、目錄結構
10
+
11
+ ### Background
12
+
13
+ 這是一個運行中的 ASP.NET WebForms 系統,目前持續新增與修改功能。
14
+ 未來將遷移至 ASP.NET Core。目前採用 SDD 流程,同時為 DDD 做準備。
15
+
16
+ ### Project Structure
17
+
18
+ ```
19
+ dflow/specs/
20
+ ├── shared/ # 專案級治理文件(由 npx dflow-sdd-ddd init 寫入)
21
+ │ ├── _overview.md # 系統現況與遷移策略
22
+ │ └── _conventions.md # 規格撰寫慣例與模板
23
+ ├── domain/ # 領域知識
24
+ │ ├── glossary.md # 術語表(Ubiquitous Language)
25
+ │ └── {context}/ # 按 Bounded Context 分
26
+ │ ├── context.md # Context 邊界與職責
27
+ │ ├── models.md # 領域模型定義
28
+ │ └── rules.md # 業務規則目錄
29
+ ├── features/
30
+ │ ├── active/ # 進行中的 feature
31
+ │ │ └── {SPEC-ID}-{slug}/ # 一個 feature 一個目錄
32
+ │ │ ├── _index.md # Feature dashboard:Goals & Scope / Phase Specs / Current BR Snapshot / Lightweight Changes / Resume Pointer
33
+ │ │ ├── phase-spec-YYYY-MM-DD-{slug}.md # T1 Heavy:每 phase 一份
34
+ │ │ └── lightweight-YYYY-MM-DD-{slug}.md # T2 Light(或 BUG-NNN-{slug}.md)
35
+ │ ├── completed/ # 整個 feature 目錄 git mv 到這裡
36
+ │ └── backlog/ # 待處理
37
+ │ # SPEC-ID 格式:SPEC-YYYYMMDD-NNN;slug 跟隨討論語言(中文/英文皆可)
38
+ │ # T3 無獨立檔,只在 _index.md Lightweight Changes 寫一列
39
+ └── migration/
40
+ └── tech-debt.md # 技術債與遷移備忘
41
+
42
+ src/
43
+ ├── Domain/ # 抽離的領域邏輯(純 C#)
44
+ │ ├── {Context}/
45
+ │ │ ├── Entities/
46
+ │ │ ├── ValueObjects/
47
+ │ │ ├── Services/
48
+ │ │ └── Interfaces/
49
+ │ └── SharedKernel/
50
+ └── Pages/ # 既有 WebForms 頁面
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Development Workflow
56
+
57
+ > SDD 流程、Git 整合、Domain 層規範、術語表、AI 協作
58
+
59
+ ### Core Principles
60
+ 1. **Spec Before Code** — 沒有規格就不寫實作
61
+ 2. **Domain Extraction** — 業務邏輯屬於 `src/Domain/`,不屬於 Code-Behind
62
+ 3. **Ubiquitous Language** — 使用 `dflow/specs/domain/glossary.md` 中定義的術語
63
+ 4. **Migration Awareness** — 每個決策都要考慮未來 ASP.NET Core 遷移
64
+
65
+ ### Three Ceremony Tiers
66
+
67
+ 不是每次修改都要跑完整流程。AI 依下列判準選 tier:
68
+
69
+ - **T1 Heavy** — 新功能、新 phase、架構變動、新增 BR → 建獨立 phase-spec,
70
+ 走 `/dflow:new-feature` 或 `/dflow:new-phase`
71
+ - **T2 Light** — bug fix、UI 輸入驗證、流程分支修改(有 BR Delta 但無 Domain /
72
+ 資料結構變動)→ 建獨立 lightweight spec 置於 feature 目錄內
73
+ - **T3 Trivial** — 按鈕顏色、文案修正、typo、排版、純註解(無 BR 變動、
74
+ 無 Domain 概念動、無資料結構動、只改 UI 表層 / 註解 / 格式化)→
75
+ 只在 `_index.md` Lightweight Changes inline 寫一列
76
+
77
+ 純 typo / 純格式化 commit(`dotnet format` / `prettier` 自動整理)**低於 T3**:
78
+ 直接 `git commit`,不走 Dflow。
79
+
80
+ ### New Feature
81
+ 1. 建 feature 目錄 `dflow/specs/features/active/{SPEC-ID}-{slug}/`
82
+ 2. 建 `_index.md`(feature dashboard)+ 第一份 `phase-spec-YYYY-MM-DD-{slug}.md`
83
+ 3. 識別涉及的領域概念,更新 `dflow/specs/domain/` 下的對應文件
84
+ 4. 盡可能將業務邏輯實作在 `src/Domain/` 中(純 C# class,不依賴 WebForms)
85
+ 5. Code-Behind 僅負責 UI 綁定,呼叫 Domain 層處理邏輯
86
+ 6. 撰寫測試驗證 Domain 層行為符合規格
87
+
88
+ ### New Phase
89
+ 1. 在已啟動的 active feature 上新增一份 phase-spec(含 Delta-from-prior-phases)
90
+ 2. 更新 `_index.md` 的 Phase Specs 表 + regenerate Current BR Snapshot
91
+ 3. 嚴格只適用於 active feature;completed 的 feature 不接受新 phase
92
+
93
+ ### Modify Existing
94
+ 1. AI 依 T1 / T2 / T3 判準分流
95
+ 2. 若偵測到改動與 completed feature 相關,主動詢問是否為 follow-up
96
+ (follow-up 走新建 feature + `follow-up-of` 鏈回原 feature;不把 T2/T3
97
+ 寫回 completed 目錄)
98
+ 3. 如果該功能的邏輯還在 Code-Behind 中,評估是否值得先抽離到 Domain 層
99
+ 4. 在 `dflow/specs/migration/tech-debt.md` 記錄發現的技術債
100
+
101
+ ### Bug Fix
102
+ 1. 建立輕量規格(問題 + 現有行為 + 預期行為 + 修復方式)
103
+ 2. 若 bug 不附掛既有 feature,先建最小 feature 目錄再放 lightweight-spec
104
+ 3. 修 Bug 時順便記錄發現的技術債
105
+
106
+ ### Feature Closeout
107
+ 1. 驗證 feature 目錄內所有 phase-spec `status: completed`
108
+ 2. 把 `_index.md` Current BR Snapshot 同步到 BC 層 `rules.md` / `behavior.md`
109
+ 3. `git mv` 整個 feature 目錄從 `active/` 搬到 `completed/`
110
+ 4. 產出 Integration Summary(Git-strategy-neutral;不自動 merge)
111
+
112
+ ### Git Integration
113
+
114
+ > 本流程只規定 SDD 必要的最小 Git 耦合(feature branch per feature、
115
+ > `git mv`、commit 對應 SPEC-ID)。實際採用的分支策略(Git Flow /
116
+ > GitHub Flow / trunk-based / 單一 main)由專案決定,不在此強制。
117
+ > 若採用 Git Flow,可參考 `scaffolding/Git-principles-gitflow.md` 範本。
118
+
119
+ **分支命名**
120
+ ```
121
+ feature/{SPEC-ID}-{short-description} # 新功能(SDD 必須)
122
+ bugfix/{BUG-ID}-{short-description} # Bug 修復(SDD 必須)
123
+ ```
124
+
125
+ **Commit Message**
126
+ ```
127
+ [SPEC-ID] 簡述變更
128
+ ```
129
+
130
+ **分支規則**
131
+ - **feature/** — 必須先有 spec 才能開始編碼
132
+ - **bugfix/** — 至少要有輕量 spec
133
+ - **`/dflow:bug-fix`** 不綁定任何分支策略;採 Git Flow 的專案可選擇把
134
+ 緊急修復放在 `hotfix/` 分支,但這是專案決策,Dflow 不代為規定
135
+
136
+ ### Domain Layer Rules (`src/Domain/`)
137
+
138
+ 此目錄中的程式碼必須遵守:
139
+ - ❌ 不可引用 `System.Web` 或任何 WebForms 命名空間
140
+ - ❌ 不可直接存取資料庫(使用 interface + Repository pattern)
141
+ - ❌ 不可使用 `HttpContext`、`Session`、`ViewState`
142
+ - ❌ 不可有 UI 相關邏輯(格式化顯示、Page 引用)
143
+ - ✅ 純 C# 類別,可直接搬到 ASP.NET Core 專案
144
+ - ✅ 所有公開行為都能在沒有 Web 基礎設施的情況下測試
145
+
146
+ ### Glossary
147
+
148
+ 所有業務術語必須使用 `dflow/specs/domain/glossary.md` 中定義的名稱。
149
+ 遇到新術語時,先新增到術語表再使用。
150
+
151
+ ### AI Collaboration Notes
152
+
153
+ - 開發者提出任何功能需求時,先引導建立 spec
154
+ - 在回答 Domain 相關問題時,優先參考 `dflow/specs/domain/` 中的文件
155
+ - 發現 Code-Behind 中的業務邏輯時,建議抽離到 `src/Domain/`
156
+ - 每次開發循環結束時,提醒更新術語表和技術債記錄
157
+ - 建立分支前,確認命名符合規範且對應 spec 存在
@@ -0,0 +1,110 @@
1
+ ---
2
+ spec-id: SPEC-{YYYYMMDD}-{NNN}
3
+ slug: {slug-following-discussion-language}
4
+ status: in-progress # in-progress | completed
5
+ created: {YYYY-MM-DD}
6
+ branch: feature/{SPEC-ID}-{slug}
7
+ # follow-up-of: {原 SPEC-ID} # 選用:本 feature 為某個已 completed feature 的 follow-up 時填入
8
+ ---
9
+
10
+ <!--
11
+ Template note (for AI):
12
+ This is the **feature-level dashboard** (`_index.md`) for a feature
13
+ directory. Place at `dflow/specs/features/active/{SPEC-ID}-{slug}/_index.md`.
14
+
15
+ Six required sections (see below):
16
+ 1. Metadata (YAML front matter above)
17
+ 2. Goals & Scope (prose)
18
+ 3. Phase Specs (T1 list)
19
+ 4. Current BR Snapshot (feature-level cumulative state)
20
+ 5. Lightweight Changes (T2 outbound link + T3 inline)
21
+ 6. Resume Pointer
22
+
23
+ Optional section (append at end if applicable):
24
+ - Follow-up Tracking (when this feature has follow-up features derived)
25
+
26
+ Refresh discipline for "Current BR Snapshot":
27
+ - Regenerate when /dflow:new-phase enters
28
+ - Regenerate when a phase-spec is finalized (completed)
29
+ - Regenerate when a T2 lightweight-spec is finalized
30
+ - This table is the feature-level CURRENT STATE (not history).
31
+ History lives in each phase-spec's "Delta from prior phases" section.
32
+ The system-level current state lives in the bounded context's
33
+ rules.md / behavior.md, synced at /dflow:finish-feature.
34
+
35
+ Minimal usage:
36
+ For a 1-commit / 1-phase feature this template can be ~30 lines —
37
+ fill metadata + a short Goals & Scope + one row in Phase Specs +
38
+ initial BR Snapshot + Resume Pointer. The other sections can stay empty.
39
+ -->
40
+
41
+ # {Feature Title}
42
+
43
+ ## Goals & Scope
44
+
45
+ > 1-3 段:本 feature 解決什麼問題?為誰解決?邊界在哪?
46
+ >
47
+ > 若是 follow-up feature,AI 會在頂部自動加註:
48
+ > 「本 feature 為 `{原 SPEC-ID}-{原 slug}` 的 follow-up,原 feature 完成於
49
+ > `{date}`,詳見 `completed/{原 SPEC-ID}-{原 slug}/_index.md`」
50
+
51
+ ## Phase Specs
52
+
53
+ > T1 Heavy ceremony 產出的 phase-spec 列表(一份 phase-spec ≈ 一次完整
54
+ > Kickoff → Domain → Design → Build → Verify 循環)。
55
+
56
+ | Phase | Date | Slug | Status | File Link |
57
+ |---|---|---|---|---|
58
+ | 1 | {YYYY-MM-DD} | {phase-slug} | in-progress / completed | [phase-spec-{date}-{phase-slug}.md](./phase-spec-{date}-{phase-slug}.md) |
59
+
60
+ <!-- dflow:section current-br-snapshot -->
61
+ ## Current BR Snapshot
62
+
63
+ > Feature 層的 BR 當前狀態(不是歷史)。AI 在以下時機 regenerate 本表:
64
+ > - `/dflow:new-phase` 進入時
65
+ > - 完成一份 phase-spec 時
66
+ > - T2 lightweight spec 定稿時
67
+ >
68
+ > 歷史由各 phase-spec 的「Delta from prior phases」段串接閱讀;feature
69
+ > 完成時 `/dflow:finish-feature` 把本表推進到對應 BC 的 `rules.md` /
70
+ > `behavior.md`(延續 Step 8.3 既有 sync 機制)。
71
+
72
+ | BR-ID | Current Rule | First Seen (phase) | Last Updated (phase) | Status |
73
+ |---|---|---|---|---|
74
+ | BR-01 | {規則描述} | phase-1 / inherited from rules.md | phase-N | active / removed |
75
+
76
+ <!-- dflow:section lightweight-changes -->
77
+ ## Lightweight Changes
78
+
79
+ > T2 行:描述含「見 `lightweight-{date}-{slug}.md`」外連
80
+ > T3 行:inline 完整描述一句話 + 標籤(如 `[cosmetic]` / `[text]` /
81
+ > `[format]`);T3 不產獨立 spec 檔
82
+ >
83
+ > Tier 判準見 SKILL.md § Ceremony Scaling 三層表。
84
+
85
+ | Date | Tier | Description | Commit |
86
+ |---|---|---|---|
87
+ | {YYYY-MM-DD} | T2 | bug fix XYZ — 見 [`lightweight-{date}-{slug}.md`](./lightweight-{date}-{slug}.md) | {hash} |
88
+ | {YYYY-MM-DD} | T3 | 按鈕顏色從藍改綠 `[cosmetic]` | {hash} |
89
+
90
+ ## Resume Pointer
91
+
92
+ > 一句話:目前進展到哪?下一個動作是什麼?
93
+ > 開新對話接續工作時,從這裡讀起。
94
+
95
+ **Current Progress**: {one-line summary}
96
+
97
+ **Next Action**: {suggested next action}
98
+
99
+ <!--
100
+ ## Follow-up Tracking
101
+ >(選用段;只有當本 feature 衍生出 follow-up feature 時才填)
102
+ > 由 `/dflow:new-feature` / `/dflow:modify-existing` 在新建 follow-up
103
+ > feature 時自動更新;新 feature 完成時 `/dflow:finish-feature` 反向更新
104
+ > 該列 Status 欄為 `completed`。
105
+ > 連結權威是新 feature 的 `follow-up-of` 欄;本表為衍生索引。
106
+
107
+ | SPEC-ID | slug | Created | Status |
108
+ |---|---|---|---|
109
+ | SPEC-{YYYYMMDD}-{NNN} | {slug} | {YYYY-MM-DD} | in-progress / completed |
110
+ -->
@@ -0,0 +1,58 @@
1
+ # {Bounded Context} — Behavior Specification
2
+
3
+ > **Purpose**: Consolidated source of truth for this context's current behavior.
4
+ > Unlike `dflow/specs/features/completed/` (historical archive), this file always reflects
5
+ > the **current** system behavior — what the system does right now.
6
+ >
7
+ > **Maintenance**: AI updates this file during the completion flow (Step 8.3 / Step 6.3).
8
+ > When a feature is completed, merge its Given/When/Then scenarios here.
9
+ > When behavior is modified, update the corresponding section using the Delta result
10
+ > (not the Delta markup — merge the final state).
11
+ >
12
+ > **Relationship to rules.md**: `rules.md` is the declarative index (BR-ID + one-line summary).
13
+ > This file is the scenario-level detail. Each BR-ID in `rules.md` should have a
14
+ > corresponding section here. If they drift, `/dflow:verify` will catch it.
15
+
16
+ ---
17
+
18
+ <!-- dflow:section behavior-scenarios -->
19
+ ## {Feature Area 1}
20
+
21
+ ### BR-001: {Rule Name}
22
+
23
+ Given {initial state}
24
+ When {action}
25
+ Then {expected result}
26
+
27
+ ### BR-002: {Rule Name}
28
+
29
+ Given {initial state}
30
+ When {action}
31
+ Then {expected result}
32
+
33
+ #### Edge cases
34
+
35
+ - EC-001: Given {edge case state} When {action} Then {handling}
36
+
37
+ ---
38
+
39
+ ## {Feature Area 2}
40
+
41
+ ### BR-003: {Rule Name}
42
+
43
+ Given {initial state}
44
+ When {action}
45
+ Then {expected result}
46
+
47
+ ---
48
+
49
+ <!--
50
+ Maintenance notes:
51
+ - Organize by feature area, not by spec ID (specs are transient; behavior areas are stable)
52
+ - When merging a completed spec, place its scenarios under the matching feature area
53
+ - When a MODIFIED delta changes a rule, update the scenario here to reflect the NEW behavior
54
+ (git history preserves the old version — don't keep "原本/改為" pairs here)
55
+ - When a REMOVED delta drops a rule, delete the corresponding section
56
+ - When a RENAMED delta renames a concept, update all references in this file
57
+ - Keep BR-IDs in sync with rules.md
58
+ -->
@@ -0,0 +1,57 @@
1
+ ---
2
+ context: {ContextName}
3
+ chinese-name: {中文名稱}
4
+ owner: {負責的開發者或團隊}
5
+ created: {YYYY-MM-DD}
6
+ ---
7
+
8
+ # {ContextName} Bounded Context
9
+
10
+ ## Responsibilities
11
+
12
+ > 這個 Context 負責什麼?用 2-3 句話描述。
13
+
14
+ ## Boundaries
15
+
16
+ ### In Scope
17
+ - {職責 1}
18
+ - {職責 2}
19
+
20
+ ### Out of Scope
21
+ - {排除項 1} → 由 {OtherContext} 處理
22
+ - {排除項 2} → 由 {OtherContext} 處理
23
+
24
+ ## Core Domain Models
25
+
26
+ > 詳細定義在 `models.md`,這裡只列出概覽。
27
+
28
+ ### Entities
29
+ - **{EntityName}** — {一句話描述}
30
+
31
+ ### Value Objects
32
+ - **{VOName}** — {一句話描述}
33
+
34
+ ### Domain Services
35
+ - **{ServiceName}** — {一句話描述}
36
+
37
+ ## Interactions with Other Contexts
38
+
39
+ | Other Context | Interaction Type | Description |
40
+ |---|---|---|
41
+ | {OtherContext} | 呼叫 / 事件 / 共享資料 | {描述} |
42
+
43
+ ## Key Business Rules
44
+
45
+ > 規則索引在 `rules.md`(BR-ID + 一行摘要),完整 Behavior Scenarios 在 `behavior.md`(Given/When/Then)。這裡只列最重要的幾條。
46
+
47
+ 1. {最重要的規則}
48
+ 2. {第二重要的規則}
49
+
50
+ ## Code Mapping
51
+
52
+ ### Current WebForms
53
+ - Pages: `src/Pages/{相關頁面}.aspx`
54
+ - Domain: `src/Domain/{Context}/`
55
+
56
+ ### Future ASP.NET Core
57
+ - 預計作為獨立模組/專案
@@ -0,0 +1,25 @@
1
+ <!-- Template maintained by Dflow. See proposals/PROPOSAL-013 for origin. -->
2
+
3
+ # Context Map
4
+
5
+ > Optional bounded context relationship map for WebForms brownfield discovery.
6
+
7
+ ## Context List
8
+
9
+ | Bounded Context | Responsibility | Owner / Team | Primary Code Area | Notes |
10
+ |---|---|---|---|---|
11
+ | {Context name} | {業務責任} | {owner} | `{project/path/or/namespace}` | {optional notes} |
12
+
13
+ ## Relationships
14
+
15
+ | Source Context | Target Context | Relationship Type | Integration Mechanism | Notes |
16
+ |---|---|---|---|---|
17
+ | {Source} | {Target} | {Customer/Supplier, Conformist, ACL, Shared Kernel, etc.} | {DB table, service call, file, manual process} | {optional notes} |
18
+
19
+ ## Integration Notes
20
+
21
+ - {跨 context 的資料流、權責邊界或 legacy coupling}
22
+
23
+ ## Open Questions
24
+
25
+ - {尚未釐清的 context 邊界或整合責任}
@@ -0,0 +1,15 @@
1
+ <!-- Template maintained by Dflow. See proposals/PROPOSAL-013 for origin. -->
2
+
3
+ # Glossary
4
+
5
+ > Ubiquitous Language for this project or bounded context.
6
+
7
+ ## Terms
8
+
9
+ | Term | Definition | Bounded Context | Code Mapping | Notes |
10
+ |---|---|---|---|---|
11
+ | {Term} | {這個術語在業務中的定義} | {Context name} | `{Namespace/Class/Member}` | {optional notes} |
12
+
13
+ ## Open Questions
14
+
15
+ - {需要和 domain expert 確認的術語或命名差異}