dw-kit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/executor.md +80 -0
- package/.claude/agents/planner.md +100 -0
- package/.claude/agents/quality-checker.md +86 -0
- package/.claude/agents/researcher.md +93 -0
- package/.claude/agents/reviewer.md +126 -0
- package/.claude/hooks/post-write.sh +62 -0
- package/.claude/hooks/pre-commit-gate.sh +90 -0
- package/.claude/hooks/progress-ping.sh +47 -0
- package/.claude/hooks/safety-guard.sh +54 -0
- package/.claude/rules/code-style.md +37 -0
- package/.claude/rules/commit-standards.md +37 -0
- package/.claude/rules/workflow-rules.md +62 -0
- package/.claude/settings.json +71 -0
- package/.claude/settings.local.json +12 -0
- package/.claude/skills/dw-arch-review/SKILL.md +119 -0
- package/.claude/skills/dw-archive/SKILL.md +81 -0
- package/.claude/skills/dw-commit/SKILL.md +81 -0
- package/.claude/skills/dw-config-init/SKILL.md +91 -0
- package/.claude/skills/dw-config-validate/SKILL.md +75 -0
- package/.claude/skills/dw-dashboard/SKILL.md +209 -0
- package/.claude/skills/dw-debug/SKILL.md +97 -0
- package/.claude/skills/dw-docs-update/SKILL.md +125 -0
- package/.claude/skills/dw-estimate/SKILL.md +90 -0
- package/.claude/skills/dw-execute/SKILL.md +98 -0
- package/.claude/skills/dw-flow/SKILL.md +274 -0
- package/.claude/skills/dw-handoff/SKILL.md +81 -0
- package/.claude/skills/dw-log-work/SKILL.md +69 -0
- package/.claude/skills/dw-plan/SKILL.md +125 -0
- package/.claude/skills/dw-plan/template-plan.md +47 -0
- package/.claude/skills/dw-requirements/SKILL.md +98 -0
- package/.claude/skills/dw-research/SKILL.md +98 -0
- package/.claude/skills/dw-research/template-research.md +51 -0
- package/.claude/skills/dw-review/SKILL.md +66 -0
- package/.claude/skills/dw-review/checklist.md +88 -0
- package/.claude/skills/dw-rollback/SKILL.md +90 -0
- package/.claude/skills/dw-sprint-review/SKILL.md +99 -0
- package/.claude/skills/dw-task-init/SKILL.md +59 -0
- package/.claude/skills/dw-test-plan/SKILL.md +113 -0
- package/.claude/skills/dw-thinking/SKILL.md +70 -0
- package/.claude/skills/dw-thinking/THINKING.md +91 -0
- package/.claude/skills/dw-upgrade/SKILL.md +82 -0
- package/.claude/templates/en/task-context.md +73 -0
- package/.claude/templates/en/task-plan.md +79 -0
- package/.claude/templates/en/task-progress.md +65 -0
- package/.claude/templates/pr-template.md +56 -0
- package/.claude/templates/task-context.md +73 -0
- package/.claude/templates/task-plan.md +79 -0
- package/.claude/templates/task-progress.md +65 -0
- package/.dw/adapters/claude-cli/extensions/.gitkeep +0 -0
- package/.dw/adapters/claude-cli/extensions/README.md +36 -0
- package/.dw/adapters/claude-cli/generated/README.md +23 -0
- package/.dw/adapters/claude-cli/generated/agents/.gitkeep +0 -0
- package/.dw/adapters/claude-cli/generated/skills/.gitkeep +0 -0
- package/.dw/adapters/claude-cli/overrides/README.md +35 -0
- package/.dw/adapters/claude-cli/overrides/agents/.gitkeep +0 -0
- package/.dw/adapters/claude-cli/overrides/skills/.gitkeep +0 -0
- package/.dw/adapters/generic/AGENT.md +169 -0
- package/.dw/adapters/generic/README.md +21 -0
- package/.dw/config/config.schema.json +121 -0
- package/.dw/config/dw.config.yml +82 -0
- package/.dw/config/presets/enterprise.yml +52 -0
- package/.dw/config/presets/small-team.yml +39 -0
- package/.dw/config/presets/solo-quick.yml +37 -0
- package/.dw/core/QUALITY.md +220 -0
- package/.dw/core/ROLES.md +257 -0
- package/.dw/core/THINKING.md +126 -0
- package/.dw/core/WORKFLOW.md +450 -0
- package/.dw/core/templates/vi/task-context.md +92 -0
- package/.dw/core/templates/vi/task-plan.md +93 -0
- package/.dw/core/templates/vi/task-progress.md +56 -0
- package/CLAUDE.md +98 -0
- package/LICENSE +21 -0
- package/README.md +183 -0
- package/bin/dw.mjs +28 -0
- package/package.json +52 -0
- package/scripts/e2e-local-check.sh +76 -0
- package/scripts/migrate-v03-to-v1.sh +243 -0
- package/scripts/upgrade.sh +246 -0
- package/setup.sh +382 -0
- package/src/cli.mjs +68 -0
- package/src/commands/doctor.mjs +149 -0
- package/src/commands/init.mjs +332 -0
- package/src/commands/migrate.mjs +215 -0
- package/src/commands/upgrade.mjs +262 -0
- package/src/commands/validate.mjs +102 -0
- package/src/lib/config.mjs +75 -0
- package/src/lib/copy.mjs +110 -0
- package/src/lib/platform.mjs +39 -0
- package/src/lib/ui.mjs +66 -0
- package/src/smoke-test.mjs +315 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# dw-kit Preset: Solo Developer — Quick Workflow
|
|
2
|
+
# Dùng cho: 1 dev, task nhỏ, prototype, side project
|
|
3
|
+
# Kế thừa từ: config/dw.config.yml (copy và modify)
|
|
4
|
+
|
|
5
|
+
project:
|
|
6
|
+
name: "my-project"
|
|
7
|
+
language: "vi"
|
|
8
|
+
|
|
9
|
+
workflow:
|
|
10
|
+
default_depth: "quick"
|
|
11
|
+
|
|
12
|
+
team:
|
|
13
|
+
roles:
|
|
14
|
+
- dev
|
|
15
|
+
|
|
16
|
+
quality:
|
|
17
|
+
test_command: ""
|
|
18
|
+
lint_command: ""
|
|
19
|
+
block_on_fail: false
|
|
20
|
+
|
|
21
|
+
tracking:
|
|
22
|
+
estimation: false
|
|
23
|
+
log_work: false
|
|
24
|
+
|
|
25
|
+
paths:
|
|
26
|
+
tasks: ".dw/tasks"
|
|
27
|
+
docs: ".dw/docs"
|
|
28
|
+
|
|
29
|
+
claude:
|
|
30
|
+
structured_output: false
|
|
31
|
+
worktree_execution: false
|
|
32
|
+
mcp: []
|
|
33
|
+
|
|
34
|
+
_toolkit:
|
|
35
|
+
core_version: "1.0"
|
|
36
|
+
platform_version: "1.0"
|
|
37
|
+
capability_version: "1.0"
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
<!-- core-version: 1.0 -->
|
|
2
|
+
|
|
3
|
+
# Quality Strategy — 4-Layer Framework
|
|
4
|
+
|
|
5
|
+
> **Nguyên tắc**: Quality là constant. Ceremony adapts.
|
|
6
|
+
> Không có "quality level" — chỉ có depth phù hợp với context.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
Layer 1: Requirements Clarity → trước khi code
|
|
14
|
+
Layer 2: Test-Driven Development → trong khi code
|
|
15
|
+
Layer 3: Cross-Review → sau khi code
|
|
16
|
+
Layer 4: Automated Gates + QA → trước khi merge
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Mỗi layer build on top of layer trước. Skip layer sớm → vấn đề phát sinh muộn hơn với chi phí cao hơn.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Layer 1: Requirements Clarity (Trước Khi Code)
|
|
24
|
+
|
|
25
|
+
**Mục tiêu**: Đảm bảo hiểu đúng và đủ TRƯỚC khi bắt đầu implement.
|
|
26
|
+
|
|
27
|
+
### Given/When/Then Format
|
|
28
|
+
|
|
29
|
+
Mỗi feature/subtask nên có acceptance criteria theo format:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Given [trạng thái ban đầu / precondition]
|
|
33
|
+
When [hành động / trigger]
|
|
34
|
+
Then [kết quả mong đợi / postcondition]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Ví dụ:
|
|
38
|
+
```
|
|
39
|
+
Given user đã đăng nhập và có items trong cart
|
|
40
|
+
When user logout rồi login lại
|
|
41
|
+
Then cart items vẫn còn nguyên
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Checklist Requirements Clarity
|
|
45
|
+
|
|
46
|
+
- [ ] Business logic được mô tả bằng Given/When/Then
|
|
47
|
+
- [ ] Edge cases được identify upfront (không phải sau khi code xong)
|
|
48
|
+
- [ ] Acceptance criteria per subtask: testable và specific (không mơ hồ)
|
|
49
|
+
- [ ] Out-of-scope được ghi rõ (tránh scope creep)
|
|
50
|
+
- [ ] Nếu có TL: TL đã review requirements trước khi dev bắt đầu
|
|
51
|
+
|
|
52
|
+
### Red Flags
|
|
53
|
+
|
|
54
|
+
- Acceptance criteria dùng "should work" / "hoạt động đúng" — không đo lường được
|
|
55
|
+
- Edge cases không được hỏi khi plan, chỉ phát hiện khi test
|
|
56
|
+
- "Tôi hiểu rồi" mà không có written acceptance criteria
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Layer 2: Test-Driven Development (Trong Khi Code)
|
|
61
|
+
|
|
62
|
+
**Mục tiêu**: Tests là specification, không phải afterthought.
|
|
63
|
+
|
|
64
|
+
### TDD Cycle Per Subtask
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
RED → Viết test trước (failing) — test mô tả behavior mong muốn
|
|
68
|
+
GREEN → Implement tối thiểu để test pass — không over-engineer
|
|
69
|
+
REFACTOR → Cải thiện code structure, không thay đổi behavior
|
|
70
|
+
COMMIT → Một subtask = một commit
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Test Coverage Priorities
|
|
74
|
+
|
|
75
|
+
1. **Happy path**: nominal flow với input hợp lệ
|
|
76
|
+
2. **Error cases**: invalid input, missing data, permission denied
|
|
77
|
+
3. **Edge cases**: boundary values, empty collections, concurrent operations
|
|
78
|
+
4. **Regression**: verify fixed bugs không tái xuất hiện
|
|
79
|
+
|
|
80
|
+
### Test Naming Convention
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
should [expected behavior] when [condition]
|
|
84
|
+
|
|
85
|
+
Ví dụ:
|
|
86
|
+
- should return empty cart when user has no items
|
|
87
|
+
- should throw AuthError when token is expired
|
|
88
|
+
- should preserve cart when user re-logs in
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Checklist TDD
|
|
92
|
+
|
|
93
|
+
- [ ] Test file tạo TRƯỚC khi implement
|
|
94
|
+
- [ ] Test fail first (RED) đã verify
|
|
95
|
+
- [ ] Implement minimal để pass (GREEN)
|
|
96
|
+
- [ ] Refactor nếu code smell (không thay đổi tests)
|
|
97
|
+
- [ ] Coverage: happy + error + edge cases
|
|
98
|
+
- [ ] Tests independent (không phụ thuộc thứ tự run)
|
|
99
|
+
- [ ] Không mock internal implementation — chỉ mock external boundaries
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Layer 3: Cross-Review (Sau Khi Code)
|
|
104
|
+
|
|
105
|
+
**Mục tiêu**: Phát hiện issues mà người viết không thấy.
|
|
106
|
+
|
|
107
|
+
### TL Architecture Review (nếu có techlead)
|
|
108
|
+
|
|
109
|
+
Tập trung vào:
|
|
110
|
+
- Architecture decisions đúng không? Có alternatives tốt hơn?
|
|
111
|
+
- Patterns nhất quán với codebase không?
|
|
112
|
+
- Scalability và performance implications?
|
|
113
|
+
- Security design đúng không?
|
|
114
|
+
|
|
115
|
+
Output: Approve hoặc Request Changes với lý do cụ thể.
|
|
116
|
+
|
|
117
|
+
### Peer Code Review Checklist
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
CORRECTNESS
|
|
121
|
+
[ ] Logic đúng? Edge cases handled?
|
|
122
|
+
[ ] Error handling đầy đủ? Logged đủ context?
|
|
123
|
+
[ ] No silent failures
|
|
124
|
+
|
|
125
|
+
SECURITY
|
|
126
|
+
[ ] Input validation ở boundaries?
|
|
127
|
+
[ ] No SQL injection / XSS / command injection?
|
|
128
|
+
[ ] Auth/authz checks đúng?
|
|
129
|
+
[ ] No sensitive data in logs/responses
|
|
130
|
+
|
|
131
|
+
PERFORMANCE
|
|
132
|
+
[ ] N+1 queries?
|
|
133
|
+
[ ] Missing indexes?
|
|
134
|
+
[ ] Unnecessary loops trong hot path?
|
|
135
|
+
|
|
136
|
+
MAINTAINABILITY
|
|
137
|
+
[ ] Naming rõ ràng, self-documenting?
|
|
138
|
+
[ ] Functions làm 1 việc?
|
|
139
|
+
[ ] No dead code?
|
|
140
|
+
[ ] Complex logic có comment (WHY, không WHAT)?
|
|
141
|
+
|
|
142
|
+
TESTS
|
|
143
|
+
[ ] Tests cover happy path + error + edge cases?
|
|
144
|
+
[ ] Test names mô tả behavior?
|
|
145
|
+
[ ] No flaky tests?
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### A/B Testing Cho Uncertain Decisions
|
|
149
|
+
|
|
150
|
+
Khi có 2 approaches và không rõ approach nào tốt hơn:
|
|
151
|
+
1. Prototype cả 2 (minimal implementation)
|
|
152
|
+
2. So sánh: performance, readability, testability, maintainability
|
|
153
|
+
3. TL decide và ghi lý do vào task docs
|
|
154
|
+
4. Loại bỏ prototype không chọn
|
|
155
|
+
|
|
156
|
+
### Review Output Format
|
|
157
|
+
|
|
158
|
+
Reviewer phân loại theo mức độ:
|
|
159
|
+
|
|
160
|
+
| Mức độ | Ký hiệu | Ý nghĩa |
|
|
161
|
+
|--------|---------|---------|
|
|
162
|
+
| Critical | 🔴 | Phải sửa trước khi merge. Block merge. |
|
|
163
|
+
| Warning | 🟡 | Nên sửa. Không block nhưng ưu tiên cao. |
|
|
164
|
+
| Suggestion | 🔵 | Cân nhắc. Không block. |
|
|
165
|
+
| Positive | ✅ | Ghi nhận điểm tốt. |
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Layer 4: Automated Gates + QA Confirmation (Trước Merge)
|
|
170
|
+
|
|
171
|
+
**Mục tiêu**: Machine-verifiable checks và human QA sign-off.
|
|
172
|
+
|
|
173
|
+
### Automated Gates
|
|
174
|
+
|
|
175
|
+
Chạy tự động, block nếu fail (nếu `block_on_fail: true`):
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Quality check script
|
|
179
|
+
{quality.test_command} # unit + integration tests
|
|
180
|
+
{quality.lint_command} # code style + static analysis
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Mandatory (luôn chạy, không configurable):
|
|
184
|
+
- No debug code: `console.log`, `debugger`, `var_dump`, `dd()`
|
|
185
|
+
- No sensitive data: passwords, API keys, tokens trong diff
|
|
186
|
+
|
|
187
|
+
### QA Confirmation (thorough depth + có qc role)
|
|
188
|
+
|
|
189
|
+
QA không phải developer — QA là independent verification:
|
|
190
|
+
|
|
191
|
+
1. QA nhận test plan (từ Phase 3)
|
|
192
|
+
2. QA verify acceptance criteria từ Layer 1
|
|
193
|
+
3. QA chạy regression checklist
|
|
194
|
+
4. QA sign-off là **explicit gate** — không implied, không assumed
|
|
195
|
+
5. Nếu QA find issues → developer fix → QA re-verify
|
|
196
|
+
|
|
197
|
+
### Merge Checklist
|
|
198
|
+
|
|
199
|
+
Trước khi merge PR:
|
|
200
|
+
|
|
201
|
+
- [ ] Layer 1: Tất cả acceptance criteria pass
|
|
202
|
+
- [ ] Layer 2: Tests pass locally và CI
|
|
203
|
+
- [ ] Layer 3: Code review approved (0 CRITICAL, warnings resolved hoặc acknowledged)
|
|
204
|
+
- [ ] Layer 4: Automated gates pass + QA sign-off (nếu required)
|
|
205
|
+
- [ ] No debug code, no sensitive data
|
|
206
|
+
- [ ] Commit messages follow convention
|
|
207
|
+
- [ ] Branch up to date với main
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Quality Anti-Patterns
|
|
212
|
+
|
|
213
|
+
| Anti-pattern | Vấn đề | Fix |
|
|
214
|
+
|-------------|--------|-----|
|
|
215
|
+
| Tests sau khi code xong | Tests được viết để match implementation, không verify behavior | Test-first |
|
|
216
|
+
| Mock everything | Tests pass nhưng integration fails | Chỉ mock external boundaries |
|
|
217
|
+
| "It works on my machine" | Không có automated gate | CI/CD + pre-commit hooks |
|
|
218
|
+
| Skip review vì "urgent" | Bugs slip to production, harder to fix | Fast review còn tốt hơn no review |
|
|
219
|
+
| LGTM without reading | Review là ceremony, không quality gate | Structured checklist |
|
|
220
|
+
| QA là formality | Issues found late, expensive to fix | QA reviews against acceptance criteria |
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
<!-- core-version: 1.0 -->
|
|
2
|
+
|
|
3
|
+
# Team Roles & Authority
|
|
4
|
+
|
|
5
|
+
> **Nguyên tắc**: Roles = capabilities, không phải hierarchy.
|
|
6
|
+
> Config `team.roles` quyết định phases nào available, không phải quality tier.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Role Overview
|
|
11
|
+
|
|
12
|
+
| Role | Ký hiệu config | Core responsibility | Decision authority |
|
|
13
|
+
|------|----------------|--------------------|--------------------|
|
|
14
|
+
| Developer | `dev` | Implementation, testing | Code-level decisions |
|
|
15
|
+
| Tech Lead | `techlead` | Architecture, code standards | Architecture decisions, plan approval |
|
|
16
|
+
| Business Analyst | `ba` | Requirements, user stories | Requirements sign-off |
|
|
17
|
+
| QC Engineer | `qc` | Test planning, quality verification | QA sign-off (Layer 4) |
|
|
18
|
+
| Product Manager | `pm` | Progress visibility, metrics | Sprint planning, backlog priority |
|
|
19
|
+
|
|
20
|
+
> `dev` luôn required. Các roles khác là optional — không có thì phase đó gracefully degrade.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Developer (`dev`)
|
|
25
|
+
|
|
26
|
+
**Trách nhiệm chính**: Research → Plan → Execute → Commit
|
|
27
|
+
|
|
28
|
+
### Phases Developer Owns
|
|
29
|
+
|
|
30
|
+
| Phase | Responsibility |
|
|
31
|
+
|-------|---------------|
|
|
32
|
+
| Initialize | Tạo task docs, scope assessment |
|
|
33
|
+
| Understand | Codebase research, context gathering |
|
|
34
|
+
| Plan | Solution design, subtask breakdown |
|
|
35
|
+
| Execute | Implementation, TDD, subtask commits |
|
|
36
|
+
| Verify | Self-review (Layer 1), automated gates (Layer 2) |
|
|
37
|
+
| Close | Commit, effort log, handoff |
|
|
38
|
+
|
|
39
|
+
### Decision Authority
|
|
40
|
+
|
|
41
|
+
- Code implementation decisions
|
|
42
|
+
- Library/dependency choices (minor)
|
|
43
|
+
- Subtask ordering và approach (trong scope của plan approved)
|
|
44
|
+
- **DỪNG và hỏi khi**: architecture change, API contract change, scope expansion
|
|
45
|
+
|
|
46
|
+
### Best Practices
|
|
47
|
+
|
|
48
|
+
- Commit nhỏ, thường xuyên (mỗi subtask = 1 commit)
|
|
49
|
+
- Update progress file sau mỗi subtask
|
|
50
|
+
- Không implement ngoài scope plan đã approve
|
|
51
|
+
- Phát hiện giả định sai → ghi Changelog + hỏi TL trước khi tiếp tục
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Tech Lead (`techlead`)
|
|
56
|
+
|
|
57
|
+
**Trách nhiệm chính**: Architecture quality, standards enforcement, plan approval
|
|
58
|
+
|
|
59
|
+
### Phases TL Owns
|
|
60
|
+
|
|
61
|
+
| Phase | Responsibility |
|
|
62
|
+
|-------|---------------|
|
|
63
|
+
| Plan | Architecture review, approve plan trước Execute |
|
|
64
|
+
| Execute | Unblock architecture decisions during implementation |
|
|
65
|
+
| Verify | Code review (Layer 3 — architecture focus) |
|
|
66
|
+
| Close | Final technical sign-off |
|
|
67
|
+
|
|
68
|
+
### Decision Authority
|
|
69
|
+
|
|
70
|
+
- Architecture decisions (service boundaries, patterns, data models)
|
|
71
|
+
- Plan approval: **explicit gate** — Execute không bắt đầu khi chưa có TL approve
|
|
72
|
+
- A/B testing resolution: TL chọn approach khi hai approaches không rõ ưu/nhược
|
|
73
|
+
- Technical debt acknowledgment: quyết định "acceptable" hay "must fix"
|
|
74
|
+
|
|
75
|
+
### Architecture Review Checklist
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
[ ] Approach consistent với codebase patterns?
|
|
79
|
+
[ ] Scalability implications acceptable?
|
|
80
|
+
[ ] Security design đúng?
|
|
81
|
+
[ ] API contract backward compatible (hoặc migration plan có)?
|
|
82
|
+
[ ] Subtask breakdown hợp lý? Dependencies đúng?
|
|
83
|
+
[ ] Risks identified và có mitigation?
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### TL không có?
|
|
87
|
+
|
|
88
|
+
- Plan vẫn proceed nhưng developer self-review architecture decisions
|
|
89
|
+
- Ghi rõ trong plan: "Architecture decision by dev (no TL review)"
|
|
90
|
+
- Architecture decisions nên bảo thủ hơn khi không có TL
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Business Analyst (`ba`)
|
|
95
|
+
|
|
96
|
+
**Trách nhiệm chính**: Requirements clarity, user stories, acceptance criteria
|
|
97
|
+
|
|
98
|
+
### Phases BA Owns
|
|
99
|
+
|
|
100
|
+
| Phase | Responsibility |
|
|
101
|
+
|-------|---------------|
|
|
102
|
+
| Initialize | Requirements gathering, user stories |
|
|
103
|
+
| Plan | Review subtask acceptance criteria |
|
|
104
|
+
| Verify | Acceptance criteria verification |
|
|
105
|
+
|
|
106
|
+
### Decision Authority
|
|
107
|
+
|
|
108
|
+
- Requirements sign-off: "dev builds the right thing"
|
|
109
|
+
- Scope boundary: in-scope vs out-of-scope
|
|
110
|
+
- Acceptance criteria: testable, specific, agreed
|
|
111
|
+
|
|
112
|
+
### Requirements Output Format
|
|
113
|
+
|
|
114
|
+
```markdown
|
|
115
|
+
## User Story
|
|
116
|
+
As a [role], I want [goal] so that [benefit].
|
|
117
|
+
|
|
118
|
+
## Acceptance Criteria
|
|
119
|
+
Given [precondition]
|
|
120
|
+
When [action]
|
|
121
|
+
Then [outcome]
|
|
122
|
+
|
|
123
|
+
## Out of Scope
|
|
124
|
+
- [explicitly excluded items]
|
|
125
|
+
|
|
126
|
+
## Edge Cases to Handle
|
|
127
|
+
- [edge case 1]
|
|
128
|
+
- [edge case 2]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### BA không có?
|
|
132
|
+
|
|
133
|
+
- Developer writes requirements từ conversation với stakeholder
|
|
134
|
+
- Requirements review là developer + TL (không có independent BA)
|
|
135
|
+
- Risk cao hơn về misunderstood requirements — tăng frequency of check-ins
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## QC Engineer (`qc`)
|
|
140
|
+
|
|
141
|
+
**Trách nhiệm chính**: Test planning, independent quality verification
|
|
142
|
+
|
|
143
|
+
### Phases QC Owns
|
|
144
|
+
|
|
145
|
+
| Phase | Responsibility |
|
|
146
|
+
|-------|---------------|
|
|
147
|
+
| Plan | Test plan tạo song song với dev plan |
|
|
148
|
+
| Verify | Execute test plan, Layer 4 sign-off |
|
|
149
|
+
|
|
150
|
+
### Decision Authority
|
|
151
|
+
|
|
152
|
+
- QA sign-off: **explicit gate** cho `thorough` depth — không thể self-approve
|
|
153
|
+
- Bug severity classification
|
|
154
|
+
- Regression scope: gì cần test lại sau change
|
|
155
|
+
|
|
156
|
+
### Test Plan Structure
|
|
157
|
+
|
|
158
|
+
```markdown
|
|
159
|
+
## Test Cases
|
|
160
|
+
### TC-1: [Test case name]
|
|
161
|
+
- **Given**: [precondition]
|
|
162
|
+
- **When**: [action]
|
|
163
|
+
- **Then**: [expected result]
|
|
164
|
+
- **Priority**: P1/P2/P3
|
|
165
|
+
|
|
166
|
+
## Regression Checklist
|
|
167
|
+
- [ ] [Feature 1 không bị ảnh hưởng]
|
|
168
|
+
- [ ] [Feature 2 không bị ảnh hưởng]
|
|
169
|
+
|
|
170
|
+
## Security Checklist (nếu applicable)
|
|
171
|
+
- [ ] Input validation
|
|
172
|
+
- [ ] Auth/authz checks
|
|
173
|
+
- [ ] No data exposure
|
|
174
|
+
|
|
175
|
+
## Performance Checklist (nếu applicable)
|
|
176
|
+
- [ ] Response time acceptable
|
|
177
|
+
- [ ] No N+1 queries introduced
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### QC không có?
|
|
181
|
+
|
|
182
|
+
- Developer tự execute test plan (nếu có) hoặc manual verification
|
|
183
|
+
- Layer 4 QA sign-off skip — nhưng automated gates (Layer 4a) vẫn chạy
|
|
184
|
+
- Risk cao hơn về undiscovered bugs
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Product Manager (`pm`)
|
|
189
|
+
|
|
190
|
+
**Trách nhiệm chính**: Progress visibility, metrics, sprint planning
|
|
191
|
+
|
|
192
|
+
### Phases PM Owns
|
|
193
|
+
|
|
194
|
+
| Phase | Responsibility |
|
|
195
|
+
|-------|---------------|
|
|
196
|
+
| Initialize | Sprint planning, priority |
|
|
197
|
+
| Close | Sprint review, velocity tracking |
|
|
198
|
+
| Standalone: Reports | Dashboard generation |
|
|
199
|
+
|
|
200
|
+
### PM View
|
|
201
|
+
|
|
202
|
+
PM không cần đọc code — PM đọc:
|
|
203
|
+
- Progress files (status per subtask)
|
|
204
|
+
- Dashboard reports (velocity, metrics)
|
|
205
|
+
- Sprint review summaries
|
|
206
|
+
|
|
207
|
+
### Dashboard Metrics
|
|
208
|
+
|
|
209
|
+
| Metric | Source | Update frequency |
|
|
210
|
+
|--------|--------|-----------------|
|
|
211
|
+
| Tasks: done/in-progress/blocked | Progress files | Real-time |
|
|
212
|
+
| Velocity | Closed tasks per sprint | Per sprint |
|
|
213
|
+
| Estimate accuracy | Estimate vs actual | Per task |
|
|
214
|
+
| DORA: deployment frequency | Git history | Per release |
|
|
215
|
+
| DORA: lead time | Task start → deploy | Per release |
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Multi-Role Workflow
|
|
220
|
+
|
|
221
|
+
Full team workflow (tất cả roles):
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
BA: /dw-requirements → requirements doc + user stories
|
|
225
|
+
↓
|
|
226
|
+
TL: /dw-arch-review → architecture decision + approve
|
|
227
|
+
↓
|
|
228
|
+
Dev: /dw-task-init → task docs
|
|
229
|
+
Dev: /dw-research → codebase analysis
|
|
230
|
+
Dev+QC: /dw-plan → dev plan + test plan (parallel)
|
|
231
|
+
↓
|
|
232
|
+
TL approve plan
|
|
233
|
+
↓
|
|
234
|
+
Dev: /dw-execute → TDD implementation, commits
|
|
235
|
+
↓
|
|
236
|
+
TL: /dw-review → architecture + code review
|
|
237
|
+
↓
|
|
238
|
+
QC: manual/auto testing → Layer 4 verification
|
|
239
|
+
↓
|
|
240
|
+
Dev: /dw-commit → pre-commit gates
|
|
241
|
+
↓
|
|
242
|
+
PM: /dw-dashboard → visibility, metrics
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Không phải mọi task cần full chain. `default_depth` + available roles quyết định.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Role-Depth Matrix
|
|
250
|
+
|
|
251
|
+
| Role | Quick | Standard | Thorough |
|
|
252
|
+
|------|-------|----------|----------|
|
|
253
|
+
| dev | required | required | required |
|
|
254
|
+
| techlead | not needed | arch decisions only | full review + approval |
|
|
255
|
+
| ba | not needed | requirements check | full requirements |
|
|
256
|
+
| qc | not needed | not needed | full test plan + sign-off |
|
|
257
|
+
| pm | not needed | optional | dashboard |
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<!-- core-version: 1.0 -->
|
|
2
|
+
|
|
3
|
+
# Tư Duy Phản Biện, Hệ Thống, Đa Góc Nhìn & First Principles
|
|
4
|
+
|
|
5
|
+
Framework tư duy cho cả người và AI agent khi research, plan, và implement.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. First Principles Thinking
|
|
10
|
+
|
|
11
|
+
**Mục đích**: Bỏ qua assumptions, trở về câu hỏi cơ bản nhất. Tránh "chúng tôi luôn làm vậy."
|
|
12
|
+
|
|
13
|
+
### Quy Trình
|
|
14
|
+
|
|
15
|
+
1. **Decompose**: Tách vấn đề thành các phần cơ bản nhất — không thể tách nhỏ hơn
|
|
16
|
+
2. **Question assumptions**: Mỗi assumption: "Điều này có đúng không? Có thể kiểm chứng được không?"
|
|
17
|
+
3. **Rebuild**: Từ những gì đã verify, build lại solution từ đầu
|
|
18
|
+
4. **Compare**: Solution mới có ưu việt hơn solution cũ không? Tại sao?
|
|
19
|
+
|
|
20
|
+
### Câu Hỏi First Principles
|
|
21
|
+
|
|
22
|
+
- "Vấn đề thực sự cần giải quyết là gì?" (không phải symptom)
|
|
23
|
+
- "Nếu không có bất kỳ constraint nào, solution tốt nhất là gì?"
|
|
24
|
+
- "Constraint nào là thực sự hard, constraint nào là assumed?"
|
|
25
|
+
- "Ai đang được served bởi solution này? Họ thực sự cần gì?"
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 2. Tư Duy Phản Biện (Critical Thinking)
|
|
30
|
+
|
|
31
|
+
**Mục đích**: Không chấp nhận giả định một chiều. Đặt câu hỏi, xem xét rủi ro, phương án thay thế.
|
|
32
|
+
|
|
33
|
+
### Câu Hỏi Khi Research & Plan
|
|
34
|
+
|
|
35
|
+
- **Giả định**: Những giả định nào đang coi là đúng? Nếu sai thì ảnh hưởng thế nào?
|
|
36
|
+
- **Bằng chứng**: Kết luận dựa trên đâu (code, doc, đo lường)? Thiếu bằng chứng ở đâu?
|
|
37
|
+
- **Edge cases**: Trường hợp biên nào có thể làm hỏng thiết kế? (null, empty, concurrent, rollback)
|
|
38
|
+
- **Rủi ro**: Rủi ro kỹ thuật, vận hành, bảo mật? Xác suất và tác động?
|
|
39
|
+
- **Phương án thay thế**: Còn cách nào khác? Trade-off so với approach hiện tại?
|
|
40
|
+
- **Phản diện (Devil's advocate)**: Lý do mạnh nhất để KHÔNG làm theo approach đang chọn?
|
|
41
|
+
- **Đơn giản hơn**: Có cách nào đơn giản hơn đạt cùng mục tiêu không?
|
|
42
|
+
|
|
43
|
+
### Áp Dụng Trong Task
|
|
44
|
+
|
|
45
|
+
- **Research**: Ghi rõ "Giả định", "Hạn chế đã biết", "Chưa rõ / cần kiểm chứng"
|
|
46
|
+
- **Plan**: Có mục "Rủi ro & Giả định" và "Phương án đã xem xét"
|
|
47
|
+
- **Execute**: Phát hiện giả định sai → DỪNG, ghi Changelog, cập nhật plan
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 3. Tư Duy Hệ Thống (Systems Thinking)
|
|
52
|
+
|
|
53
|
+
**Mục đích**: Xem task trong bối cảnh hệ thống lớn. Dependencies, tác động lan truyền, failure modes.
|
|
54
|
+
|
|
55
|
+
### Các Khía Cạnh Cần Xem Xét
|
|
56
|
+
|
|
57
|
+
- **Dependencies**: Task này phụ thuộc vào gì? Ai phụ thuộc vào kết quả của task này?
|
|
58
|
+
- **Boundaries**: Ranh giới rõ ràng chưa? Interfaces ổn định chưa?
|
|
59
|
+
- **Data flow**: Dữ liệu đi từ đâu đến đâu? Thêm DB/cache/queue? Consistency?
|
|
60
|
+
- **Feedback loops**: Thay đổi có tạo vòng lặp không? Cần giới hạn hay debounce?
|
|
61
|
+
- **Failure modes**: Một phần lỗi → hệ thống còn lại ứng xử thế nào? Graceful degradation?
|
|
62
|
+
- **Scale**: Khi tải tăng, điểm nghẽn ở đâu? N+1 queries, missing indexes, locks?
|
|
63
|
+
|
|
64
|
+
### Áp Dụng Trong Task
|
|
65
|
+
|
|
66
|
+
- **Research**: Mô tả (hoặc diagram) luồng hiện tại và vị trí của task
|
|
67
|
+
- **Plan**: Mục "Tác động hệ thống" — modules bị ảnh hưởng, API changes, migration
|
|
68
|
+
- **Subtasks**: Tách rõ schema / service / route / frontend để review dependencies
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 4. Đa Góc Nhìn (Multiple Perspectives)
|
|
73
|
+
|
|
74
|
+
**Mục đích**: Tránh optimize cho một role. Cân bằng nhu cầu nhiều bên liên quan.
|
|
75
|
+
|
|
76
|
+
### Bảng Góc Nhìn
|
|
77
|
+
|
|
78
|
+
| Góc nhìn | Câu hỏi điển hình |
|
|
79
|
+
|----------|-------------------|
|
|
80
|
+
| **End user** | Dễ dùng không? Feature có match use case thực tế? |
|
|
81
|
+
| **Developer** | Code dễ đọc, test được không? API nhất quán? |
|
|
82
|
+
| **Security** | Ai được làm gì? Có lộ data không? Auth/authz đúng? Rate limit? |
|
|
83
|
+
| **Ops/Vận hành** | Deploy thế nào? Migration cần gì? Metric/log/debug khi lỗi? |
|
|
84
|
+
| **Business/Product** | Giải quyết đúng pain point chưa? Ship được từng phần? |
|
|
85
|
+
| **Ngắn hạn vs dài hạn** | Ship nhanh vs kiến trúc bền vững. Tech debt chấp nhận được không? |
|
|
86
|
+
|
|
87
|
+
### Áp Dụng Trong Task
|
|
88
|
+
|
|
89
|
+
- **Plan**: Mục "Góc nhìn & Trade-offs" — mỗi quyết định lớn, ghi tác động per role
|
|
90
|
+
- **Acceptance criteria**: Có thể tách "User: ...", "Dev: ...", "Security: ..."
|
|
91
|
+
- **Review**: Nếu chỉ đúng về kỹ thuật nhưng bỏ qua security/ops → bổ sung
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 5. Checklist Nhanh (Trước Khi Kết Thúc Mỗi Phase)
|
|
96
|
+
|
|
97
|
+
### Research
|
|
98
|
+
|
|
99
|
+
- [ ] Đã ghi giả định và có thể sai không?
|
|
100
|
+
- [ ] Đã ghi những gì chưa rõ / cần kiểm chứng?
|
|
101
|
+
- [ ] Đã identify failure modes của kiến trúc hiện tại?
|
|
102
|
+
|
|
103
|
+
### Plan
|
|
104
|
+
|
|
105
|
+
- [ ] Đã xem xét ≥2 approaches và so sánh trade-offs?
|
|
106
|
+
- [ ] Có mục Rủi ro & Giả định?
|
|
107
|
+
- [ ] Có mục Edge cases?
|
|
108
|
+
- [ ] Có mục Tác động hệ thống?
|
|
109
|
+
- [ ] Đã xem xét ≥2 góc nhìn (user, security, dev, ops)?
|
|
110
|
+
- [ ] Devil's advocate: lý do mạnh nhất để không làm approach này?
|
|
111
|
+
|
|
112
|
+
### Execute
|
|
113
|
+
|
|
114
|
+
- [ ] Có assumption nào bị chứng minh sai? → Ghi Changelog, cập nhật plan
|
|
115
|
+
- [ ] Có scope thay đổi? → Cập nhật plan, hỏi human
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 6. Prompt Gợi Ý Cho Agent
|
|
120
|
+
|
|
121
|
+
Khi giao task cho AI agent:
|
|
122
|
+
|
|
123
|
+
> "Khi làm task này, áp dụng framework trong `core/THINKING.md`:
|
|
124
|
+
> - Trước khi viết plan, liệt kê: (1) giả định đang dùng, (2) 2 rủi ro chính, (3) 1 phương án thay thế đã loại và lý do
|
|
125
|
+
> - Xem xét tác động lên ít nhất 2 góc nhìn (vd: user + security)
|
|
126
|
+
> - Nếu phát hiện giả định sai trong khi execute → dừng, ghi Changelog, hỏi"
|