dw-kit 1.4.0 → 1.7.0-rc.1
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/.claude/agents/executor.md +80 -80
- package/.claude/hooks/pre-commit-gate.sh +59 -0
- package/.claude/hooks/stop-check.sh +111 -31
- package/.claude/rules/commit-standards.md +48 -37
- package/.claude/rules/dw.md +47 -11
- package/.claude/skills/dw-commit/SKILL.md +7 -4
- package/.claude/skills/dw-decision/SKILL.md +5 -4
- package/.claude/skills/dw-execute/SKILL.md +18 -5
- package/.claude/skills/dw-handoff/SKILL.md +8 -3
- package/.claude/skills/dw-plan/SKILL.md +15 -2
- package/.claude/skills/dw-research/SKILL.md +7 -5
- package/.claude/skills/dw-retroactive/SKILL.md +75 -63
- package/.claude/skills/dw-task-init/SKILL.md +40 -35
- package/.dw/adapters/generic/AGENT.md +171 -169
- package/.dw/core/WORKFLOW.md +450 -450
- package/.dw/core/schemas/agent-claim.schema.json +127 -0
- package/.dw/core/schemas/agent-report.schema.json +72 -0
- package/.dw/core/schemas/goal-frontmatter.schema.json +84 -0
- package/.dw/core/schemas/task-frontmatter.schema.json +97 -0
- package/.dw/core/templates/v3/goal.md +146 -0
- package/.dw/core/templates/v3/task.md +188 -0
- package/CLAUDE.md +2 -2
- package/MIGRATION-v1.5.md +330 -0
- package/README.md +17 -0
- package/package.json +3 -2
- package/src/cli.mjs +312 -0
- package/src/commands/agent-claim.mjs +235 -0
- package/src/commands/agent-inspect.mjs +123 -0
- package/src/commands/doctor.mjs +64 -0
- package/src/commands/goal-bump.mjs +50 -0
- package/src/commands/goal-delete.mjs +120 -0
- package/src/commands/goal-link.mjs +126 -0
- package/src/commands/goal-lint.mjs +152 -0
- package/src/commands/goal-new.mjs +86 -0
- package/src/commands/goal-portfolio.mjs +84 -0
- package/src/commands/goal-render.mjs +49 -0
- package/src/commands/goal-set.mjs +62 -0
- package/src/commands/goal-show.mjs +94 -0
- package/src/commands/goal-stubs.mjs +21 -0
- package/src/commands/goal-suggest-krs.mjs +139 -0
- package/src/commands/goal-summary.mjs +67 -0
- package/src/commands/goal-view.mjs +196 -0
- package/src/commands/lint-task.mjs +112 -0
- package/src/commands/task-migrate.mjs +471 -0
- package/src/commands/task-new.mjs +90 -0
- package/src/commands/task-render.mjs +235 -0
- package/src/commands/task-rotate.mjs +168 -0
- package/src/commands/task-show.mjs +137 -0
- package/src/commands/task-summary.mjs +68 -0
- package/src/commands/task-view.mjs +386 -0
- package/src/commands/task-watch.mjs +868 -0
- package/src/lib/active-index.mjs +19 -1
- package/src/lib/agent-claim.mjs +173 -0
- package/src/lib/agent-conflict.mjs +137 -0
- package/src/lib/agent-events.mjs +43 -0
- package/src/lib/agent-report.mjs +96 -0
- package/src/lib/frontmatter.mjs +72 -0
- package/src/lib/goal-events.mjs +79 -0
- package/src/lib/goal-store.mjs +202 -0
- package/src/lib/goal-svg.mjs +293 -0
- package/src/lib/goal-watch.mjs +133 -0
- package/src/lib/lint-rules.mjs +149 -0
- package/src/lib/sse-broker.mjs +91 -0
- package/src/lib/timeline-parser.mjs +80 -0
- package/src/lib/watch-auth.mjs +64 -0
package/.dw/core/WORKFLOW.md
CHANGED
|
@@ -1,450 +1,450 @@
|
|
|
1
|
-
<!-- core-version: 1.0 -->
|
|
2
|
-
<!-- last-updated: 2026-03-23 -->
|
|
3
|
-
|
|
4
|
-
# dw-kit Workflow Methodology
|
|
5
|
-
|
|
6
|
-
> **Platform-agnostic.** File này chứa methodology thuần — không có Claude syntax, không có tool names.
|
|
7
|
-
> Platform-specific execution nằm trong `.dw/adapters/`.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Mục Lục
|
|
12
|
-
|
|
13
|
-
- [Phase 1: Initialize](#phase-initialize)
|
|
14
|
-
- [Phase 2: Understand](#phase-understand)
|
|
15
|
-
- [Phase 3: Plan](#phase-plan)
|
|
16
|
-
- [Phase 4: Execute](#phase-execute)
|
|
17
|
-
- [Phase 5: Verify](#phase-verify)
|
|
18
|
-
- [Phase 6: Close](#phase-close)
|
|
19
|
-
- [Standalone: Debug](#standalone-debug)
|
|
20
|
-
- [Standalone: Reports](#standalone-reports)
|
|
21
|
-
- [Meta: Config & Maintenance](#meta-config)
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Routing: Chọn Depth Phù Hợp
|
|
26
|
-
|
|
27
|
-
Đọc `default_depth` từ config. AI sẽ recommend depth dựa trên assessment.
|
|
28
|
-
`default_depth` là baseline cho project, nhưng **depth có thể override theo từng task**.
|
|
29
|
-
|
|
30
|
-
| Depth | Khi nào dùng | Phases bắt buộc |
|
|
31
|
-
|-------|-------------|-----------------|
|
|
32
|
-
| `quick` | ≤2 files, hotfix, familiar module (touched < 7 ngày) | Understand → Execute → Close |
|
|
33
|
-
| `standard` | 3-5 files, module mới, unfamiliar code | Tất cả 6 phases |
|
|
34
|
-
| `thorough` | 6+ files, API contract changes, DB schema, security-sensitive | Tất cả 6 phases + arch-review + test-plan |
|
|
35
|
-
|
|
36
|
-
**Criteria AI dùng để assess (facts, không intuition):**
|
|
37
|
-
- File count thay đổi
|
|
38
|
-
- API contract changes (public endpoints, exported functions)
|
|
39
|
-
- Database schema changes
|
|
40
|
-
- Security-sensitive code (auth, crypto, permissions)
|
|
41
|
-
- Module familiarity (git blame xem last touched)
|
|
42
|
-
|
|
43
|
-
### Task-Level Depth Override (Khuyến nghị)
|
|
44
|
-
|
|
45
|
-
Mỗi task nên có depth riêng, không khóa cứng theo project:
|
|
46
|
-
|
|
47
|
-
- **Default**: dùng `workflow.default_depth` từ `.dw/config/dw.config.yml`
|
|
48
|
-
- **Override**: ghi trực tiếp trong task docs (ví dụ `context.md`)
|
|
49
|
-
- **Rule**: task nào có API/DB/security scope thì có thể nâng lên `thorough` dù project đang `standard`
|
|
50
|
-
|
|
51
|
-
Ưu tiên thực tế: `default_depth` giúp setup nhanh, còn execution quyết định theo rủi ro từng task.
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
<!-- @phase:initialize -->
|
|
56
|
-
## Phase 1: Initialize
|
|
57
|
-
|
|
58
|
-
**Mục tiêu**: Chuẩn bị workspace và hiểu rõ yêu cầu trước khi bắt đầu.
|
|
59
|
-
|
|
60
|
-
### Guided Questions
|
|
61
|
-
|
|
62
|
-
Trả lời trước khi tiếp tục:
|
|
63
|
-
|
|
64
|
-
1. **Task là gì?** Mô tả ngắn 1-2 câu.
|
|
65
|
-
2. **Output mong đợi là gì?** Hành vi nào cần thay đổi / tính năng nào cần thêm?
|
|
66
|
-
3. **Ai sẽ bị ảnh hưởng?** User cuối / developer / system?
|
|
67
|
-
4. **Có deadline không?** Nếu có, ảnh hưởng đến depth choice?
|
|
68
|
-
5. **Có dependencies không?** Task này chờ task khác, hoặc task khác chờ task này?
|
|
69
|
-
6. **Task depth override không?** (`quick|standard|thorough`) Nếu có, ghi rõ lý do.
|
|
70
|
-
|
|
71
|
-
### Output Phase 1
|
|
72
|
-
|
|
73
|
-
- [ ] Task docs tạo tại `{paths.tasks}/[task-name]/`
|
|
74
|
-
- [ ] 3 files: `[name]-context.md`, `[name]-plan.md`, `[name]-progress.md`
|
|
75
|
-
- [ ] Context file có: yêu cầu gốc + scope assessment + depth recommendation
|
|
76
|
-
|
|
77
|
-
### Readiness Check
|
|
78
|
-
|
|
79
|
-
Đủ điều kiện sang Phase 2 khi:
|
|
80
|
-
- Yêu cầu rõ ràng (không ambiguous)
|
|
81
|
-
- Depth đã chọn
|
|
82
|
-
- Task docs tạo xong
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
<!-- @phase:understand -->
|
|
87
|
-
## Phase 2: Understand
|
|
88
|
-
|
|
89
|
-
**Mục tiêu**: Khảo sát codebase để hiểu đầy đủ trước khi thiết kế solution. **Không code ở phase này.**
|
|
90
|
-
|
|
91
|
-
### Quy Trình Khảo Sát
|
|
92
|
-
|
|
93
|
-
1. **Breadth first**: Tìm tất cả files, modules liên quan đến task
|
|
94
|
-
2. **Dependency mapping**: Ai gọi gì, data đi từ đâu đến đâu
|
|
95
|
-
3. **Pattern recognition**: Conventions, design patterns trong project hiện tại
|
|
96
|
-
4. **History**: Thay đổi gần đây liên quan (git log/blame)
|
|
97
|
-
5. **Test coverage**: Hiện tại cover gì, thiếu gì
|
|
98
|
-
6. **Gaps**: Gì chưa rõ, cần làm rõ trước khi plan
|
|
99
|
-
|
|
100
|
-
### Guided Questions
|
|
101
|
-
|
|
102
|
-
Phải có câu trả lời cho tất cả trước khi kết thúc phase:
|
|
103
|
-
|
|
104
|
-
1. **Files nào sẽ thay đổi?** Liệt kê cụ thể.
|
|
105
|
-
2. **Ai phụ thuộc vào những files đó?** Upstream và downstream.
|
|
106
|
-
3. **Pattern hiện tại là gì?** Tôi nên follow pattern nào?
|
|
107
|
-
4. **Test coverage hiện tại?** Thiếu ở đâu?
|
|
108
|
-
5. **Có gotchas/tech debt nào liên quan?** Git history có gì cảnh báo?
|
|
109
|
-
6. **Giả định nào tôi đang dùng?** Có thể sai không?
|
|
110
|
-
|
|
111
|
-
### Context Completion Protocol
|
|
112
|
-
|
|
113
|
-
Khi context thiếu, AI không dừng và chờ. AI:
|
|
114
|
-
1. Phân tích codebase để pre-fill answers
|
|
115
|
-
2. Trình bày: "Tôi tìm được: [findings]. Xác nhận hoặc sửa?"
|
|
116
|
-
3. Developer confirm/correct
|
|
117
|
-
4. Proceed
|
|
118
|
-
|
|
119
|
-
### Output Phase 2
|
|
120
|
-
|
|
121
|
-
- [ ] `[name]-context.md` điền đầy đủ
|
|
122
|
-
- [ ] Files liên quan: listed với vai trò rõ ràng
|
|
123
|
-
- [ ] Kiến trúc hiện tại: documented (diagram nếu cần)
|
|
124
|
-
- [ ] Gaps: identified, resolved hoặc flagged
|
|
125
|
-
- [ ] Test coverage: assessed
|
|
126
|
-
|
|
127
|
-
### Readiness Check
|
|
128
|
-
|
|
129
|
-
Đủ điều kiện sang Phase 3 khi:
|
|
130
|
-
- Tất cả 6 guided questions có câu trả lời
|
|
131
|
-
- Không còn câu hỏi critical chưa giải đáp
|
|
132
|
-
- Files liên quan đã identified
|
|
133
|
-
|
|
134
|
-
> **Quick depth**: Nếu task đơn giản và familiar, có thể kết hợp Phase 2+3 nhanh.
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
<!-- @phase:plan -->
|
|
139
|
-
## Phase 3: Plan
|
|
140
|
-
|
|
141
|
-
**Mục tiêu**: Thiết kế solution trước khi viết một dòng code. **Không implement ở phase này.**
|
|
142
|
-
|
|
143
|
-
### Deep Analysis Protocol (thorough depth)
|
|
144
|
-
|
|
145
|
-
Trước khi viết plan, bắt buộc với `thorough` depth:
|
|
146
|
-
|
|
147
|
-
1. **Liệt kê ≥3 approaches** — kể cả những approach không obvious
|
|
148
|
-
2. **Với mỗi approach**: assumptions, failure modes, trade-offs
|
|
149
|
-
3. **Devil's advocate**: lý do mạnh nhất để KHÔNG chọn approach đang nghiêng về
|
|
150
|
-
4. **Chỉ sau khi exhausted góc nhìn**, chọn approach và viết plan
|
|
151
|
-
|
|
152
|
-
### Guided Questions
|
|
153
|
-
|
|
154
|
-
1. **Tại sao approach này?** So với alternatives, trade-offs là gì?
|
|
155
|
-
2. **Subtasks có đúng thứ tự không?** Schema/data → logic → API → tests → docs
|
|
156
|
-
3. **Mỗi subtask có acceptance criteria đo lường được không?**
|
|
157
|
-
4. **Risk lớn nhất là gì?** Có plan B không?
|
|
158
|
-
5. **Breaking changes không?** Nếu có, migration strategy là gì?
|
|
159
|
-
6. **Estimate có realistic không?** So với tasks tương tự trước đây?
|
|
160
|
-
|
|
161
|
-
### Subtask Granularity
|
|
162
|
-
|
|
163
|
-
Mỗi subtask phải:
|
|
164
|
-
- Thay đổi ≤3 files
|
|
165
|
-
- Hoàn thành trong ≤4 giờ
|
|
166
|
-
- Có acceptance criteria đo lường được
|
|
167
|
-
- Commit được độc lập
|
|
168
|
-
|
|
169
|
-
**Thứ tự chuẩn:**
|
|
170
|
-
1. Schema/data model changes
|
|
171
|
-
2. Service/business logic
|
|
172
|
-
3. API/interface layer
|
|
173
|
-
4. Tests (hoặc test-first nếu TDD)
|
|
174
|
-
5. Documentation
|
|
175
|
-
|
|
176
|
-
### Role Variants
|
|
177
|
-
|
|
178
|
-
- **Nếu có TL**: Plan DỪNG chờ TL arch-review trước khi Execute
|
|
179
|
-
- **Nếu có QC**: QC tạo test plan song song với dev plan
|
|
180
|
-
- **Nếu có BA**: BA review requirements trước khi plan
|
|
181
|
-
|
|
182
|
-
### Output Phase 3
|
|
183
|
-
|
|
184
|
-
- [ ] `[name]-plan.md` hoàn chỉnh
|
|
185
|
-
- [ ] ≥2 approaches so sánh
|
|
186
|
-
- [ ] Subtasks với dependencies, criteria, estimate
|
|
187
|
-
- [ ] Risk table với mitigation
|
|
188
|
-
- [ ] Edge cases listed
|
|
189
|
-
- [ ] **DỪNG**: chờ human approve trước khi Execute
|
|
190
|
-
|
|
191
|
-
### Readiness Check
|
|
192
|
-
|
|
193
|
-
Đủ điều kiện sang Phase 4 khi:
|
|
194
|
-
- Plan có human approval (explicit "approved" hoặc "go ahead")
|
|
195
|
-
- Nếu có TL: TL đã review architecture decisions
|
|
196
|
-
- Risk table không có unmitigated critical risks
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
<!-- @phase:execute -->
|
|
201
|
-
## Phase 4: Execute
|
|
202
|
-
|
|
203
|
-
**Mục tiêu**: Implement theo plan đã approve. **Một subtask = một commit.**
|
|
204
|
-
|
|
205
|
-
### TDD Workflow (mỗi subtask)
|
|
206
|
-
|
|
207
|
-
```
|
|
208
|
-
1. Viết test trước (failing) → RED
|
|
209
|
-
2. Implement tối thiểu để test pass → GREEN
|
|
210
|
-
3. Refactor nếu cần → REFACTOR
|
|
211
|
-
4. Commit subtask
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
Nếu task không có tests: viết tests sau implement, nhưng TRƯỚC khi mark subtask Done.
|
|
215
|
-
|
|
216
|
-
### Execution Rules
|
|
217
|
-
|
|
218
|
-
1. **Đọc plan trước khi bắt đầu mỗi subtask** — không làm từ memory
|
|
219
|
-
2. **Chỉ làm đúng scope của subtask** — không "while I'm here" fixes
|
|
220
|
-
3. **Gặp ambiguity → DỪNG và hỏi** — không tự suy diễn cho thay đổi lớn
|
|
221
|
-
4. **Phát hiện scope thay đổi → cập nhật plan, hỏi human** trước khi tiếp tục
|
|
222
|
-
5. **Mỗi subtask done = update progress file + commit**
|
|
223
|
-
|
|
224
|
-
### Khi Gặp Blockers
|
|
225
|
-
|
|
226
|
-
```
|
|
227
|
-
1. Ghi blocker vào progress file (mô tả, context)
|
|
228
|
-
2. Xác định: blocker có thể self-resolve không?
|
|
229
|
-
- Có: document approach, proceed
|
|
230
|
-
- Không: DỪNG, escalate, ghi next-steps rõ ràng
|
|
231
|
-
3. Không bao giờ silent-skip subtask
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
### Output Phase 4
|
|
235
|
-
|
|
236
|
-
- [ ] Mỗi subtask: code implemented + tests pass
|
|
237
|
-
- [ ] Progress file cập nhật sau mỗi subtask
|
|
238
|
-
- [ ] Mỗi subtask: 1 commit (format chuẩn)
|
|
239
|
-
- [ ] Không còn debug code (console.log, debugger)
|
|
240
|
-
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
<!-- @phase:verify -->
|
|
244
|
-
## Phase 5: Verify
|
|
245
|
-
|
|
246
|
-
**Mục tiêu**: Đảm bảo implementation đúng, đủ, và safe trước khi merge.
|
|
247
|
-
|
|
248
|
-
### 4-Layer Quality Check
|
|
249
|
-
|
|
250
|
-
**Layer 1: Self-review** (luôn bắt buộc)
|
|
251
|
-
- [ ] Logic đúng? Edge cases handled?
|
|
252
|
-
- [ ] Tests cover happy path + error cases + edge cases?
|
|
253
|
-
- [ ] Không có debug code còn sót?
|
|
254
|
-
- [ ] Naming rõ ràng, self-documenting?
|
|
255
|
-
|
|
256
|
-
**Layer 2: Automated gates** (nếu `test_command` + `lint_command` configured)
|
|
257
|
-
- [ ] Tests pass: `{quality.test_command}`
|
|
258
|
-
- [ ] Lint pass: `{quality.lint_command}`
|
|
259
|
-
- [ ] No sensitive data in diff
|
|
260
|
-
|
|
261
|
-
**Layer 3: Peer/TL review** (nếu `standard` hoặc `thorough` depth + có peer/TL)
|
|
262
|
-
- [ ] TL review architecture decisions
|
|
263
|
-
- [ ] Peer code review theo checklist
|
|
264
|
-
- [ ] A/B testing cho uncertain decisions (nếu applicable)
|
|
265
|
-
- [ ] Decisions logged trong task docs
|
|
266
|
-
|
|
267
|
-
**Layer 4: QA confirmation** (nếu `thorough` depth + có QC role)
|
|
268
|
-
- [ ] QC review against test plan
|
|
269
|
-
- [ ] QC sign-off là explicit gate (không tự approve)
|
|
270
|
-
- [ ] Regression checks pass
|
|
271
|
-
|
|
272
|
-
### Review Output Format
|
|
273
|
-
|
|
274
|
-
Reviewer báo cáo phải phân loại theo mức độ:
|
|
275
|
-
- **CRITICAL**: Phải sửa trước merge
|
|
276
|
-
- **WARNING**: Nên sửa
|
|
277
|
-
- **SUGGESTION**: Cân nhắc
|
|
278
|
-
|
|
279
|
-
### Output Phase 5
|
|
280
|
-
|
|
281
|
-
- [ ] Tất cả CRITICAL issues resolved
|
|
282
|
-
- [ ] Automated gates pass (nếu configured)
|
|
283
|
-
- [ ] Review sign-off (peer/TL/QC theo depth)
|
|
284
|
-
- [ ] Living docs cập nhật (nếu `thorough` và có thay đổi architecture/API)
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
<!-- @phase:close -->
|
|
289
|
-
## Phase 6: Close
|
|
290
|
-
|
|
291
|
-
**Mục tiêu**: Kết thúc task đúng cách — commit, track, handoff, archive.
|
|
292
|
-
|
|
293
|
-
### Commit Convention
|
|
294
|
-
|
|
295
|
-
```
|
|
296
|
-
<type>(<scope>): <
|
|
297
|
-
|
|
298
|
-
[
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
**Pre-commit checklist:**
|
|
306
|
-
- [ ] Không có debug code
|
|
307
|
-
- [ ] Không có sensitive data (passwords, API keys, tokens)
|
|
308
|
-
- [ ] Tests pass
|
|
309
|
-
- [ ] Commit message rõ ràng
|
|
310
|
-
|
|
311
|
-
### Effort Tracking (nếu enabled)
|
|
312
|
-
|
|
313
|
-
```
|
|
314
|
-
Estimate (Phase 3) → Log Actual (Phase 4) → Compare (Phase 6)
|
|
315
|
-
→ Feed into velocity → Improve future estimates
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
### Handoff Protocol
|
|
319
|
-
|
|
320
|
-
Cuối session (không kết thúc không handoff):
|
|
321
|
-
1. **Auto-summarize**: done / in-progress / blocked
|
|
322
|
-
2. **Git state**: uncommitted changes, recent commits
|
|
323
|
-
3. **Next steps**: ordered action list với context
|
|
324
|
-
4. **Context anchors**: key decisions và tại sao
|
|
325
|
-
|
|
326
|
-
### Archive (khi task hoàn toàn done)
|
|
327
|
-
|
|
328
|
-
Move task docs từ `{paths.tasks}/` → `{paths.tasks}/archive/` sau khi:
|
|
329
|
-
- PR merged
|
|
330
|
-
- QA sign-off (nếu applicable)
|
|
331
|
-
- Docs updated
|
|
332
|
-
|
|
333
|
-
### Output Phase 6
|
|
334
|
-
|
|
335
|
-
- [ ] Final commit(s) với message chuẩn
|
|
336
|
-
- [ ] Progress file: trạng thái = Done, kết thúc date filled
|
|
337
|
-
- [ ] Effort log updated (nếu enabled)
|
|
338
|
-
- [ ] Handoff notes ghi (nếu bàn giao)
|
|
339
|
-
- [ ] Task archived (sau merge)
|
|
340
|
-
|
|
341
|
-
---
|
|
342
|
-
|
|
343
|
-
<!-- @standalone:debug -->
|
|
344
|
-
## Standalone: Debug
|
|
345
|
-
|
|
346
|
-
**Dùng khi**: Gặp bug, test fail, hoặc behavior bất thường. Không cần qua full workflow.
|
|
347
|
-
|
|
348
|
-
### Quy Trình: Investigate → Diagnose → Fix
|
|
349
|
-
|
|
350
|
-
**Bước 1: Investigate**
|
|
351
|
-
- Reproduce issue: exact steps, exact error message
|
|
352
|
-
- Scope: xảy ra ở đâu? Khi nào? Frequency?
|
|
353
|
-
- Recent changes: git log trong khu vực liên quan
|
|
354
|
-
- Gather evidence: logs, stack traces, error messages với file:line
|
|
355
|
-
|
|
356
|
-
**Bước 2: Diagnose**
|
|
357
|
-
- Hypothesis: "Lỗi có thể do X vì Y"
|
|
358
|
-
- Verify: test hypothesis với minimal evidence
|
|
359
|
-
- Root cause: phân biệt symptom vs cause
|
|
360
|
-
- Đừng fix symptom nếu chưa biết root cause
|
|
361
|
-
|
|
362
|
-
**Bước 3: Fix**
|
|
363
|
-
- Fix root cause (không symptom)
|
|
364
|
-
- Test fix: reproduce original issue → không còn reproduce
|
|
365
|
-
- Regression: kiểm tra fix không break thứ khác
|
|
366
|
-
- Commit với message rõ: "fix(scope): mô tả vấn đề và cách fix"
|
|
367
|
-
|
|
368
|
-
### Debug Guided Questions
|
|
369
|
-
|
|
370
|
-
1. **Exact error**: message chính xác là gì? Stack trace ở đâu?
|
|
371
|
-
2. **Reproducible**: luôn xảy ra hay intermittent? Điều kiện nào?
|
|
372
|
-
3. **Recent changes**: git log trong khu vực này có thay đổi gì gần đây?
|
|
373
|
-
4. **Expected vs actual**: behavior mong đợi là gì, thực tế là gì?
|
|
374
|
-
5. **Root cause hypothesis**: "Tôi nghĩ lỗi do ___ vì ___"
|
|
375
|
-
|
|
376
|
-
---
|
|
377
|
-
|
|
378
|
-
<!-- @standalone:reports -->
|
|
379
|
-
## Standalone: Reports
|
|
380
|
-
|
|
381
|
-
**Dùng khi**: PM cần dashboard, team cần sprint review.
|
|
382
|
-
|
|
383
|
-
### Dashboard Report
|
|
384
|
-
|
|
385
|
-
Tổng hợp cho PM:
|
|
386
|
-
- Tasks status: done / in-progress / blocked / planned
|
|
387
|
-
- Velocity: tasks completed per sprint
|
|
388
|
-
- Effort: estimate vs actual (nếu tracking enabled)
|
|
389
|
-
- Quality metrics: bug rate, review findings trend
|
|
390
|
-
- DORA metrics (nếu available): deployment frequency, lead time, MTTR, change failure rate
|
|
391
|
-
|
|
392
|
-
### Sprint Review Report
|
|
393
|
-
|
|
394
|
-
Tổng kết sprint:
|
|
395
|
-
- Completed: tasks done, features delivered
|
|
396
|
-
- Incomplete: tasks carried over và lý do
|
|
397
|
-
- Metrics: velocity, quality indicators
|
|
398
|
-
- Lessons learned: gì worked, gì didn't
|
|
399
|
-
- Next sprint: items đề xuất, dependencies
|
|
400
|
-
|
|
401
|
-
---
|
|
402
|
-
|
|
403
|
-
<!-- @meta:config -->
|
|
404
|
-
## Meta: Config & Maintenance
|
|
405
|
-
|
|
406
|
-
### Config Validation
|
|
407
|
-
|
|
408
|
-
Trước khi dùng toolkit, validate config:
|
|
409
|
-
- Tất cả required keys có mặt?
|
|
410
|
-
- Enum values hợp lệ? (depth, roles, estimation_unit)
|
|
411
|
-
- `team.roles` listed có phù hợp với team thực tế?
|
|
412
|
-
- `quality.test_command` và `lint_command` chạy được không?
|
|
413
|
-
|
|
414
|
-
### Upgrade Toolkit
|
|
415
|
-
|
|
416
|
-
Khi có version mới:
|
|
417
|
-
1. Check compatibility: core version vs platform version
|
|
418
|
-
2. Preview changes: `--dry-run` trước khi apply
|
|
419
|
-
3. Backup config trước khi upgrade
|
|
420
|
-
4. Apply: generated/ files update, overrides/ giữ nguyên
|
|
421
|
-
5. Verify: smoke tests sau upgrade
|
|
422
|
-
|
|
423
|
-
### Rollback
|
|
424
|
-
|
|
425
|
-
Nếu plan sai hoặc execute sai hướng:
|
|
426
|
-
1. Identify: subtask nào bắt đầu đi sai?
|
|
427
|
-
2. Revert: task docs về trạng thái đúng
|
|
428
|
-
3. Re-plan từ điểm đó
|
|
429
|
-
4. Không silent-continue khi biết hướng sai
|
|
430
|
-
|
|
431
|
-
---
|
|
432
|
-
|
|
433
|
-
## Appendix: Depth × Phase Matrix
|
|
434
|
-
|
|
435
|
-
| Phase | Quick | Standard | Thorough | Requires |
|
|
436
|
-
|-------|-------|----------|----------|---------|
|
|
437
|
-
| Initialize | ✓ | ✓ | ✓ | dev |
|
|
438
|
-
| Understand | ✓ | ✓ | ✓ | dev |
|
|
439
|
-
| Plan | skip | ✓ | ✓ | dev |
|
|
440
|
-
| Arch Review | skip | if TL | ✓ | techlead |
|
|
441
|
-
| Test Plan | skip | skip | ✓ | qc |
|
|
442
|
-
| Execute TDD | ✓ | ✓ | ✓ | dev |
|
|
443
|
-
| Peer Review | self | ✓ | ✓ | dev+peer |
|
|
444
|
-
| QA Confirm | skip | skip | ✓ | qc |
|
|
445
|
-
| Living Docs | skip | skip | ✓ | dev |
|
|
446
|
-
| Estimation | skip | optional | ✓ | dev |
|
|
447
|
-
| Log Work | skip | optional | ✓ | dev |
|
|
448
|
-
| Dashboard | skip | skip | ✓ | pm |
|
|
449
|
-
|
|
450
|
-
> Nếu role không có mặt trong `team.roles`, phase đó gracefully degrade (không block).
|
|
1
|
+
<!-- core-version: 1.0 -->
|
|
2
|
+
<!-- last-updated: 2026-03-23 -->
|
|
3
|
+
|
|
4
|
+
# dw-kit Workflow Methodology
|
|
5
|
+
|
|
6
|
+
> **Platform-agnostic.** File này chứa methodology thuần — không có Claude syntax, không có tool names.
|
|
7
|
+
> Platform-specific execution nằm trong `.dw/adapters/`.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Mục Lục
|
|
12
|
+
|
|
13
|
+
- [Phase 1: Initialize](#phase-initialize)
|
|
14
|
+
- [Phase 2: Understand](#phase-understand)
|
|
15
|
+
- [Phase 3: Plan](#phase-plan)
|
|
16
|
+
- [Phase 4: Execute](#phase-execute)
|
|
17
|
+
- [Phase 5: Verify](#phase-verify)
|
|
18
|
+
- [Phase 6: Close](#phase-close)
|
|
19
|
+
- [Standalone: Debug](#standalone-debug)
|
|
20
|
+
- [Standalone: Reports](#standalone-reports)
|
|
21
|
+
- [Meta: Config & Maintenance](#meta-config)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Routing: Chọn Depth Phù Hợp
|
|
26
|
+
|
|
27
|
+
Đọc `default_depth` từ config. AI sẽ recommend depth dựa trên assessment.
|
|
28
|
+
`default_depth` là baseline cho project, nhưng **depth có thể override theo từng task**.
|
|
29
|
+
|
|
30
|
+
| Depth | Khi nào dùng | Phases bắt buộc |
|
|
31
|
+
|-------|-------------|-----------------|
|
|
32
|
+
| `quick` | ≤2 files, hotfix, familiar module (touched < 7 ngày) | Understand → Execute → Close |
|
|
33
|
+
| `standard` | 3-5 files, module mới, unfamiliar code | Tất cả 6 phases |
|
|
34
|
+
| `thorough` | 6+ files, API contract changes, DB schema, security-sensitive | Tất cả 6 phases + arch-review + test-plan |
|
|
35
|
+
|
|
36
|
+
**Criteria AI dùng để assess (facts, không intuition):**
|
|
37
|
+
- File count thay đổi
|
|
38
|
+
- API contract changes (public endpoints, exported functions)
|
|
39
|
+
- Database schema changes
|
|
40
|
+
- Security-sensitive code (auth, crypto, permissions)
|
|
41
|
+
- Module familiarity (git blame xem last touched)
|
|
42
|
+
|
|
43
|
+
### Task-Level Depth Override (Khuyến nghị)
|
|
44
|
+
|
|
45
|
+
Mỗi task nên có depth riêng, không khóa cứng theo project:
|
|
46
|
+
|
|
47
|
+
- **Default**: dùng `workflow.default_depth` từ `.dw/config/dw.config.yml`
|
|
48
|
+
- **Override**: ghi trực tiếp trong task docs (ví dụ `context.md`)
|
|
49
|
+
- **Rule**: task nào có API/DB/security scope thì có thể nâng lên `thorough` dù project đang `standard`
|
|
50
|
+
|
|
51
|
+
Ưu tiên thực tế: `default_depth` giúp setup nhanh, còn execution quyết định theo rủi ro từng task.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
<!-- @phase:initialize -->
|
|
56
|
+
## Phase 1: Initialize
|
|
57
|
+
|
|
58
|
+
**Mục tiêu**: Chuẩn bị workspace và hiểu rõ yêu cầu trước khi bắt đầu.
|
|
59
|
+
|
|
60
|
+
### Guided Questions
|
|
61
|
+
|
|
62
|
+
Trả lời trước khi tiếp tục:
|
|
63
|
+
|
|
64
|
+
1. **Task là gì?** Mô tả ngắn 1-2 câu.
|
|
65
|
+
2. **Output mong đợi là gì?** Hành vi nào cần thay đổi / tính năng nào cần thêm?
|
|
66
|
+
3. **Ai sẽ bị ảnh hưởng?** User cuối / developer / system?
|
|
67
|
+
4. **Có deadline không?** Nếu có, ảnh hưởng đến depth choice?
|
|
68
|
+
5. **Có dependencies không?** Task này chờ task khác, hoặc task khác chờ task này?
|
|
69
|
+
6. **Task depth override không?** (`quick|standard|thorough`) Nếu có, ghi rõ lý do.
|
|
70
|
+
|
|
71
|
+
### Output Phase 1
|
|
72
|
+
|
|
73
|
+
- [ ] Task docs tạo tại `{paths.tasks}/[task-name]/`
|
|
74
|
+
- [ ] 3 files: `[name]-context.md`, `[name]-plan.md`, `[name]-progress.md`
|
|
75
|
+
- [ ] Context file có: yêu cầu gốc + scope assessment + depth recommendation
|
|
76
|
+
|
|
77
|
+
### Readiness Check
|
|
78
|
+
|
|
79
|
+
Đủ điều kiện sang Phase 2 khi:
|
|
80
|
+
- Yêu cầu rõ ràng (không ambiguous)
|
|
81
|
+
- Depth đã chọn
|
|
82
|
+
- Task docs tạo xong
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
<!-- @phase:understand -->
|
|
87
|
+
## Phase 2: Understand
|
|
88
|
+
|
|
89
|
+
**Mục tiêu**: Khảo sát codebase để hiểu đầy đủ trước khi thiết kế solution. **Không code ở phase này.**
|
|
90
|
+
|
|
91
|
+
### Quy Trình Khảo Sát
|
|
92
|
+
|
|
93
|
+
1. **Breadth first**: Tìm tất cả files, modules liên quan đến task
|
|
94
|
+
2. **Dependency mapping**: Ai gọi gì, data đi từ đâu đến đâu
|
|
95
|
+
3. **Pattern recognition**: Conventions, design patterns trong project hiện tại
|
|
96
|
+
4. **History**: Thay đổi gần đây liên quan (git log/blame)
|
|
97
|
+
5. **Test coverage**: Hiện tại cover gì, thiếu gì
|
|
98
|
+
6. **Gaps**: Gì chưa rõ, cần làm rõ trước khi plan
|
|
99
|
+
|
|
100
|
+
### Guided Questions
|
|
101
|
+
|
|
102
|
+
Phải có câu trả lời cho tất cả trước khi kết thúc phase:
|
|
103
|
+
|
|
104
|
+
1. **Files nào sẽ thay đổi?** Liệt kê cụ thể.
|
|
105
|
+
2. **Ai phụ thuộc vào những files đó?** Upstream và downstream.
|
|
106
|
+
3. **Pattern hiện tại là gì?** Tôi nên follow pattern nào?
|
|
107
|
+
4. **Test coverage hiện tại?** Thiếu ở đâu?
|
|
108
|
+
5. **Có gotchas/tech debt nào liên quan?** Git history có gì cảnh báo?
|
|
109
|
+
6. **Giả định nào tôi đang dùng?** Có thể sai không?
|
|
110
|
+
|
|
111
|
+
### Context Completion Protocol
|
|
112
|
+
|
|
113
|
+
Khi context thiếu, AI không dừng và chờ. AI:
|
|
114
|
+
1. Phân tích codebase để pre-fill answers
|
|
115
|
+
2. Trình bày: "Tôi tìm được: [findings]. Xác nhận hoặc sửa?"
|
|
116
|
+
3. Developer confirm/correct
|
|
117
|
+
4. Proceed
|
|
118
|
+
|
|
119
|
+
### Output Phase 2
|
|
120
|
+
|
|
121
|
+
- [ ] `[name]-context.md` điền đầy đủ
|
|
122
|
+
- [ ] Files liên quan: listed với vai trò rõ ràng
|
|
123
|
+
- [ ] Kiến trúc hiện tại: documented (diagram nếu cần)
|
|
124
|
+
- [ ] Gaps: identified, resolved hoặc flagged
|
|
125
|
+
- [ ] Test coverage: assessed
|
|
126
|
+
|
|
127
|
+
### Readiness Check
|
|
128
|
+
|
|
129
|
+
Đủ điều kiện sang Phase 3 khi:
|
|
130
|
+
- Tất cả 6 guided questions có câu trả lời
|
|
131
|
+
- Không còn câu hỏi critical chưa giải đáp
|
|
132
|
+
- Files liên quan đã identified
|
|
133
|
+
|
|
134
|
+
> **Quick depth**: Nếu task đơn giản và familiar, có thể kết hợp Phase 2+3 nhanh.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
<!-- @phase:plan -->
|
|
139
|
+
## Phase 3: Plan
|
|
140
|
+
|
|
141
|
+
**Mục tiêu**: Thiết kế solution trước khi viết một dòng code. **Không implement ở phase này.**
|
|
142
|
+
|
|
143
|
+
### Deep Analysis Protocol (thorough depth)
|
|
144
|
+
|
|
145
|
+
Trước khi viết plan, bắt buộc với `thorough` depth:
|
|
146
|
+
|
|
147
|
+
1. **Liệt kê ≥3 approaches** — kể cả những approach không obvious
|
|
148
|
+
2. **Với mỗi approach**: assumptions, failure modes, trade-offs
|
|
149
|
+
3. **Devil's advocate**: lý do mạnh nhất để KHÔNG chọn approach đang nghiêng về
|
|
150
|
+
4. **Chỉ sau khi exhausted góc nhìn**, chọn approach và viết plan
|
|
151
|
+
|
|
152
|
+
### Guided Questions
|
|
153
|
+
|
|
154
|
+
1. **Tại sao approach này?** So với alternatives, trade-offs là gì?
|
|
155
|
+
2. **Subtasks có đúng thứ tự không?** Schema/data → logic → API → tests → docs
|
|
156
|
+
3. **Mỗi subtask có acceptance criteria đo lường được không?**
|
|
157
|
+
4. **Risk lớn nhất là gì?** Có plan B không?
|
|
158
|
+
5. **Breaking changes không?** Nếu có, migration strategy là gì?
|
|
159
|
+
6. **Estimate có realistic không?** So với tasks tương tự trước đây?
|
|
160
|
+
|
|
161
|
+
### Subtask Granularity
|
|
162
|
+
|
|
163
|
+
Mỗi subtask phải:
|
|
164
|
+
- Thay đổi ≤3 files
|
|
165
|
+
- Hoàn thành trong ≤4 giờ
|
|
166
|
+
- Có acceptance criteria đo lường được
|
|
167
|
+
- Commit được độc lập
|
|
168
|
+
|
|
169
|
+
**Thứ tự chuẩn:**
|
|
170
|
+
1. Schema/data model changes
|
|
171
|
+
2. Service/business logic
|
|
172
|
+
3. API/interface layer
|
|
173
|
+
4. Tests (hoặc test-first nếu TDD)
|
|
174
|
+
5. Documentation
|
|
175
|
+
|
|
176
|
+
### Role Variants
|
|
177
|
+
|
|
178
|
+
- **Nếu có TL**: Plan DỪNG chờ TL arch-review trước khi Execute
|
|
179
|
+
- **Nếu có QC**: QC tạo test plan song song với dev plan
|
|
180
|
+
- **Nếu có BA**: BA review requirements trước khi plan
|
|
181
|
+
|
|
182
|
+
### Output Phase 3
|
|
183
|
+
|
|
184
|
+
- [ ] `[name]-plan.md` hoàn chỉnh
|
|
185
|
+
- [ ] ≥2 approaches so sánh
|
|
186
|
+
- [ ] Subtasks với dependencies, criteria, estimate
|
|
187
|
+
- [ ] Risk table với mitigation
|
|
188
|
+
- [ ] Edge cases listed
|
|
189
|
+
- [ ] **DỪNG**: chờ human approve trước khi Execute
|
|
190
|
+
|
|
191
|
+
### Readiness Check
|
|
192
|
+
|
|
193
|
+
Đủ điều kiện sang Phase 4 khi:
|
|
194
|
+
- Plan có human approval (explicit "approved" hoặc "go ahead")
|
|
195
|
+
- Nếu có TL: TL đã review architecture decisions
|
|
196
|
+
- Risk table không có unmitigated critical risks
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
<!-- @phase:execute -->
|
|
201
|
+
## Phase 4: Execute
|
|
202
|
+
|
|
203
|
+
**Mục tiêu**: Implement theo plan đã approve. **Một subtask = một commit.**
|
|
204
|
+
|
|
205
|
+
### TDD Workflow (mỗi subtask)
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
1. Viết test trước (failing) → RED
|
|
209
|
+
2. Implement tối thiểu để test pass → GREEN
|
|
210
|
+
3. Refactor nếu cần → REFACTOR
|
|
211
|
+
4. Commit subtask
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Nếu task không có tests: viết tests sau implement, nhưng TRƯỚC khi mark subtask Done.
|
|
215
|
+
|
|
216
|
+
### Execution Rules
|
|
217
|
+
|
|
218
|
+
1. **Đọc plan trước khi bắt đầu mỗi subtask** — không làm từ memory
|
|
219
|
+
2. **Chỉ làm đúng scope của subtask** — không "while I'm here" fixes
|
|
220
|
+
3. **Gặp ambiguity → DỪNG và hỏi** — không tự suy diễn cho thay đổi lớn
|
|
221
|
+
4. **Phát hiện scope thay đổi → cập nhật plan, hỏi human** trước khi tiếp tục
|
|
222
|
+
5. **Mỗi subtask done = update progress file + commit**
|
|
223
|
+
|
|
224
|
+
### Khi Gặp Blockers
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
1. Ghi blocker vào progress file (mô tả, context)
|
|
228
|
+
2. Xác định: blocker có thể self-resolve không?
|
|
229
|
+
- Có: document approach, proceed
|
|
230
|
+
- Không: DỪNG, escalate, ghi next-steps rõ ràng
|
|
231
|
+
3. Không bao giờ silent-skip subtask
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Output Phase 4
|
|
235
|
+
|
|
236
|
+
- [ ] Mỗi subtask: code implemented + tests pass
|
|
237
|
+
- [ ] Progress file cập nhật sau mỗi subtask
|
|
238
|
+
- [ ] Mỗi subtask: 1 commit (format chuẩn)
|
|
239
|
+
- [ ] Không còn debug code (console.log, debugger)
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
<!-- @phase:verify -->
|
|
244
|
+
## Phase 5: Verify
|
|
245
|
+
|
|
246
|
+
**Mục tiêu**: Đảm bảo implementation đúng, đủ, và safe trước khi merge.
|
|
247
|
+
|
|
248
|
+
### 4-Layer Quality Check
|
|
249
|
+
|
|
250
|
+
**Layer 1: Self-review** (luôn bắt buộc)
|
|
251
|
+
- [ ] Logic đúng? Edge cases handled?
|
|
252
|
+
- [ ] Tests cover happy path + error cases + edge cases?
|
|
253
|
+
- [ ] Không có debug code còn sót?
|
|
254
|
+
- [ ] Naming rõ ràng, self-documenting?
|
|
255
|
+
|
|
256
|
+
**Layer 2: Automated gates** (nếu `test_command` + `lint_command` configured)
|
|
257
|
+
- [ ] Tests pass: `{quality.test_command}`
|
|
258
|
+
- [ ] Lint pass: `{quality.lint_command}`
|
|
259
|
+
- [ ] No sensitive data in diff
|
|
260
|
+
|
|
261
|
+
**Layer 3: Peer/TL review** (nếu `standard` hoặc `thorough` depth + có peer/TL)
|
|
262
|
+
- [ ] TL review architecture decisions
|
|
263
|
+
- [ ] Peer code review theo checklist
|
|
264
|
+
- [ ] A/B testing cho uncertain decisions (nếu applicable)
|
|
265
|
+
- [ ] Decisions logged trong task docs
|
|
266
|
+
|
|
267
|
+
**Layer 4: QA confirmation** (nếu `thorough` depth + có QC role)
|
|
268
|
+
- [ ] QC review against test plan
|
|
269
|
+
- [ ] QC sign-off là explicit gate (không tự approve)
|
|
270
|
+
- [ ] Regression checks pass
|
|
271
|
+
|
|
272
|
+
### Review Output Format
|
|
273
|
+
|
|
274
|
+
Reviewer báo cáo phải phân loại theo mức độ:
|
|
275
|
+
- **CRITICAL**: Phải sửa trước merge
|
|
276
|
+
- **WARNING**: Nên sửa
|
|
277
|
+
- **SUGGESTION**: Cân nhắc
|
|
278
|
+
|
|
279
|
+
### Output Phase 5
|
|
280
|
+
|
|
281
|
+
- [ ] Tất cả CRITICAL issues resolved
|
|
282
|
+
- [ ] Automated gates pass (nếu configured)
|
|
283
|
+
- [ ] Review sign-off (peer/TL/QC theo depth)
|
|
284
|
+
- [ ] Living docs cập nhật (nếu `thorough` và có thay đổi architecture/API)
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
<!-- @phase:close -->
|
|
289
|
+
## Phase 6: Close
|
|
290
|
+
|
|
291
|
+
**Mục tiêu**: Kết thúc task đúng cách — commit, track, handoff, archive.
|
|
292
|
+
|
|
293
|
+
### Commit Convention
|
|
294
|
+
|
|
295
|
+
```
|
|
296
|
+
<type>(<scope>): <imperative English subject ≤72 chars>
|
|
297
|
+
|
|
298
|
+
[Optional body — explain WHY, wrap at 72]
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Types: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`, `style`, `perf`
|
|
302
|
+
|
|
303
|
+
English imperative mood (`add`, `fix`, `update` — not past tense or other languages). **Do not append `Co-Authored-By: Claude` or any AI signature.** Full rules: `.claude/rules/commit-standards.md`.
|
|
304
|
+
|
|
305
|
+
**Pre-commit checklist:**
|
|
306
|
+
- [ ] Không có debug code
|
|
307
|
+
- [ ] Không có sensitive data (passwords, API keys, tokens)
|
|
308
|
+
- [ ] Tests pass
|
|
309
|
+
- [ ] Commit message rõ ràng
|
|
310
|
+
|
|
311
|
+
### Effort Tracking (nếu enabled)
|
|
312
|
+
|
|
313
|
+
```
|
|
314
|
+
Estimate (Phase 3) → Log Actual (Phase 4) → Compare (Phase 6)
|
|
315
|
+
→ Feed into velocity → Improve future estimates
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Handoff Protocol
|
|
319
|
+
|
|
320
|
+
Cuối session (không kết thúc không handoff):
|
|
321
|
+
1. **Auto-summarize**: done / in-progress / blocked
|
|
322
|
+
2. **Git state**: uncommitted changes, recent commits
|
|
323
|
+
3. **Next steps**: ordered action list với context
|
|
324
|
+
4. **Context anchors**: key decisions và tại sao
|
|
325
|
+
|
|
326
|
+
### Archive (khi task hoàn toàn done)
|
|
327
|
+
|
|
328
|
+
Move task docs từ `{paths.tasks}/` → `{paths.tasks}/archive/` sau khi:
|
|
329
|
+
- PR merged
|
|
330
|
+
- QA sign-off (nếu applicable)
|
|
331
|
+
- Docs updated
|
|
332
|
+
|
|
333
|
+
### Output Phase 6
|
|
334
|
+
|
|
335
|
+
- [ ] Final commit(s) với message chuẩn
|
|
336
|
+
- [ ] Progress file: trạng thái = Done, kết thúc date filled
|
|
337
|
+
- [ ] Effort log updated (nếu enabled)
|
|
338
|
+
- [ ] Handoff notes ghi (nếu bàn giao)
|
|
339
|
+
- [ ] Task archived (sau merge)
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
<!-- @standalone:debug -->
|
|
344
|
+
## Standalone: Debug
|
|
345
|
+
|
|
346
|
+
**Dùng khi**: Gặp bug, test fail, hoặc behavior bất thường. Không cần qua full workflow.
|
|
347
|
+
|
|
348
|
+
### Quy Trình: Investigate → Diagnose → Fix
|
|
349
|
+
|
|
350
|
+
**Bước 1: Investigate**
|
|
351
|
+
- Reproduce issue: exact steps, exact error message
|
|
352
|
+
- Scope: xảy ra ở đâu? Khi nào? Frequency?
|
|
353
|
+
- Recent changes: git log trong khu vực liên quan
|
|
354
|
+
- Gather evidence: logs, stack traces, error messages với file:line
|
|
355
|
+
|
|
356
|
+
**Bước 2: Diagnose**
|
|
357
|
+
- Hypothesis: "Lỗi có thể do X vì Y"
|
|
358
|
+
- Verify: test hypothesis với minimal evidence
|
|
359
|
+
- Root cause: phân biệt symptom vs cause
|
|
360
|
+
- Đừng fix symptom nếu chưa biết root cause
|
|
361
|
+
|
|
362
|
+
**Bước 3: Fix**
|
|
363
|
+
- Fix root cause (không symptom)
|
|
364
|
+
- Test fix: reproduce original issue → không còn reproduce
|
|
365
|
+
- Regression: kiểm tra fix không break thứ khác
|
|
366
|
+
- Commit với message rõ: "fix(scope): mô tả vấn đề và cách fix"
|
|
367
|
+
|
|
368
|
+
### Debug Guided Questions
|
|
369
|
+
|
|
370
|
+
1. **Exact error**: message chính xác là gì? Stack trace ở đâu?
|
|
371
|
+
2. **Reproducible**: luôn xảy ra hay intermittent? Điều kiện nào?
|
|
372
|
+
3. **Recent changes**: git log trong khu vực này có thay đổi gì gần đây?
|
|
373
|
+
4. **Expected vs actual**: behavior mong đợi là gì, thực tế là gì?
|
|
374
|
+
5. **Root cause hypothesis**: "Tôi nghĩ lỗi do ___ vì ___"
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
<!-- @standalone:reports -->
|
|
379
|
+
## Standalone: Reports
|
|
380
|
+
|
|
381
|
+
**Dùng khi**: PM cần dashboard, team cần sprint review.
|
|
382
|
+
|
|
383
|
+
### Dashboard Report
|
|
384
|
+
|
|
385
|
+
Tổng hợp cho PM:
|
|
386
|
+
- Tasks status: done / in-progress / blocked / planned
|
|
387
|
+
- Velocity: tasks completed per sprint
|
|
388
|
+
- Effort: estimate vs actual (nếu tracking enabled)
|
|
389
|
+
- Quality metrics: bug rate, review findings trend
|
|
390
|
+
- DORA metrics (nếu available): deployment frequency, lead time, MTTR, change failure rate
|
|
391
|
+
|
|
392
|
+
### Sprint Review Report
|
|
393
|
+
|
|
394
|
+
Tổng kết sprint:
|
|
395
|
+
- Completed: tasks done, features delivered
|
|
396
|
+
- Incomplete: tasks carried over và lý do
|
|
397
|
+
- Metrics: velocity, quality indicators
|
|
398
|
+
- Lessons learned: gì worked, gì didn't
|
|
399
|
+
- Next sprint: items đề xuất, dependencies
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
<!-- @meta:config -->
|
|
404
|
+
## Meta: Config & Maintenance
|
|
405
|
+
|
|
406
|
+
### Config Validation
|
|
407
|
+
|
|
408
|
+
Trước khi dùng toolkit, validate config:
|
|
409
|
+
- Tất cả required keys có mặt?
|
|
410
|
+
- Enum values hợp lệ? (depth, roles, estimation_unit)
|
|
411
|
+
- `team.roles` listed có phù hợp với team thực tế?
|
|
412
|
+
- `quality.test_command` và `lint_command` chạy được không?
|
|
413
|
+
|
|
414
|
+
### Upgrade Toolkit
|
|
415
|
+
|
|
416
|
+
Khi có version mới:
|
|
417
|
+
1. Check compatibility: core version vs platform version
|
|
418
|
+
2. Preview changes: `--dry-run` trước khi apply
|
|
419
|
+
3. Backup config trước khi upgrade
|
|
420
|
+
4. Apply: generated/ files update, overrides/ giữ nguyên
|
|
421
|
+
5. Verify: smoke tests sau upgrade
|
|
422
|
+
|
|
423
|
+
### Rollback
|
|
424
|
+
|
|
425
|
+
Nếu plan sai hoặc execute sai hướng:
|
|
426
|
+
1. Identify: subtask nào bắt đầu đi sai?
|
|
427
|
+
2. Revert: task docs về trạng thái đúng
|
|
428
|
+
3. Re-plan từ điểm đó
|
|
429
|
+
4. Không silent-continue khi biết hướng sai
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
## Appendix: Depth × Phase Matrix
|
|
434
|
+
|
|
435
|
+
| Phase | Quick | Standard | Thorough | Requires |
|
|
436
|
+
|-------|-------|----------|----------|---------|
|
|
437
|
+
| Initialize | ✓ | ✓ | ✓ | dev |
|
|
438
|
+
| Understand | ✓ | ✓ | ✓ | dev |
|
|
439
|
+
| Plan | skip | ✓ | ✓ | dev |
|
|
440
|
+
| Arch Review | skip | if TL | ✓ | techlead |
|
|
441
|
+
| Test Plan | skip | skip | ✓ | qc |
|
|
442
|
+
| Execute TDD | ✓ | ✓ | ✓ | dev |
|
|
443
|
+
| Peer Review | self | ✓ | ✓ | dev+peer |
|
|
444
|
+
| QA Confirm | skip | skip | ✓ | qc |
|
|
445
|
+
| Living Docs | skip | skip | ✓ | dev |
|
|
446
|
+
| Estimation | skip | optional | ✓ | dev |
|
|
447
|
+
| Log Work | skip | optional | ✓ | dev |
|
|
448
|
+
| Dashboard | skip | skip | ✓ | pm |
|
|
449
|
+
|
|
450
|
+
> Nếu role không có mặt trong `team.roles`, phase đó gracefully degrade (không block).
|