dw-kit 1.2.1 → 1.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 (58) hide show
  1. package/.claude/hooks/post-write.sh +64 -58
  2. package/.claude/hooks/pre-commit-gate.sh +96 -90
  3. package/.claude/hooks/privacy-block.sh +99 -94
  4. package/.claude/hooks/progress-ping.sh +53 -47
  5. package/.claude/hooks/safety-guard.sh +60 -54
  6. package/.claude/hooks/scout-block.sh +88 -82
  7. package/.claude/hooks/session-init.sh +6 -0
  8. package/.claude/hooks/stop-check.sh +88 -36
  9. package/.claude/hooks/telemetry-log.sh +34 -0
  10. package/.claude/rules/dw.md +136 -0
  11. package/.claude/settings.json +20 -1
  12. package/.claude/skills/dw-arch-review/SKILL.md +119 -119
  13. package/.claude/skills/dw-archive/SKILL.md +81 -81
  14. package/.claude/skills/dw-commit/SKILL.md +81 -81
  15. package/.claude/skills/dw-config-init/SKILL.md +91 -91
  16. package/.claude/skills/dw-config-validate/SKILL.md +75 -75
  17. package/.claude/skills/dw-dashboard/SKILL.md +209 -209
  18. package/.claude/skills/dw-debug/SKILL.md +97 -97
  19. package/.claude/skills/dw-decision/SKILL.md +116 -0
  20. package/.claude/skills/dw-docs-update/SKILL.md +125 -125
  21. package/.claude/skills/dw-estimate/SKILL.md +90 -90
  22. package/.claude/skills/dw-execute/SKILL.md +98 -98
  23. package/.claude/skills/dw-flow/SKILL.md +274 -274
  24. package/.claude/skills/dw-handoff/SKILL.md +81 -81
  25. package/.claude/skills/dw-kit-report/SKILL.md +152 -152
  26. package/.claude/skills/dw-log-work/SKILL.md +69 -69
  27. package/.claude/skills/dw-onboard/SKILL.md +201 -201
  28. package/.claude/skills/dw-plan/SKILL.md +125 -125
  29. package/.claude/skills/dw-prompt/SKILL.md +62 -62
  30. package/.claude/skills/dw-requirements/SKILL.md +98 -98
  31. package/.claude/skills/dw-research/SKILL.md +114 -114
  32. package/.claude/skills/dw-retroactive/SKILL.md +311 -311
  33. package/.claude/skills/dw-review/SKILL.md +66 -66
  34. package/.claude/skills/dw-rollback/SKILL.md +90 -90
  35. package/.claude/skills/dw-sprint-review/SKILL.md +99 -99
  36. package/.claude/skills/dw-task-init/SKILL.md +59 -59
  37. package/.claude/skills/dw-test-plan/SKILL.md +113 -113
  38. package/.claude/skills/dw-thinking/SKILL.md +70 -70
  39. package/.claude/skills/dw-upgrade/SKILL.md +72 -72
  40. package/.dw/core/PILLARS.md +122 -0
  41. package/.dw/core/templates/v2/spec.md +68 -0
  42. package/.dw/core/templates/v2/tracking.md +62 -0
  43. package/.dw/core/v14-evaluation-protocol.md +118 -0
  44. package/CLAUDE.md +42 -39
  45. package/MIGRATION-v1.3.md +201 -0
  46. package/README.md +35 -6
  47. package/package.json +4 -2
  48. package/src/cli.mjs +29 -1
  49. package/src/commands/dashboard.mjs +116 -0
  50. package/src/commands/doctor.mjs +165 -149
  51. package/src/commands/init.mjs +339 -332
  52. package/src/commands/metrics.mjs +165 -0
  53. package/src/lib/active-index.mjs +87 -0
  54. package/src/lib/cut-analysis.mjs +161 -0
  55. package/src/lib/telemetry.mjs +80 -0
  56. package/.claude/rules/dw-core.md +0 -100
  57. package/.claude/rules/dw-skills.md +0 -53
  58. package/.claude/rules/workflow-rules.md +0 -77
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: dw:decision
3
+ description: "Tạo hoặc update Architecture Decision Record (ADR). Tự động đánh số, dùng template chuẩn. Wizard hướng dẫn qua: Context → Options → Decision → Consequences."
4
+ argument-hint: "[tên quyết định ngắn gọn]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ # ADR Wizard
9
+
10
+ Decision: **$ARGUMENTS**
11
+
12
+ ## Bước 1 — Xác định số ADR
13
+
14
+ 1. Đọc `.dw/decisions/` (tạo nếu chưa có)
15
+ 2. Tìm file `NNNN-*.md` có số cao nhất
16
+ 3. New ID: `ADR-{max+1}` zero-padded 4 digits
17
+
18
+ ## Bước 2 — Thu thập input (hỏi user từng section)
19
+
20
+ ### Context
21
+ - Tại sao decision này cần được đưa ra?
22
+ - Forces đang tác động? (deadline, constraint, incident, opportunity)
23
+ - Current state dẫn đến decision này là gì?
24
+
25
+ ### Options Considered (BẮT BUỘC ≥2 phương án)
26
+
27
+ Cho MỖI option hỏi:
28
+ - **Option N: {Name}**
29
+ - **Pros:** (≥2 điểm cụ thể, không vague)
30
+ - **Cons:** (≥1 điểm thật, không "not chosen" placeholder)
31
+ - **Rejected because:** (nếu không chọn — lý do từ góc nhìn người quyết định)
32
+
33
+ ### Decision
34
+ - Option nào được chọn?
35
+ - **Why this one** (not "because it's best" — cite concrete reason từ context)
36
+
37
+ ### Consequences
38
+ - **Positive:** (≥2 outcomes expected)
39
+ - **Negative (trade-offs chấp nhận):** (≥1 — nếu nói "no cons" thì chưa nghĩ đủ)
40
+ - **Neutral:** (optional — side effects không tốt cũng không xấu)
41
+
42
+ ### Metadata
43
+ - **Status:** default `Proposed`
44
+ - **Impact:** `patch` (small) | `minor` (feature-level) | `major` (breaking or strategic)
45
+ - **Deciders:** tên hoặc role
46
+ - **Cost estimate** (optional): rough effort
47
+
48
+ ## Bước 3 — Tạo file
49
+
50
+ Path: `.dw/decisions/{NNNN}-{kebab-case-title}.md`
51
+
52
+ Copy structure từ `.dw/decisions/_template.md`. Điền:
53
+
54
+ ```yaml
55
+ ---
56
+ id: ADR-{NNNN}
57
+ title: {title}
58
+ status: Proposed
59
+ date: {YYYY-MM-DD}
60
+ deciders: {name}
61
+ impact: {patch|minor|major}
62
+ supersedes: null
63
+ superseded-by: null
64
+ ---
65
+ ```
66
+
67
+ Nếu là major impact → thêm section **Assumptions & Invalidation Triggers** và **Commitment Signals** (time-box).
68
+
69
+ ## Bước 4 — Confirm & save
70
+
71
+ Show preview (first 30 lines) rồi ask:
72
+ ```
73
+ Save this ADR to .dw/decisions/{NNNN}-{title}.md? (Y/n)
74
+ ```
75
+
76
+ Nếu yes → write file + print:
77
+ ```
78
+ ✓ ADR-{NNNN} created
79
+ Status: Proposed
80
+ Next: Review → change status to Accepted when approved
81
+ Related task: update tracking.md với reference
82
+ ```
83
+
84
+ ## Quality Bar
85
+
86
+ Reject auto-save nếu detect:
87
+ - Options considered < 2
88
+ - No "Rejected because" lý do cho options loại
89
+ - Consequences Negative trống (nghĩa là không nghĩ kỹ)
90
+ - Decision không cite cụ thể evidence từ context
91
+
92
+ Trong các case này, đẩy lại user với câu hỏi clarify.
93
+
94
+ ## Khi NÀO Dùng ADR
95
+
96
+ ✅ Architectural choice (framework, DB, pattern)
97
+ ✅ Cross-cutting concern (auth, caching, logging)
98
+ ✅ Breaking change affecting users
99
+ ✅ Trade-off với long-term implications
100
+ ✅ Decision reverses earlier ADR (mark old as Superseded)
101
+
102
+ ❌ Bug fix (commit message đủ)
103
+ ❌ Implementation detail (code comments đủ)
104
+ ❌ Personal style preference
105
+
106
+ ## Examples
107
+
108
+ - `.dw/decisions/0001-v2-pragmatic-lean.md` — strategic direction (major)
109
+ - `.dw/decisions/0002-skill-naming-namespace.md` — breaking UX change (minor)
110
+
111
+ ## Super-power: Link related task
112
+
113
+ Sau khi save ADR, nếu đang trong task folder (check `.dw/tasks/*/tracking.md` có reference đến decision này không):
114
+
115
+ 1. Append vào `tracking.md` section Changelog: `Referenced: ADR-{NNNN}`
116
+ 2. Update `spec.md` frontmatter `related_adr: ADR-{NNNN}` nếu chưa có
@@ -1,125 +1,125 @@
1
- ---
2
- name: dw-docs-update
3
- description: "Cập nhật living docs khi code thay đổi. Phát hiện docs lỗi thời và cập nhật tự động. Dùng sau khi execute hoặc commit."
4
- argument-hint: "[scope: all | architecture | api | models | task-name]"
5
- ---
6
-
7
- # Cập Nhật Living Docs
8
-
9
- Scope: **$ARGUMENTS**
10
-
11
- ## Đọc Config
12
-
13
- Đọc `.dw/config/dw.config.yml` → kiểm tra:
14
- - `paths.docs` → thư mục living docs (mặc định: `.dw/docs`)
15
- - `workflow.default_depth` → nếu `quick`, gợi ý nhưng không bắt buộc
16
-
17
- ## Living Docs Structure
18
-
19
- ```
20
- {paths.docs}/
21
- ├── ARCHITECTURE.md # Kiến trúc tổng quan hệ thống
22
- ├── API.md # API endpoints & contracts
23
- ├── DATA-MODELS.md # Database schema & data models
24
- ├── DECISIONS.md # Architecture Decision Records (ADR)
25
- ├── GLOSSARY.md # Thuật ngữ dự án
26
- ├── SETUP.md # Hướng dẫn setup & chạy dự án
27
- └── modules/
28
- └── [module-name].md # Docs riêng cho từng module
29
- ```
30
-
31
- ## Quy Trình
32
-
33
- ### Bước 0: Scaffold (lần đầu chạy)
34
-
35
- Nếu `{paths.docs}/` không tồn tại hoặc trống → tạo cấu trúc ban đầu:
36
- ```bash
37
- mkdir -p {paths.docs}/modules
38
- ```
39
- Tạo các file skeleton: `ARCHITECTURE.md`, `API.md`, `DATA-MODELS.md`, `DECISIONS.md`, `GLOSSARY.md`, `SETUP.md`.
40
- Thông báo: "Khởi tạo living docs tại `{paths.docs}/` — lần chạy đầu tiên."
41
-
42
- ### Nếu scope = "all" hoặc không có argument
43
-
44
- 1. **Detect changes**:
45
- ```bash
46
- git diff --name-only HEAD~10 # 10 commits gần nhất
47
- git diff --name-only --cached # staged changes
48
- ```
49
-
50
- 2. **Classify changes** theo pattern:
51
- | Pattern file | Docs cần update |
52
- |-------------|-----------------|
53
- | `*model*`, `*schema*`, `*migration*`, `*entity*` | `DATA-MODELS.md` |
54
- | `*route*`, `*controller*`, `*handler*`, `*endpoint*` | `API.md` |
55
- | `*config*`, `*app.*`, `package.json`, `*.yml` | `ARCHITECTURE.md` |
56
- | `*.md` trong project (không phải `.dw/docs/`) | Kiểm tra DECISIONS.md |
57
- | Thư mục mới xuất hiện | `ARCHITECTURE.md` + tạo `modules/[name].md` |
58
-
59
- 3. **Stale check**: Với mỗi doc cần update, đọc nội dung hiện tại, so sánh với code thực tế. Ghi rõ: "Phần X đang mô tả Y nhưng code hiện tại là Z."
60
-
61
- 4. **Update**: Chỉ cập nhật những gì thực sự lỗi thời. Thêm timestamp cuối mỗi update.
62
-
63
- ### Nếu scope = "architecture"
64
- - Đọc cấu trúc thư mục, main config files, entry points
65
- - Cập nhật ARCHITECTURE.md với cấu trúc hiện tại
66
-
67
- ### Nếu scope = "api"
68
- - Grep tất cả route/endpoint definitions
69
- - Cập nhật API.md với danh sách endpoints hiện tại
70
-
71
- ### Nếu scope = "models"
72
- - Đọc schema definitions, migration files, model files
73
- - Cập nhật DATA-MODELS.md
74
-
75
- ### Nếu scope = [task-name]
76
- - Đọc progress file của task
77
- - Cập nhật docs liên quan đến thay đổi của task
78
-
79
- ## Khi Tạo Doc Mới (lần đầu)
80
-
81
- Nếu file doc chưa tồn tại → tạo mới với cấu trúc chuẩn:
82
-
83
- ### ARCHITECTURE.md
84
- ```markdown
85
- # Kiến Trúc Hệ Thống
86
-
87
- ## Tổng Quan
88
- [Mô tả high-level]
89
-
90
- ## Tech Stack
91
- | Layer | Technology |
92
- |-------|-----------|
93
-
94
- ## Cấu Trúc Thư Mục
95
- [Tree structure]
96
-
97
- ## Modules
98
- | Module | Vai trò | Entry point |
99
- |--------|---------|-------------|
100
-
101
- ## Data Flow
102
- [Diagram]
103
-
104
- ## Cập nhật lần cuối: [date]
105
- ```
106
-
107
- ### DECISIONS.md (ADR Format)
108
- ```markdown
109
- # Architecture Decision Records
110
-
111
- ## ADR-001: [Tiêu đề]
112
- - **Ngày**: [date]
113
- - **Trạng thái**: Accepted | Superseded | Deprecated
114
- - **Bối cảnh**: [Tại sao cần quyết định]
115
- - **Quyết định**: [Đã chọn gì]
116
- - **Hệ quả**: [Ảnh hưởng]
117
- ```
118
-
119
- ## Output
120
-
121
- Sau khi cập nhật, báo cáo:
122
- - Files đã cập nhật: [danh sách]
123
- - Thay đổi chính: [tóm tắt]
124
- - Docs vẫn có thể stale: [nếu có]
125
- - Ghi timestamp "Cập nhật lần cuối" vào mỗi doc file
1
+ ---
2
+ name: dw:docs-update
3
+ description: "Cập nhật living docs khi code thay đổi. Phát hiện docs lỗi thời và cập nhật tự động. Dùng sau khi execute hoặc commit."
4
+ argument-hint: "[scope: all | architecture | api | models | task-name]"
5
+ ---
6
+
7
+ # Cập Nhật Living Docs
8
+
9
+ Scope: **$ARGUMENTS**
10
+
11
+ ## Đọc Config
12
+
13
+ Đọc `.dw/config/dw.config.yml` → kiểm tra:
14
+ - `paths.docs` → thư mục living docs (mặc định: `.dw/docs`)
15
+ - `workflow.default_depth` → nếu `quick`, gợi ý nhưng không bắt buộc
16
+
17
+ ## Living Docs Structure
18
+
19
+ ```
20
+ {paths.docs}/
21
+ ├── ARCHITECTURE.md # Kiến trúc tổng quan hệ thống
22
+ ├── API.md # API endpoints & contracts
23
+ ├── DATA-MODELS.md # Database schema & data models
24
+ ├── DECISIONS.md # Architecture Decision Records (ADR)
25
+ ├── GLOSSARY.md # Thuật ngữ dự án
26
+ ├── SETUP.md # Hướng dẫn setup & chạy dự án
27
+ └── modules/
28
+ └── [module-name].md # Docs riêng cho từng module
29
+ ```
30
+
31
+ ## Quy Trình
32
+
33
+ ### Bước 0: Scaffold (lần đầu chạy)
34
+
35
+ Nếu `{paths.docs}/` không tồn tại hoặc trống → tạo cấu trúc ban đầu:
36
+ ```bash
37
+ mkdir -p {paths.docs}/modules
38
+ ```
39
+ Tạo các file skeleton: `ARCHITECTURE.md`, `API.md`, `DATA-MODELS.md`, `DECISIONS.md`, `GLOSSARY.md`, `SETUP.md`.
40
+ Thông báo: "Khởi tạo living docs tại `{paths.docs}/` — lần chạy đầu tiên."
41
+
42
+ ### Nếu scope = "all" hoặc không có argument
43
+
44
+ 1. **Detect changes**:
45
+ ```bash
46
+ git diff --name-only HEAD~10 # 10 commits gần nhất
47
+ git diff --name-only --cached # staged changes
48
+ ```
49
+
50
+ 2. **Classify changes** theo pattern:
51
+ | Pattern file | Docs cần update |
52
+ |-------------|-----------------|
53
+ | `*model*`, `*schema*`, `*migration*`, `*entity*` | `DATA-MODELS.md` |
54
+ | `*route*`, `*controller*`, `*handler*`, `*endpoint*` | `API.md` |
55
+ | `*config*`, `*app.*`, `package.json`, `*.yml` | `ARCHITECTURE.md` |
56
+ | `*.md` trong project (không phải `.dw/docs/`) | Kiểm tra DECISIONS.md |
57
+ | Thư mục mới xuất hiện | `ARCHITECTURE.md` + tạo `modules/[name].md` |
58
+
59
+ 3. **Stale check**: Với mỗi doc cần update, đọc nội dung hiện tại, so sánh với code thực tế. Ghi rõ: "Phần X đang mô tả Y nhưng code hiện tại là Z."
60
+
61
+ 4. **Update**: Chỉ cập nhật những gì thực sự lỗi thời. Thêm timestamp cuối mỗi update.
62
+
63
+ ### Nếu scope = "architecture"
64
+ - Đọc cấu trúc thư mục, main config files, entry points
65
+ - Cập nhật ARCHITECTURE.md với cấu trúc hiện tại
66
+
67
+ ### Nếu scope = "api"
68
+ - Grep tất cả route/endpoint definitions
69
+ - Cập nhật API.md với danh sách endpoints hiện tại
70
+
71
+ ### Nếu scope = "models"
72
+ - Đọc schema definitions, migration files, model files
73
+ - Cập nhật DATA-MODELS.md
74
+
75
+ ### Nếu scope = [task-name]
76
+ - Đọc progress file của task
77
+ - Cập nhật docs liên quan đến thay đổi của task
78
+
79
+ ## Khi Tạo Doc Mới (lần đầu)
80
+
81
+ Nếu file doc chưa tồn tại → tạo mới với cấu trúc chuẩn:
82
+
83
+ ### ARCHITECTURE.md
84
+ ```markdown
85
+ # Kiến Trúc Hệ Thống
86
+
87
+ ## Tổng Quan
88
+ [Mô tả high-level]
89
+
90
+ ## Tech Stack
91
+ | Layer | Technology |
92
+ |-------|-----------|
93
+
94
+ ## Cấu Trúc Thư Mục
95
+ [Tree structure]
96
+
97
+ ## Modules
98
+ | Module | Vai trò | Entry point |
99
+ |--------|---------|-------------|
100
+
101
+ ## Data Flow
102
+ [Diagram]
103
+
104
+ ## Cập nhật lần cuối: [date]
105
+ ```
106
+
107
+ ### DECISIONS.md (ADR Format)
108
+ ```markdown
109
+ # Architecture Decision Records
110
+
111
+ ## ADR-001: [Tiêu đề]
112
+ - **Ngày**: [date]
113
+ - **Trạng thái**: Accepted | Superseded | Deprecated
114
+ - **Bối cảnh**: [Tại sao cần quyết định]
115
+ - **Quyết định**: [Đã chọn gì]
116
+ - **Hệ quả**: [Ảnh hưởng]
117
+ ```
118
+
119
+ ## Output
120
+
121
+ Sau khi cập nhật, báo cáo:
122
+ - Files đã cập nhật: [danh sách]
123
+ - Thay đổi chính: [tóm tắt]
124
+ - Docs vẫn có thể stale: [nếu có]
125
+ - Ghi timestamp "Cập nhật lần cuối" vào mỗi doc file
@@ -1,90 +1,90 @@
1
- ---
2
- name: dw-estimate
3
- description: "Ước lượng effort cho task. Phân tích subtasks từ plan và đưa ra estimate theo đơn vị cấu hình (hours/story-points/t-shirt). Dùng sau /plan."
4
- argument-hint: "[task-name]"
5
- allowed-tools:
6
- - Read
7
- - Grep
8
- - Glob
9
- ---
10
-
11
- # Ước Lượng Effort
12
-
13
- Task: **$ARGUMENTS**
14
-
15
- ## Đọc Config
16
-
17
- Đọc `.dw/config/dw.config.yml`:
18
- - `tracking.estimation` — nếu `false` → thông báo "Estimation chưa bật cho project này" và DỪNG
19
- - `tracking.estimation_unit` → đơn vị (hours / story-points / t-shirt)
20
- - `paths.tasks` → location task docs
21
-
22
- ## Điều Kiện
23
-
24
- Nếu chưa có plan (`{paths.tasks}/$ARGUMENTS/$ARGUMENTS-plan.md`) → thông báo cần chạy `/dw-plan` trước.
25
-
26
- ## Quy Trình Estimation
27
-
28
- ### 1. Đọc plan & context
29
- - Đọc toàn bộ subtasks
30
- - Đọc context để hiểu technical complexity
31
- - Hiểu dependencies giữa subtasks
32
-
33
- ### 2. Estimate từng subtask
34
-
35
- Với mỗi subtask, phân tích:
36
- - **Complexity**: Low / Medium / High
37
- - Low: Rõ ràng, ít dependencies, code cũ đã có pattern
38
- - Medium: Cần thiết kế, có vài dependencies
39
- - High: Phức tạp, nhiều unknowns, cần research thêm
40
- - **Uncertainty**: Low / Medium / High (có unknown chưa giải quyết?)
41
- - **Estimate**: Dựa trên complexity + uncertainty
42
-
43
- **Reference nhanh (hours):**
44
- | Complexity | Low uncertainty | Medium | High uncertainty |
45
- |-----------|-----------------|--------|-----------------|
46
- | Low | 1-2h | 2-4h | 4-8h |
47
- | Medium | 2-4h | 4-8h | 8-16h |
48
- | High | 4-8h | 8-16h | 16-40h |
49
-
50
- **Reference (story points - Fibonacci):** 1, 2, 3, 5, 8, 13, 21
51
- **Reference (t-shirt):** XS(<2h), S(2-4h), M(4-8h), L(8-16h), XL(16-40h), XXL(>40h)
52
-
53
- ### 3. Uncertainty buffer
54
-
55
- - Low uncertainty overall: +0%
56
- - Medium: +20%
57
- - High: +50%
58
- - Nhiều unknowns / first-time tech: +100% (double)
59
-
60
- ### 4. Breakdown theo categories
61
-
62
- ```
63
- Research: [X]
64
- Planning: [done]
65
- Coding: [X per subtask]
66
- Testing: [X — thường 20-30% coding]
67
- Review: [X — thường 10-15% coding]
68
- Documentation: [X — nếu living docs bật]
69
- Buffer: [X%]
70
- Total: [sum]
71
- ```
72
-
73
- ## Ghi Vào Plan
74
-
75
- Cập nhật phần "Estimation Tổng" trong plan file.
76
-
77
- ## Trình Bày
78
-
79
- ```markdown
80
- ## Estimation Summary: $ARGUMENTS
81
-
82
- | Subtask | Complexity | Uncertainty | Estimate |
83
- |---------|-----------|-------------|---------|
84
- | ST-1 | Low | Low | 2h |
85
- | ST-2 | Medium | Medium | 6h |
86
-
87
- **Total Estimate**: X hours (với buffer Y%)
88
- **Confidence**: High / Medium / Low
89
- **Risk note**: [nếu có unknowns lớn]
90
- ```
1
+ ---
2
+ name: dw:estimate
3
+ description: "Ước lượng effort cho task. Phân tích subtasks từ plan và đưa ra estimate theo đơn vị cấu hình (hours/story-points/t-shirt). Dùng sau /plan."
4
+ argument-hint: "[task-name]"
5
+ allowed-tools:
6
+ - Read
7
+ - Grep
8
+ - Glob
9
+ ---
10
+
11
+ # Ước Lượng Effort
12
+
13
+ Task: **$ARGUMENTS**
14
+
15
+ ## Đọc Config
16
+
17
+ Đọc `.dw/config/dw.config.yml`:
18
+ - `tracking.estimation` — nếu `false` → thông báo "Estimation chưa bật cho project này" và DỪNG
19
+ - `tracking.estimation_unit` → đơn vị (hours / story-points / t-shirt)
20
+ - `paths.tasks` → location task docs
21
+
22
+ ## Điều Kiện
23
+
24
+ Nếu chưa có plan (`{paths.tasks}/$ARGUMENTS/$ARGUMENTS-plan.md`) → thông báo cần chạy `/dw:plan` trước.
25
+
26
+ ## Quy Trình Estimation
27
+
28
+ ### 1. Đọc plan & context
29
+ - Đọc toàn bộ subtasks
30
+ - Đọc context để hiểu technical complexity
31
+ - Hiểu dependencies giữa subtasks
32
+
33
+ ### 2. Estimate từng subtask
34
+
35
+ Với mỗi subtask, phân tích:
36
+ - **Complexity**: Low / Medium / High
37
+ - Low: Rõ ràng, ít dependencies, code cũ đã có pattern
38
+ - Medium: Cần thiết kế, có vài dependencies
39
+ - High: Phức tạp, nhiều unknowns, cần research thêm
40
+ - **Uncertainty**: Low / Medium / High (có unknown chưa giải quyết?)
41
+ - **Estimate**: Dựa trên complexity + uncertainty
42
+
43
+ **Reference nhanh (hours):**
44
+ | Complexity | Low uncertainty | Medium | High uncertainty |
45
+ |-----------|-----------------|--------|-----------------|
46
+ | Low | 1-2h | 2-4h | 4-8h |
47
+ | Medium | 2-4h | 4-8h | 8-16h |
48
+ | High | 4-8h | 8-16h | 16-40h |
49
+
50
+ **Reference (story points - Fibonacci):** 1, 2, 3, 5, 8, 13, 21
51
+ **Reference (t-shirt):** XS(<2h), S(2-4h), M(4-8h), L(8-16h), XL(16-40h), XXL(>40h)
52
+
53
+ ### 3. Uncertainty buffer
54
+
55
+ - Low uncertainty overall: +0%
56
+ - Medium: +20%
57
+ - High: +50%
58
+ - Nhiều unknowns / first-time tech: +100% (double)
59
+
60
+ ### 4. Breakdown theo categories
61
+
62
+ ```
63
+ Research: [X]
64
+ Planning: [done]
65
+ Coding: [X per subtask]
66
+ Testing: [X — thường 20-30% coding]
67
+ Review: [X — thường 10-15% coding]
68
+ Documentation: [X — nếu living docs bật]
69
+ Buffer: [X%]
70
+ Total: [sum]
71
+ ```
72
+
73
+ ## Ghi Vào Plan
74
+
75
+ Cập nhật phần "Estimation Tổng" trong plan file.
76
+
77
+ ## Trình Bày
78
+
79
+ ```markdown
80
+ ## Estimation Summary: $ARGUMENTS
81
+
82
+ | Subtask | Complexity | Uncertainty | Estimate |
83
+ |---------|-----------|-------------|---------|
84
+ | ST-1 | Low | Low | 2h |
85
+ | ST-2 | Medium | Medium | 6h |
86
+
87
+ **Total Estimate**: X hours (với buffer Y%)
88
+ **Confidence**: High / Medium / Low
89
+ **Risk note**: [nếu có unknowns lớn]
90
+ ```