dw-kit 1.2.0 → 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.
- package/.claude/hooks/post-write.sh +64 -58
- package/.claude/hooks/pre-commit-gate.sh +96 -90
- package/.claude/hooks/privacy-block.sh +99 -94
- package/.claude/hooks/progress-ping.sh +53 -47
- package/.claude/hooks/safety-guard.sh +60 -54
- package/.claude/hooks/scout-block.sh +88 -82
- package/.claude/hooks/session-init.sh +91 -74
- package/.claude/hooks/stop-check.sh +88 -36
- package/.claude/hooks/telemetry-log.sh +34 -0
- package/.claude/rules/code-style.md +37 -37
- package/.claude/rules/commit-standards.md +37 -37
- package/.claude/rules/dw.md +136 -0
- package/.claude/settings.json +120 -99
- package/.claude/skills/dw-arch-review/SKILL.md +119 -119
- package/.claude/skills/dw-archive/SKILL.md +81 -81
- package/.claude/skills/dw-commit/SKILL.md +81 -81
- package/.claude/skills/dw-config-init/SKILL.md +91 -91
- package/.claude/skills/dw-config-validate/SKILL.md +75 -75
- package/.claude/skills/dw-dashboard/SKILL.md +209 -209
- package/.claude/skills/dw-debug/SKILL.md +97 -97
- package/.claude/skills/dw-decision/SKILL.md +116 -0
- package/.claude/skills/dw-docs-update/SKILL.md +125 -125
- package/.claude/skills/dw-estimate/SKILL.md +90 -90
- package/.claude/skills/dw-execute/SKILL.md +98 -98
- package/.claude/skills/dw-flow/SKILL.md +274 -274
- package/.claude/skills/dw-handoff/SKILL.md +81 -81
- package/.claude/skills/dw-kit-report/SKILL.md +152 -152
- package/.claude/skills/dw-log-work/SKILL.md +69 -69
- package/.claude/skills/dw-onboard/SKILL.md +201 -201
- package/.claude/skills/dw-plan/SKILL.md +125 -125
- package/.claude/skills/dw-prompt/SKILL.md +62 -62
- package/.claude/skills/dw-requirements/SKILL.md +98 -98
- package/.claude/skills/dw-research/SKILL.md +114 -114
- package/.claude/skills/dw-retroactive/SKILL.md +311 -311
- package/.claude/skills/dw-review/SKILL.md +66 -66
- package/.claude/skills/dw-rollback/SKILL.md +90 -90
- package/.claude/skills/dw-sprint-review/SKILL.md +99 -99
- package/.claude/skills/dw-task-init/SKILL.md +59 -59
- package/.claude/skills/dw-test-plan/SKILL.md +113 -113
- package/.claude/skills/dw-thinking/SKILL.md +70 -70
- package/.claude/skills/dw-upgrade/SKILL.md +72 -72
- package/.dw/config/dw.config.yml +82 -82
- package/.dw/core/PILLARS.md +122 -0
- package/.dw/core/templates/v2/spec.md +68 -0
- package/.dw/core/templates/v2/tracking.md +62 -0
- package/.dw/core/v14-evaluation-protocol.md +118 -0
- package/CLAUDE.md +42 -39
- package/MIGRATION-v1.3.md +201 -0
- package/README.md +43 -6
- package/package.json +86 -84
- package/src/cli.mjs +45 -9
- package/src/commands/dashboard.mjs +116 -0
- package/src/commands/doctor.mjs +165 -149
- package/src/commands/init.mjs +339 -332
- package/src/commands/metrics.mjs +165 -0
- package/src/commands/upgrade.mjs +297 -262
- package/src/lib/active-index.mjs +87 -0
- package/src/lib/copy.mjs +118 -110
- package/src/lib/cut-analysis.mjs +161 -0
- package/src/lib/telemetry.mjs +80 -0
- package/.claude/rules/dw-core.md +0 -100
- package/.claude/rules/dw-skills.md +0 -53
- package/.claude/rules/workflow-rules.md +0 -77
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dw
|
|
3
|
-
description: "Improve a vague task description into a clear, actionable prompt. Uses git log + recent dw tasks for project context. Output is concise — human dev will refine further."
|
|
4
|
-
argument-hint: "[task description] [--vi]"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Prompt Builder
|
|
8
|
-
|
|
9
|
-
Input: **$ARGUMENTS**
|
|
10
|
-
|
|
11
|
-
## Bước 0 — Parse options
|
|
12
|
-
|
|
13
|
-
- Nếu `$ARGUMENTS` chứa `--vi`: output bằng **tiếng Việt**, bỏ flag `--vi` ra khỏi description
|
|
14
|
-
- Mặc định: output bằng **tiếng Anh**
|
|
15
|
-
|
|
16
|
-
## Bước 1 — Lấy context từ git log
|
|
17
|
-
|
|
18
|
-
Extract 1–2 keywords chính từ description (bỏ qua stop words: fix, add, feat, the, a, in, of).
|
|
19
|
-
|
|
20
|
-
Chạy **cả hai** để có context tốt nhất:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
# Tìm commits liên quan theo keyword
|
|
24
|
-
git log --oneline --no-merges --all --grep="<keyword1>" -15
|
|
25
|
-
git log --oneline --no-merges --all --grep="<keyword2>" -15
|
|
26
|
-
|
|
27
|
-
# Fallback: 30 commits gần nhất
|
|
28
|
-
git log --oneline --no-merges -30
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Dùng kết quả để nhận ra: module names, naming conventions, commit style của project.
|
|
32
|
-
|
|
33
|
-
## Bước 2 — Lấy context từ dw tasks gần đây
|
|
34
|
-
|
|
35
|
-
Đọc danh sách task đang/đã làm:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
ls .dw/tasks/
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Nếu có task liên quan đến keyword → đọc file `*-progress.md` để hiểu thêm context (scope, decisions, findings).
|
|
42
|
-
|
|
43
|
-
## Bước 3 — Improve prompt
|
|
44
|
-
|
|
45
|
-
**Nếu $ARGUMENTS rỗng (sau khi bỏ flags):** hỏi ngắn "Describe your task:" trước.
|
|
46
|
-
|
|
47
|
-
**Rules:**
|
|
48
|
-
- **1–2 dòng tối đa** — human dev sẽ tự sửa thêm
|
|
49
|
-
- Giữ: **what** + **scope** (nếu rõ từ context) + **outcome** (nếu rõ)
|
|
50
|
-
- Active voice, present tense: "Fix...", "Add...", "Refactor..."
|
|
51
|
-
- Không bullet points, không markdown headers trong output
|
|
52
|
-
- Match naming conventions từ git log nếu nhận ra được
|
|
53
|
-
|
|
54
|
-
## Output format
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
─── Improved prompt ──────────────────────
|
|
58
|
-
<1–2 line improved prompt>
|
|
59
|
-
──────────────────────────────────────────
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Không thêm gì khác ngoài block trên.
|
|
1
|
+
---
|
|
2
|
+
name: dw:prompt
|
|
3
|
+
description: "Improve a vague task description into a clear, actionable prompt. Uses git log + recent dw tasks for project context. Output is concise — human dev will refine further."
|
|
4
|
+
argument-hint: "[task description] [--vi]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Prompt Builder
|
|
8
|
+
|
|
9
|
+
Input: **$ARGUMENTS**
|
|
10
|
+
|
|
11
|
+
## Bước 0 — Parse options
|
|
12
|
+
|
|
13
|
+
- Nếu `$ARGUMENTS` chứa `--vi`: output bằng **tiếng Việt**, bỏ flag `--vi` ra khỏi description
|
|
14
|
+
- Mặc định: output bằng **tiếng Anh**
|
|
15
|
+
|
|
16
|
+
## Bước 1 — Lấy context từ git log
|
|
17
|
+
|
|
18
|
+
Extract 1–2 keywords chính từ description (bỏ qua stop words: fix, add, feat, the, a, in, of).
|
|
19
|
+
|
|
20
|
+
Chạy **cả hai** để có context tốt nhất:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Tìm commits liên quan theo keyword
|
|
24
|
+
git log --oneline --no-merges --all --grep="<keyword1>" -15
|
|
25
|
+
git log --oneline --no-merges --all --grep="<keyword2>" -15
|
|
26
|
+
|
|
27
|
+
# Fallback: 30 commits gần nhất
|
|
28
|
+
git log --oneline --no-merges -30
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Dùng kết quả để nhận ra: module names, naming conventions, commit style của project.
|
|
32
|
+
|
|
33
|
+
## Bước 2 — Lấy context từ dw tasks gần đây
|
|
34
|
+
|
|
35
|
+
Đọc danh sách task đang/đã làm:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
ls .dw/tasks/
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Nếu có task liên quan đến keyword → đọc file `*-progress.md` để hiểu thêm context (scope, decisions, findings).
|
|
42
|
+
|
|
43
|
+
## Bước 3 — Improve prompt
|
|
44
|
+
|
|
45
|
+
**Nếu $ARGUMENTS rỗng (sau khi bỏ flags):** hỏi ngắn "Describe your task:" trước.
|
|
46
|
+
|
|
47
|
+
**Rules:**
|
|
48
|
+
- **1–2 dòng tối đa** — human dev sẽ tự sửa thêm
|
|
49
|
+
- Giữ: **what** + **scope** (nếu rõ từ context) + **outcome** (nếu rõ)
|
|
50
|
+
- Active voice, present tense: "Fix...", "Add...", "Refactor..."
|
|
51
|
+
- Không bullet points, không markdown headers trong output
|
|
52
|
+
- Match naming conventions từ git log nếu nhận ra được
|
|
53
|
+
|
|
54
|
+
## Output format
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
─── Improved prompt ──────────────────────
|
|
58
|
+
<1–2 line improved prompt>
|
|
59
|
+
──────────────────────────────────────────
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Không thêm gì khác ngoài block trên.
|
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dw
|
|
3
|
-
description: "BA skill: Thu thập, phân tích và viết requirements document + user stories. Dùng ở đầu feature trước khi dev bắt đầu."
|
|
4
|
-
argument-hint: "[feature-name]"
|
|
5
|
-
allowed-tools:
|
|
6
|
-
- Read
|
|
7
|
-
- Write
|
|
8
|
-
- Glob
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Thu Thập & Viết Requirements
|
|
12
|
-
|
|
13
|
-
Feature: **$ARGUMENTS**
|
|
14
|
-
|
|
15
|
-
## Đọc Config
|
|
16
|
-
|
|
17
|
-
Đọc `.dw/config/dw.config.yml` → `paths.tasks`, `team.roles`, `workflow.default_depth`.
|
|
18
|
-
Skill này dành cho depth: `standard` hoặc `thorough`.
|
|
19
|
-
|
|
20
|
-
## Quy Trình
|
|
21
|
-
|
|
22
|
-
### 1. Thu thập thông tin
|
|
23
|
-
|
|
24
|
-
Hỏi (hoặc đọc từ conversation context):
|
|
25
|
-
- **Business goal**: Mục tiêu kinh doanh là gì?
|
|
26
|
-
- **User problems**: Người dùng đang gặp vấn đề gì?
|
|
27
|
-
- **Stakeholders**: Ai bị ảnh hưởng? (end user, admin, ops)
|
|
28
|
-
- **Scope**: In-scope là gì? Out-of-scope là gì?
|
|
29
|
-
- **Constraints**: Deadline? Tech constraints? Budget?
|
|
30
|
-
- **Success criteria**: Làm sao biết feature thành công?
|
|
31
|
-
|
|
32
|
-
### 2. Phân tích & cấu trúc
|
|
33
|
-
|
|
34
|
-
Tổ chức yêu cầu thành:
|
|
35
|
-
- **Functional requirements**: Hệ thống PHẢI làm gì
|
|
36
|
-
- **Non-functional requirements**: Performance, security, scalability
|
|
37
|
-
- **User stories**: As [who], I want [what], so that [why]
|
|
38
|
-
- **Acceptance criteria**: Điều kiện pass/fail
|
|
39
|
-
|
|
40
|
-
### 3. Tạo Requirements Doc
|
|
41
|
-
|
|
42
|
-
Ghi ra `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-requirements.md`:
|
|
43
|
-
|
|
44
|
-
```markdown
|
|
45
|
-
# Requirements: [Feature Name]
|
|
46
|
-
|
|
47
|
-
## Ngày: [date] | Author: BA | Status: Draft
|
|
48
|
-
|
|
49
|
-
## Business Context
|
|
50
|
-
**Goal**: [Mục tiêu kinh doanh]
|
|
51
|
-
**Problem**: [Vấn đề cần giải quyết]
|
|
52
|
-
**Success Metrics**: [Đo lường thành công bằng gì]
|
|
53
|
-
|
|
54
|
-
## Stakeholders
|
|
55
|
-
| Role | Nhu cầu | Priority |
|
|
56
|
-
|------|---------|---------|
|
|
57
|
-
| End User | | Must-have |
|
|
58
|
-
| Admin | | |
|
|
59
|
-
|
|
60
|
-
## User Stories
|
|
61
|
-
|
|
62
|
-
### Epic: [Tên epic]
|
|
63
|
-
|
|
64
|
-
**US-001**: Tiêu đề ngắn gọn
|
|
65
|
-
- **As**: [role]
|
|
66
|
-
- **I want**: [action/feature]
|
|
67
|
-
- **So that**: [business value]
|
|
68
|
-
- **Acceptance Criteria**:
|
|
69
|
-
- [ ] Given [context], when [action], then [result]
|
|
70
|
-
- [ ] Given [context], when [edge case], then [expected behavior]
|
|
71
|
-
- **Priority**: Must-have / Should-have / Nice-to-have
|
|
72
|
-
- **Estimate**: [rough size]
|
|
73
|
-
|
|
74
|
-
## Functional Requirements
|
|
75
|
-
| # | Requirement | Priority | Notes |
|
|
76
|
-
|---|------------|---------|-------|
|
|
77
|
-
|
|
78
|
-
## Non-Functional Requirements
|
|
79
|
-
| # | Requirement | Metric |
|
|
80
|
-
|---|------------|--------|
|
|
81
|
-
| NFR-1 | Performance: page load < 2s | p95 |
|
|
82
|
-
| NFR-2 | Availability: 99.9% uptime | |
|
|
83
|
-
|
|
84
|
-
## Out of Scope
|
|
85
|
-
- [Điều này KHÔNG bao gồm]
|
|
86
|
-
|
|
87
|
-
## Open Questions
|
|
88
|
-
- [ ] [Câu hỏi cần BA/PM làm rõ]
|
|
89
|
-
|
|
90
|
-
## Dependencies
|
|
91
|
-
- [Feature/system khác cần có trước]
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Sau Khi Tạo
|
|
95
|
-
|
|
96
|
-
- Thông báo dev: "Requirements doc sẵn sàng tại [path]"
|
|
97
|
-
- Gợi ý: "TL có thể chạy `/dw
|
|
98
|
-
- Gợi ý: "Dev có thể chạy `/dw
|
|
1
|
+
---
|
|
2
|
+
name: dw:requirements
|
|
3
|
+
description: "BA skill: Thu thập, phân tích và viết requirements document + user stories. Dùng ở đầu feature trước khi dev bắt đầu."
|
|
4
|
+
argument-hint: "[feature-name]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Glob
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Thu Thập & Viết Requirements
|
|
12
|
+
|
|
13
|
+
Feature: **$ARGUMENTS**
|
|
14
|
+
|
|
15
|
+
## Đọc Config
|
|
16
|
+
|
|
17
|
+
Đọc `.dw/config/dw.config.yml` → `paths.tasks`, `team.roles`, `workflow.default_depth`.
|
|
18
|
+
Skill này dành cho depth: `standard` hoặc `thorough`.
|
|
19
|
+
|
|
20
|
+
## Quy Trình
|
|
21
|
+
|
|
22
|
+
### 1. Thu thập thông tin
|
|
23
|
+
|
|
24
|
+
Hỏi (hoặc đọc từ conversation context):
|
|
25
|
+
- **Business goal**: Mục tiêu kinh doanh là gì?
|
|
26
|
+
- **User problems**: Người dùng đang gặp vấn đề gì?
|
|
27
|
+
- **Stakeholders**: Ai bị ảnh hưởng? (end user, admin, ops)
|
|
28
|
+
- **Scope**: In-scope là gì? Out-of-scope là gì?
|
|
29
|
+
- **Constraints**: Deadline? Tech constraints? Budget?
|
|
30
|
+
- **Success criteria**: Làm sao biết feature thành công?
|
|
31
|
+
|
|
32
|
+
### 2. Phân tích & cấu trúc
|
|
33
|
+
|
|
34
|
+
Tổ chức yêu cầu thành:
|
|
35
|
+
- **Functional requirements**: Hệ thống PHẢI làm gì
|
|
36
|
+
- **Non-functional requirements**: Performance, security, scalability
|
|
37
|
+
- **User stories**: As [who], I want [what], so that [why]
|
|
38
|
+
- **Acceptance criteria**: Điều kiện pass/fail
|
|
39
|
+
|
|
40
|
+
### 3. Tạo Requirements Doc
|
|
41
|
+
|
|
42
|
+
Ghi ra `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-requirements.md`:
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
# Requirements: [Feature Name]
|
|
46
|
+
|
|
47
|
+
## Ngày: [date] | Author: BA | Status: Draft
|
|
48
|
+
|
|
49
|
+
## Business Context
|
|
50
|
+
**Goal**: [Mục tiêu kinh doanh]
|
|
51
|
+
**Problem**: [Vấn đề cần giải quyết]
|
|
52
|
+
**Success Metrics**: [Đo lường thành công bằng gì]
|
|
53
|
+
|
|
54
|
+
## Stakeholders
|
|
55
|
+
| Role | Nhu cầu | Priority |
|
|
56
|
+
|------|---------|---------|
|
|
57
|
+
| End User | | Must-have |
|
|
58
|
+
| Admin | | |
|
|
59
|
+
|
|
60
|
+
## User Stories
|
|
61
|
+
|
|
62
|
+
### Epic: [Tên epic]
|
|
63
|
+
|
|
64
|
+
**US-001**: Tiêu đề ngắn gọn
|
|
65
|
+
- **As**: [role]
|
|
66
|
+
- **I want**: [action/feature]
|
|
67
|
+
- **So that**: [business value]
|
|
68
|
+
- **Acceptance Criteria**:
|
|
69
|
+
- [ ] Given [context], when [action], then [result]
|
|
70
|
+
- [ ] Given [context], when [edge case], then [expected behavior]
|
|
71
|
+
- **Priority**: Must-have / Should-have / Nice-to-have
|
|
72
|
+
- **Estimate**: [rough size]
|
|
73
|
+
|
|
74
|
+
## Functional Requirements
|
|
75
|
+
| # | Requirement | Priority | Notes |
|
|
76
|
+
|---|------------|---------|-------|
|
|
77
|
+
|
|
78
|
+
## Non-Functional Requirements
|
|
79
|
+
| # | Requirement | Metric |
|
|
80
|
+
|---|------------|--------|
|
|
81
|
+
| NFR-1 | Performance: page load < 2s | p95 |
|
|
82
|
+
| NFR-2 | Availability: 99.9% uptime | |
|
|
83
|
+
|
|
84
|
+
## Out of Scope
|
|
85
|
+
- [Điều này KHÔNG bao gồm]
|
|
86
|
+
|
|
87
|
+
## Open Questions
|
|
88
|
+
- [ ] [Câu hỏi cần BA/PM làm rõ]
|
|
89
|
+
|
|
90
|
+
## Dependencies
|
|
91
|
+
- [Feature/system khác cần có trước]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Sau Khi Tạo
|
|
95
|
+
|
|
96
|
+
- Thông báo dev: "Requirements doc sẵn sàng tại [path]"
|
|
97
|
+
- Gợi ý: "TL có thể chạy `/dw:arch-review $ARGUMENTS` để review technical feasibility"
|
|
98
|
+
- Gợi ý: "Dev có thể chạy `/dw:task-init $ARGUMENTS` để bắt đầu implementation"
|
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dw
|
|
3
|
-
description: "Khảo sát và phân tích codebase trước khi lập kế hoạch. Tìm patterns, dependencies, và ảnh hưởng của thay đổi. Dùng khi cần hiểu code trước khi implement."
|
|
4
|
-
argument-hint: "[task-name]"
|
|
5
|
-
context: fork
|
|
6
|
-
agent: researcher
|
|
7
|
-
allowed-tools:
|
|
8
|
-
- Read
|
|
9
|
-
- Grep
|
|
10
|
-
- Glob
|
|
11
|
-
- "Bash(git log *)"
|
|
12
|
-
- "Bash(git diff *)"
|
|
13
|
-
- "Bash(git show *)"
|
|
14
|
-
- "Bash(git blame *)"
|
|
15
|
-
- "Bash(ls *)"
|
|
16
|
-
- "Bash(wc *)"
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
# Khảo Sát Codebase
|
|
20
|
-
|
|
21
|
-
Task: **$ARGUMENTS**
|
|
22
|
-
|
|
23
|
-
## Đọc Config
|
|
24
|
-
|
|
25
|
-
Đọc `.dw/config/dw.config.yml` → lấy `paths.tasks` để biết output location.
|
|
26
|
-
|
|
27
|
-
## Bước 1: Đọc yêu cầu
|
|
28
|
-
|
|
29
|
-
- Đọc file `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-plan.md` nếu đã có mô tả yêu cầu
|
|
30
|
-
- Hoặc lấy yêu cầu từ conversation context
|
|
31
|
-
|
|
32
|
-
## Bước 2: Khảo sát
|
|
33
|
-
|
|
34
|
-
Thực hiện các bước sau (không cần theo thứ tự cứng):
|
|
35
|
-
|
|
36
|
-
1. **Tìm files liên quan**: Dùng Glob + Grep để tìm files theo keywords từ yêu cầu
|
|
37
|
-
2. **Đọc code**: Đọc các files tìm được, hiểu logic hiện tại
|
|
38
|
-
3. **Trace data flow**: Theo dõi luồng dữ liệu từ input → processing → output
|
|
39
|
-
4. **Xác định dependencies**:
|
|
40
|
-
- Upstream: modules/APIs mà code hiện tại gọi đến
|
|
41
|
-
- Downstream: modules/APIs gọi đến code hiện tại
|
|
42
|
-
5. **Tìm patterns**: Conventions, design patterns đang dùng trong project
|
|
43
|
-
6. **Kiểm tra tests**: Đã có test coverage cho khu vực liên quan?
|
|
44
|
-
7. **Git history**: Xem lịch sử thay đổi gần đây của files liên quan
|
|
45
|
-
|
|
46
|
-
## Bước 3: Áp dụng tư duy phản biện
|
|
47
|
-
|
|
48
|
-
Từ framework `.claude/skills/dw-thinking/THINKING.md`:
|
|
49
|
-
- **Giả định**: Những gì đang giả định là đúng? Cần kiểm chứng?
|
|
50
|
-
- **Dependencies**: Module nào bị ảnh hưởng nếu thay đổi?
|
|
51
|
-
- **Edge cases**: Trường hợp biên nào cần xem xét?
|
|
52
|
-
- **Rủi ro**: Rủi ro kỹ thuật, bảo mật, performance?
|
|
53
|
-
|
|
54
|
-
## Bước 4: Ghi kết quả
|
|
55
|
-
|
|
56
|
-
Ghi vào `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-context.md` theo cấu trúc:
|
|
57
|
-
|
|
58
|
-
```markdown
|
|
59
|
-
# Context: [Task Name]
|
|
60
|
-
|
|
61
|
-
## Ngày khảo sát: [date]
|
|
62
|
-
|
|
63
|
-
## Yêu Cầu Gốc
|
|
64
|
-
[Copy yêu cầu]
|
|
65
|
-
|
|
66
|
-
## Files Liên Quan
|
|
67
|
-
| File | Vai trò | Cần thay đổi? | Ghi chú |
|
|
68
|
-
|------|---------|----------------|---------|
|
|
69
|
-
|
|
70
|
-
## Kiến Trúc Hiện Tại
|
|
71
|
-
[Mô tả luồng, diagram nếu cần]
|
|
72
|
-
|
|
73
|
-
## Dependencies
|
|
74
|
-
**Upstream**: ...
|
|
75
|
-
**Downstream**: ...
|
|
76
|
-
|
|
77
|
-
## Patterns & Conventions
|
|
78
|
-
- [Pattern]: [mô tả]
|
|
79
|
-
|
|
80
|
-
## Giả Định & Hạn Chế
|
|
81
|
-
- Giả định: ...
|
|
82
|
-
- Hạn chế: ...
|
|
83
|
-
- Chưa rõ: ...
|
|
84
|
-
|
|
85
|
-
## Test Coverage Hiện Tại
|
|
86
|
-
[Có test không? Coverage ở đâu?]
|
|
87
|
-
|
|
88
|
-
## Ghi Chú
|
|
89
|
-
[Bất kỳ thông tin bổ sung]
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## Bước 5: Tạo Report (optional — standard/thorough depth)
|
|
93
|
-
|
|
94
|
-
Nếu task có `.dw/tasks/$ARGUMENTS/reports/` directory (hoặc depth ≥ standard), tạo report:
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
.dw/tasks/$ARGUMENTS/reports/[YYMMDD-HHMM]-from-researcher-to-planner-findings.md
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Dùng template `.claude/templates/agent-report.md` với:
|
|
101
|
-
- `status: DONE` (hoặc `DONE_WITH_CONCERNS` nếu có risks lớn)
|
|
102
|
-
- Summary: top 3 findings
|
|
103
|
-
- Details: key files, patterns, dependencies
|
|
104
|
-
- Next Steps: những gì planner cần biết
|
|
105
|
-
|
|
106
|
-
> Quick depth tasks: bỏ qua bước này — progress.md đã đủ.
|
|
107
|
-
|
|
108
|
-
## Bước 6: Tóm tắt
|
|
109
|
-
|
|
110
|
-
Khi hoàn thành, trả về tóm tắt:
|
|
111
|
-
- Số files khảo sát
|
|
112
|
-
- Key findings (3-5 bullets)
|
|
113
|
-
- Risks & unknowns
|
|
114
|
-
- Gợi ý: "Tiếp theo chạy `/dw
|
|
1
|
+
---
|
|
2
|
+
name: dw:research
|
|
3
|
+
description: "Khảo sát và phân tích codebase trước khi lập kế hoạch. Tìm patterns, dependencies, và ảnh hưởng của thay đổi. Dùng khi cần hiểu code trước khi implement."
|
|
4
|
+
argument-hint: "[task-name]"
|
|
5
|
+
context: fork
|
|
6
|
+
agent: researcher
|
|
7
|
+
allowed-tools:
|
|
8
|
+
- Read
|
|
9
|
+
- Grep
|
|
10
|
+
- Glob
|
|
11
|
+
- "Bash(git log *)"
|
|
12
|
+
- "Bash(git diff *)"
|
|
13
|
+
- "Bash(git show *)"
|
|
14
|
+
- "Bash(git blame *)"
|
|
15
|
+
- "Bash(ls *)"
|
|
16
|
+
- "Bash(wc *)"
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# Khảo Sát Codebase
|
|
20
|
+
|
|
21
|
+
Task: **$ARGUMENTS**
|
|
22
|
+
|
|
23
|
+
## Đọc Config
|
|
24
|
+
|
|
25
|
+
Đọc `.dw/config/dw.config.yml` → lấy `paths.tasks` để biết output location.
|
|
26
|
+
|
|
27
|
+
## Bước 1: Đọc yêu cầu
|
|
28
|
+
|
|
29
|
+
- Đọc file `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-plan.md` nếu đã có mô tả yêu cầu
|
|
30
|
+
- Hoặc lấy yêu cầu từ conversation context
|
|
31
|
+
|
|
32
|
+
## Bước 2: Khảo sát
|
|
33
|
+
|
|
34
|
+
Thực hiện các bước sau (không cần theo thứ tự cứng):
|
|
35
|
+
|
|
36
|
+
1. **Tìm files liên quan**: Dùng Glob + Grep để tìm files theo keywords từ yêu cầu
|
|
37
|
+
2. **Đọc code**: Đọc các files tìm được, hiểu logic hiện tại
|
|
38
|
+
3. **Trace data flow**: Theo dõi luồng dữ liệu từ input → processing → output
|
|
39
|
+
4. **Xác định dependencies**:
|
|
40
|
+
- Upstream: modules/APIs mà code hiện tại gọi đến
|
|
41
|
+
- Downstream: modules/APIs gọi đến code hiện tại
|
|
42
|
+
5. **Tìm patterns**: Conventions, design patterns đang dùng trong project
|
|
43
|
+
6. **Kiểm tra tests**: Đã có test coverage cho khu vực liên quan?
|
|
44
|
+
7. **Git history**: Xem lịch sử thay đổi gần đây của files liên quan
|
|
45
|
+
|
|
46
|
+
## Bước 3: Áp dụng tư duy phản biện
|
|
47
|
+
|
|
48
|
+
Từ framework `.claude/skills/dw-thinking/THINKING.md`:
|
|
49
|
+
- **Giả định**: Những gì đang giả định là đúng? Cần kiểm chứng?
|
|
50
|
+
- **Dependencies**: Module nào bị ảnh hưởng nếu thay đổi?
|
|
51
|
+
- **Edge cases**: Trường hợp biên nào cần xem xét?
|
|
52
|
+
- **Rủi ro**: Rủi ro kỹ thuật, bảo mật, performance?
|
|
53
|
+
|
|
54
|
+
## Bước 4: Ghi kết quả
|
|
55
|
+
|
|
56
|
+
Ghi vào `{paths.tasks}/$ARGUMENTS/$ARGUMENTS-context.md` theo cấu trúc:
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
# Context: [Task Name]
|
|
60
|
+
|
|
61
|
+
## Ngày khảo sát: [date]
|
|
62
|
+
|
|
63
|
+
## Yêu Cầu Gốc
|
|
64
|
+
[Copy yêu cầu]
|
|
65
|
+
|
|
66
|
+
## Files Liên Quan
|
|
67
|
+
| File | Vai trò | Cần thay đổi? | Ghi chú |
|
|
68
|
+
|------|---------|----------------|---------|
|
|
69
|
+
|
|
70
|
+
## Kiến Trúc Hiện Tại
|
|
71
|
+
[Mô tả luồng, diagram nếu cần]
|
|
72
|
+
|
|
73
|
+
## Dependencies
|
|
74
|
+
**Upstream**: ...
|
|
75
|
+
**Downstream**: ...
|
|
76
|
+
|
|
77
|
+
## Patterns & Conventions
|
|
78
|
+
- [Pattern]: [mô tả]
|
|
79
|
+
|
|
80
|
+
## Giả Định & Hạn Chế
|
|
81
|
+
- Giả định: ...
|
|
82
|
+
- Hạn chế: ...
|
|
83
|
+
- Chưa rõ: ...
|
|
84
|
+
|
|
85
|
+
## Test Coverage Hiện Tại
|
|
86
|
+
[Có test không? Coverage ở đâu?]
|
|
87
|
+
|
|
88
|
+
## Ghi Chú
|
|
89
|
+
[Bất kỳ thông tin bổ sung]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Bước 5: Tạo Report (optional — standard/thorough depth)
|
|
93
|
+
|
|
94
|
+
Nếu task có `.dw/tasks/$ARGUMENTS/reports/` directory (hoặc depth ≥ standard), tạo report:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
.dw/tasks/$ARGUMENTS/reports/[YYMMDD-HHMM]-from-researcher-to-planner-findings.md
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Dùng template `.claude/templates/agent-report.md` với:
|
|
101
|
+
- `status: DONE` (hoặc `DONE_WITH_CONCERNS` nếu có risks lớn)
|
|
102
|
+
- Summary: top 3 findings
|
|
103
|
+
- Details: key files, patterns, dependencies
|
|
104
|
+
- Next Steps: những gì planner cần biết
|
|
105
|
+
|
|
106
|
+
> Quick depth tasks: bỏ qua bước này — progress.md đã đủ.
|
|
107
|
+
|
|
108
|
+
## Bước 6: Tóm tắt
|
|
109
|
+
|
|
110
|
+
Khi hoàn thành, trả về tóm tắt:
|
|
111
|
+
- Số files khảo sát
|
|
112
|
+
- Key findings (3-5 bullets)
|
|
113
|
+
- Risks & unknowns
|
|
114
|
+
- Gợi ý: "Tiếp theo chạy `/dw:plan $ARGUMENTS`"
|