@wipal/agent-team 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/skills/discover.md +127 -0
- package/.claude/commands/skills/install.md +225 -0
- package/.claude/commands/skills/review.md +234 -0
- package/.claude/commands/utils/learn.md +142 -0
- package/.claude/commands/utils/retrospect.md +62 -0
- package/.claude/commands/utils/switch.md +113 -0
- package/.claude/commands/utils/sync.md +183 -0
- package/.claude/rules/common/general-rules.md +6 -0
- package/.claude/rules/role-rules/dev-be-rules.md +241 -0
- package/.claude/rules/role-rules/dev-fe-rules.md +76 -0
- package/.claude/skills/SKILL-INDEX.md +24 -5
- package/.claude/skills/core/knowledge-graph/SKILL.md +214 -0
- package/.claude/skills/core/sequential-thinking/SKILL.md +112 -0
- package/.claude/skills/core/sequential-thinking/references/advanced.md +122 -0
- package/.claude/skills/core/sequential-thinking/references/examples.md +274 -0
- package/.claude/skills/domain/architecture/c4-architecture/SKILL.md +314 -0
- package/.claude/skills/domain/architecture/c4-architecture/references/advanced-patterns.md +552 -0
- package/.claude/skills/domain/architecture/c4-architecture/references/c4-syntax.md +492 -0
- package/.claude/skills/domain/architecture/c4-architecture/references/common-mistakes.md +437 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/SKILL.md +238 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/references/advanced-features.md +556 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/references/architecture-diagrams.md +192 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/references/c4-diagrams.md +410 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/references/class-diagrams.md +361 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/references/erd-diagrams.md +510 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/references/flowcharts.md +450 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/references/sequence-diagrams.md +394 -0
- package/.claude/skills/domain/backend/testing-be/SKILL.md +121 -17
- package/.claude/skills/domain/design/design-system/SKILL.md +169 -0
- package/.claude/skills/domain/design/html-css-output/SKILL.md +253 -0
- package/.claude/skills/domain/design/mockup-creation/SKILL.md +230 -0
- package/.claude/skills/domain/design/responsive-design/SKILL.md +207 -0
- package/.claude/skills/domain/design/ui-design/SKILL.md +124 -0
- package/.claude/skills/domain/frontend/testing-fe/SKILL.md +143 -38
- package/.claude/skills/domain/frontend/ui-ux-pro-max/README.md +45 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/SKILL.md +404 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/charts.csv +26 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/colors.csv +97 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/icons.csv +101 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/landing.csv +31 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/products.csv +97 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/styles.csv +68 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/typography.csv +58 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/scripts/core.py +253 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/scripts/search.py +114 -0
- package/.claude/skills/domain/product/requirements-clarity/SKILL.md +340 -0
- package/.claude/skills/skills-registry.yaml +103 -8
- package/README.md +107 -33
- package/README.npm.md +252 -0
- package/TUTORIAL.md +256 -0
- package/bin/agent-team.js +26 -7
- package/config/roles.yaml +107 -0
- package/docs/01-architecture.md +699 -0
- package/docs/02-setup-guide.md +634 -0
- package/docs/03-skills-guide.md +628 -0
- package/docs/04-workflows.md +792 -0
- package/docs/05-model-strategy.md +550 -0
- package/docs/06-extend-guide.md +1226 -0
- package/docs/07-quick-reference.md +578 -0
- package/docs/08-skills-discovery.md +342 -0
- package/docs/README.md +134 -0
- package/docs/rqm.md +560 -0
- package/package.json +10 -4
- package/scripts/postinstall.js +46 -0
- package/src/commands/add.js +131 -67
- package/src/commands/init.js +419 -9
- package/src/commands/list.js +20 -16
- package/src/commands/projects.js +127 -0
- package/src/commands/setup-hooks.js +261 -0
- package/src/index.js +0 -1
- package/src/utils/file-utils.js +147 -50
- package/src/utils/global-registry.js +224 -0
- package/templates/CLAUDE.md.tmpl +128 -20
- package/templates/MEMORY.md.tmpl +119 -0
- package/templates/agent.md.tmpl +205 -0
- package/templates/code/nestjs-controller.ts.tmpl +49 -0
- package/templates/code/nestjs-dto.ts.tmpl +63 -0
- package/templates/code/nestjs-service.ts.tmpl +45 -0
- package/templates/code/react-component.tsx.tmpl +24 -0
- package/templates/code/react-hook.ts.tmpl +54 -0
- package/templates/code/test.spec.ts.tmpl +50 -0
- package/templates/code/vue-component.vue.tmpl +49 -0
- package/templates/code/vue-composable.ts.tmpl +54 -0
- package/templates/knowledge.md.tmpl +152 -17
- package/templates/meeting-notes.md.tmpl +110 -0
- package/templates/memory/hooks.memory.json +50 -0
- package/templates/memory/settings.memory.json +16 -0
- package/templates/reports/bug-report.md.tmpl +164 -0
- package/templates/reports/code-review.md.tmpl +201 -0
- package/templates/reports/sprint-report.md.tmpl +218 -0
- package/templates/roles/ba.md +53 -0
- package/templates/roles/designer.md +82 -0
- package/templates/roles/dev-be.md +49 -0
- package/templates/roles/dev-fe.md +49 -0
- package/templates/roles/devops.md +53 -0
- package/templates/roles/pm.md +49 -0
- package/templates/roles/qa.md +53 -0
- package/templates/roles/sa.md +49 -0
- package/templates/roles/tech-lead.md +132 -0
- package/templates/skills/memory/memory-status.md +78 -0
- package/templates/skills/memory/recall.md +160 -0
- package/templates/skills/memory/reflect.md +168 -0
- package/templates/skills/memory/remember.md +105 -0
- package/templates/tasks/lessons.md.tmpl +77 -0
- package/templates/tasks/todo.md.tmpl +53 -0
- package/src/commands/switch.js +0 -53
|
@@ -0,0 +1,792 @@
|
|
|
1
|
+
# Workflows Guide
|
|
2
|
+
|
|
3
|
+
> **Phiên bản:** 1.0
|
|
4
|
+
> **Cập nhật:** 2025-02-25
|
|
5
|
+
> **Related:** [Architecture](01-architecture.md) | [Setup Guide](02-setup-guide.md) | [Skills Guide](03-skills-guide.md)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 📋 Mục Lục
|
|
10
|
+
|
|
11
|
+
1. [Workflow Orchestration](#-workflow-orchestration)
|
|
12
|
+
2. [Task Management Process](#-task-management-process)
|
|
13
|
+
3. [Feature Development Workflow](#-feature-development-workflow)
|
|
14
|
+
4. [Bug Fix Workflow](#-bug-fix-workflow)
|
|
15
|
+
5. [Review Project Workflow](#-review-project-workflow)
|
|
16
|
+
6. [Learn Workflow](#-learn-workflow)
|
|
17
|
+
7. [Self-Improvement Loop](#-self-improvement-loop)
|
|
18
|
+
8. [Daily Workflows](#-daily-workflows)
|
|
19
|
+
9. [Code Review Workflow](#-code-review-workflow)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 🎯 Workflow Orchestration
|
|
24
|
+
|
|
25
|
+
### Core Principles (From Boris Cherny - Anthropic Engineer)
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
29
|
+
│ WORKFLOW ORCHESTRATION PRINCIPLES │
|
|
30
|
+
├─────────────────────────────────────────────────────────────────────────────┤
|
|
31
|
+
│ │
|
|
32
|
+
│ 1. PLAN MODE DEFAULT │
|
|
33
|
+
│ ├── Enter plan mode for ANY non-trivial task (3+ steps) │
|
|
34
|
+
│ ├── If something goes sideways → STOP and re-plan immediately │
|
|
35
|
+
│ ├── Use plan mode for verification steps, not just building │
|
|
36
|
+
│ └── Write detailed specs upfront to reduce ambiguity │
|
|
37
|
+
│ │
|
|
38
|
+
│ 2. SUBAGENT STRATEGY │
|
|
39
|
+
│ ├── Use subagents liberally to keep main context clean │
|
|
40
|
+
│ ├── Offload research, exploration, parallel analysis to subagents │
|
|
41
|
+
│ ├── For complex problems → throw more compute via subagents │
|
|
42
|
+
│ └── One task per subagent for focused execution │
|
|
43
|
+
│ │
|
|
44
|
+
│ 3. SELF-IMPROVEMENT LOOP │
|
|
45
|
+
│ ├── After ANY correction → update lessons.md with the pattern │
|
|
46
|
+
│ ├── Write rules that prevent the same mistake │
|
|
47
|
+
│ ├── Ruthlessly iterate until mistake rate drops │
|
|
48
|
+
│ └── Review lessons at session start │
|
|
49
|
+
│ │
|
|
50
|
+
│ 4. VERIFICATION BEFORE DONE │
|
|
51
|
+
│ ├── Never mark task complete without proving it works │
|
|
52
|
+
│ ├── Diff behavior between main and your changes │
|
|
53
|
+
│ ├── Ask: "Would a staff engineer approve this?" │
|
|
54
|
+
│ └── Run tests, check logs, demonstrate correctness │
|
|
55
|
+
│ │
|
|
56
|
+
│ 5. AUTONOMOUS BUG FIXING │
|
|
57
|
+
│ ├── When given a bug report → just fix it │
|
|
58
|
+
│ ├── Point at logs, errors, failing tests – then resolve them │
|
|
59
|
+
│ ├── Zero context switching required from user │
|
|
60
|
+
│ └── Go fix failing CI tests without being told how │
|
|
61
|
+
│ │
|
|
62
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Workflow Decision Tree
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
TASK RECEIVED?
|
|
69
|
+
│
|
|
70
|
+
├─ Is it trivial (1-2 steps)?
|
|
71
|
+
│ └─ YES → Execute directly
|
|
72
|
+
│
|
|
73
|
+
├─ Is it non-trivial (3+ steps)?
|
|
74
|
+
│ └─ YES → Enter Plan Mode
|
|
75
|
+
│ │
|
|
76
|
+
│ ├─ Write plan to tasks/todo.md
|
|
77
|
+
│ ├─ Get user confirmation
|
|
78
|
+
│ └─ Execute with progress tracking
|
|
79
|
+
│
|
|
80
|
+
├─ Something goes sideways?
|
|
81
|
+
│ └─ YES → STOP and re-plan
|
|
82
|
+
│
|
|
83
|
+
└─ Task complete?
|
|
84
|
+
└─ Verify → Update lessons → Mark done
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 📋 Task Management Process
|
|
90
|
+
|
|
91
|
+
### Standard Task Flow
|
|
92
|
+
|
|
93
|
+
```yaml
|
|
94
|
+
task_management:
|
|
95
|
+
steps:
|
|
96
|
+
- name: "Plan First"
|
|
97
|
+
action: "Write plan to tasks/todo.md with checkable items"
|
|
98
|
+
|
|
99
|
+
- name: "Verify Plan"
|
|
100
|
+
action: "Check in with user before starting implementation"
|
|
101
|
+
|
|
102
|
+
- name: "Track Progress"
|
|
103
|
+
action: "Mark items complete as you go"
|
|
104
|
+
|
|
105
|
+
- name: "Explain Changes"
|
|
106
|
+
action: "High-level summary at each step"
|
|
107
|
+
|
|
108
|
+
- name: "Document Results"
|
|
109
|
+
action: "Add review section to tasks/todo.md"
|
|
110
|
+
|
|
111
|
+
- name: "Capture Lessons"
|
|
112
|
+
action: "Update lessons.md after corrections"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### tasks/todo.md Format
|
|
116
|
+
|
|
117
|
+
```markdown
|
|
118
|
+
# Task: [Task Name]
|
|
119
|
+
|
|
120
|
+
## Status: [ ] Planning | [ ] In Progress | [ ] Review | [ ] Done
|
|
121
|
+
|
|
122
|
+
## Plan
|
|
123
|
+
- [ ] Step 1: Description
|
|
124
|
+
- [ ] Step 2: Description
|
|
125
|
+
- [ ] Step 3: Description
|
|
126
|
+
- [ ] Step 4: Description
|
|
127
|
+
|
|
128
|
+
## Progress Log
|
|
129
|
+
- [2025-02-25 10:00] Started planning
|
|
130
|
+
- [2025-02-25 10:15] Plan approved, starting implementation
|
|
131
|
+
- [2025-02-25 10:30] Completed Step 1
|
|
132
|
+
- [2025-02-25 10:45] Completed Step 2
|
|
133
|
+
|
|
134
|
+
## Review
|
|
135
|
+
### What was done
|
|
136
|
+
- Summary of changes
|
|
137
|
+
|
|
138
|
+
### Files modified
|
|
139
|
+
- file1.ts - Description
|
|
140
|
+
- file2.ts - Description
|
|
141
|
+
|
|
142
|
+
### Tests run
|
|
143
|
+
- [x] Unit tests passed
|
|
144
|
+
- [x] Integration tests passed
|
|
145
|
+
|
|
146
|
+
### Lessons learned
|
|
147
|
+
- Pattern discovered
|
|
148
|
+
- Pitfall avoided
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 🚀 Feature Development Workflow
|
|
154
|
+
|
|
155
|
+
### Workflow Definition
|
|
156
|
+
|
|
157
|
+
```yaml
|
|
158
|
+
name: Feature Development
|
|
159
|
+
description: Quy trình phát triển tính năng mới
|
|
160
|
+
trigger: Manual hoặc khi nhận task mới
|
|
161
|
+
|
|
162
|
+
phases:
|
|
163
|
+
- name: Planning
|
|
164
|
+
role: tech-lead
|
|
165
|
+
steps:
|
|
166
|
+
- Analyze requirements
|
|
167
|
+
- Design architecture
|
|
168
|
+
- Create task breakdown
|
|
169
|
+
- Write to tasks/todo.md
|
|
170
|
+
output: tasks/todo.md
|
|
171
|
+
|
|
172
|
+
- name: Design
|
|
173
|
+
roles: [designer, tech-lead]
|
|
174
|
+
parallel: true
|
|
175
|
+
steps:
|
|
176
|
+
- designer: Create UI mockups
|
|
177
|
+
- tech-lead: Design API & database
|
|
178
|
+
output: design.md, api-spec.md
|
|
179
|
+
|
|
180
|
+
- name: Implementation
|
|
181
|
+
roles: [dev-fe, dev-be]
|
|
182
|
+
parallel: true
|
|
183
|
+
steps:
|
|
184
|
+
- dev-be: Implement API
|
|
185
|
+
- dev-fe: Implement UI
|
|
186
|
+
skills: [frontend-design, api-design]
|
|
187
|
+
|
|
188
|
+
- name: Testing
|
|
189
|
+
role: qa
|
|
190
|
+
steps:
|
|
191
|
+
- Write test cases
|
|
192
|
+
- Execute tests
|
|
193
|
+
- Report bugs
|
|
194
|
+
skills: [test-planning, webapp-testing]
|
|
195
|
+
|
|
196
|
+
- name: Review
|
|
197
|
+
role: tech-lead
|
|
198
|
+
steps:
|
|
199
|
+
- Code review
|
|
200
|
+
- Architecture review
|
|
201
|
+
- Approve/Request changes
|
|
202
|
+
skills: [code-review]
|
|
203
|
+
|
|
204
|
+
- name: Deploy
|
|
205
|
+
role: devops
|
|
206
|
+
steps:
|
|
207
|
+
- CI/CD pipeline
|
|
208
|
+
- Deploy to staging
|
|
209
|
+
- Production deployment
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Feature Development Steps
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# ============================================
|
|
216
|
+
# BƯỚC 1: SETUP & PLANNING
|
|
217
|
+
# ============================================
|
|
218
|
+
|
|
219
|
+
# Switch to tech-lead for planning
|
|
220
|
+
./agent.sh switch lead
|
|
221
|
+
|
|
222
|
+
# Create feature branch
|
|
223
|
+
git checkout -b feature/payment-integration
|
|
224
|
+
|
|
225
|
+
# Plan the feature
|
|
226
|
+
# Agent sẽ:
|
|
227
|
+
# 1. Analyze requirements
|
|
228
|
+
# 2. Design architecture
|
|
229
|
+
# 3. Create tasks/todo.md
|
|
230
|
+
|
|
231
|
+
# ============================================
|
|
232
|
+
# BƯỚC 2: IMPLEMENTATION
|
|
233
|
+
# ============================================
|
|
234
|
+
|
|
235
|
+
# Switch to BE for API
|
|
236
|
+
./agent.sh switch auth-be
|
|
237
|
+
# Implement API endpoints...
|
|
238
|
+
|
|
239
|
+
# Switch to FE for UI
|
|
240
|
+
./agent.sh switch payment-fe
|
|
241
|
+
# Implement UI components...
|
|
242
|
+
|
|
243
|
+
# ============================================
|
|
244
|
+
# BƯỚC 3: TESTING
|
|
245
|
+
# ============================================
|
|
246
|
+
|
|
247
|
+
# Switch to QA
|
|
248
|
+
./agent.sh switch tester
|
|
249
|
+
# Write and run tests...
|
|
250
|
+
|
|
251
|
+
# ============================================
|
|
252
|
+
# BƯỚC 4: REVIEW & LEARN
|
|
253
|
+
# ============================================
|
|
254
|
+
|
|
255
|
+
# Review code
|
|
256
|
+
./agent.sh switch lead
|
|
257
|
+
# Review PR...
|
|
258
|
+
|
|
259
|
+
# Learn from this feature
|
|
260
|
+
/retrospect-work
|
|
261
|
+
# Extract patterns, update knowledge
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## 🐛 Bug Fix Workflow
|
|
267
|
+
|
|
268
|
+
### Workflow Definition
|
|
269
|
+
|
|
270
|
+
```yaml
|
|
271
|
+
name: Bug Fix
|
|
272
|
+
description: Quy trình sửa lỗi
|
|
273
|
+
trigger: Bug report hoặc failing tests
|
|
274
|
+
|
|
275
|
+
phases:
|
|
276
|
+
- name: Triage
|
|
277
|
+
roles: [qa, pm]
|
|
278
|
+
steps:
|
|
279
|
+
- Verify bug exists
|
|
280
|
+
- Assess severity
|
|
281
|
+
- Assign priority
|
|
282
|
+
- Assign to developer
|
|
283
|
+
|
|
284
|
+
- name: Investigation
|
|
285
|
+
role: tech-lead
|
|
286
|
+
steps:
|
|
287
|
+
- Analyze root cause
|
|
288
|
+
- Identify affected components
|
|
289
|
+
- Document findings
|
|
290
|
+
skills: [systematic-debugging, root-cause-tracing]
|
|
291
|
+
|
|
292
|
+
- name: Fix
|
|
293
|
+
roles: [dev-fe, dev-be]
|
|
294
|
+
steps:
|
|
295
|
+
- Implement fix
|
|
296
|
+
- Write unit tests
|
|
297
|
+
- Verify fix locally
|
|
298
|
+
|
|
299
|
+
- name: Verification
|
|
300
|
+
role: qa
|
|
301
|
+
steps:
|
|
302
|
+
- Verify fix
|
|
303
|
+
- Regression testing
|
|
304
|
+
- Sign off
|
|
305
|
+
|
|
306
|
+
- name: Deploy
|
|
307
|
+
role: devops
|
|
308
|
+
steps:
|
|
309
|
+
- Deploy hotfix
|
|
310
|
+
- Monitor for issues
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Bug Fix Steps (Autonomous)
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
# ============================================
|
|
317
|
+
# BUG FIX - AUTONOMOUS MODE
|
|
318
|
+
# ============================================
|
|
319
|
+
|
|
320
|
+
# Agent tự động:
|
|
321
|
+
# 1. Đọc bug report
|
|
322
|
+
# 2. Tìm root cause (logs, tests)
|
|
323
|
+
# 3. Implement fix
|
|
324
|
+
# 4. Verify fix
|
|
325
|
+
# 5. Update lessons.md
|
|
326
|
+
|
|
327
|
+
# User chỉ cần:
|
|
328
|
+
./agent.sh switch payment-fe
|
|
329
|
+
> "Fix bug: Payment form doesn't validate card number"
|
|
330
|
+
|
|
331
|
+
# Agent sẽ:
|
|
332
|
+
# ✅ Identified root cause: Missing validation in CardInput component
|
|
333
|
+
# ✅ Implemented fix: Added Zod schema validation
|
|
334
|
+
# ✅ Added unit test for validation
|
|
335
|
+
# ✅ Verified fix locally
|
|
336
|
+
# ✅ Updated lessons.md with pattern
|
|
337
|
+
#
|
|
338
|
+
# Ready for review. Create PR? [y/n]:
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Systematic Debugging Process
|
|
342
|
+
|
|
343
|
+
```markdown
|
|
344
|
+
## Debugging Protocol (From ClaudeKit)
|
|
345
|
+
|
|
346
|
+
### Phase 1: Stabilize
|
|
347
|
+
- Identify the failure mode
|
|
348
|
+
- Gather error messages, logs, stack traces
|
|
349
|
+
- Create minimal reproduction
|
|
350
|
+
|
|
351
|
+
### Phase 2: Isolate
|
|
352
|
+
- Binary search to find problematic code
|
|
353
|
+
- Check recent changes (git diff)
|
|
354
|
+
- Identify the exact component/function
|
|
355
|
+
|
|
356
|
+
### Phase 3: Fix
|
|
357
|
+
- Understand WHY it's failing
|
|
358
|
+
- Implement minimal fix
|
|
359
|
+
- Add tests to prevent regression
|
|
360
|
+
|
|
361
|
+
### Phase 4: Verify
|
|
362
|
+
- Run full test suite
|
|
363
|
+
- Check related functionality
|
|
364
|
+
- Monitor in production
|
|
365
|
+
|
|
366
|
+
## Verification Before Completion
|
|
367
|
+
|
|
368
|
+
RED FLAGS - STOP if:
|
|
369
|
+
- Using "should"/"probably"/"seems to"
|
|
370
|
+
- Expressing satisfaction before verification
|
|
371
|
+
- Committing without verification
|
|
372
|
+
|
|
373
|
+
REQUIRED:
|
|
374
|
+
1. IDENTIFY command to verify
|
|
375
|
+
2. RUN full command (not partial)
|
|
376
|
+
3. READ actual output
|
|
377
|
+
4. VERIFY output confirms claim
|
|
378
|
+
5. THEN make claim
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## 🔍 Review Project Workflow
|
|
384
|
+
|
|
385
|
+
### Usage
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
# Review toàn bộ project
|
|
389
|
+
./agent.sh review
|
|
390
|
+
|
|
391
|
+
# Review specific agent's area
|
|
392
|
+
./agent.sh review payment-fe
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### Review Output
|
|
396
|
+
|
|
397
|
+
```
|
|
398
|
+
═══════════════════════════════════════════════════════════════
|
|
399
|
+
🔍 PROJECT REVIEW - ecommerce-api
|
|
400
|
+
═══════════════════════════════════════════════════════════════
|
|
401
|
+
|
|
402
|
+
📁 Project Structure Analysis:
|
|
403
|
+
├── src/
|
|
404
|
+
│ ├── modules/ (NestJS modules)
|
|
405
|
+
│ ├── common/ (Shared utilities)
|
|
406
|
+
│ └── config/ (Configuration)
|
|
407
|
+
|
|
408
|
+
🛠️ Detected Tech Stack:
|
|
409
|
+
├── Framework: NestJS (detected from nest-cli.json)
|
|
410
|
+
├── Database: PostgreSQL (detected from docker-compose)
|
|
411
|
+
├── ORM: Prisma (detected from prisma/schema.prisma)
|
|
412
|
+
├── Testing: Jest (detected from jest.config.js)
|
|
413
|
+
├── Validation: Zod (detected from imports)
|
|
414
|
+
└── Auth: JWT (detected from auth module)
|
|
415
|
+
|
|
416
|
+
📊 Code Quality:
|
|
417
|
+
├── Test coverage: 72% ✅
|
|
418
|
+
├── Linting: 0 errors ✅
|
|
419
|
+
├── TypeScript: 3 warnings ⚠️
|
|
420
|
+
└── Security: 1 issue 🔴 (see details)
|
|
421
|
+
|
|
422
|
+
🎯 Suggestions:
|
|
423
|
+
1. Add rate limiting to auth endpoints
|
|
424
|
+
2. Consider using Redis for caching
|
|
425
|
+
3. Add API versioning
|
|
426
|
+
|
|
427
|
+
💡 Recommended Agent Config:
|
|
428
|
+
./agent.sh setup main-api dev-be \
|
|
429
|
+
--framework nestjs \
|
|
430
|
+
--database postgresql \
|
|
431
|
+
--orm prisma \
|
|
432
|
+
--testing jest \
|
|
433
|
+
--validation zod
|
|
434
|
+
|
|
435
|
+
Apply recommended config? [y/n]:
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### Review Workflow Definition
|
|
439
|
+
|
|
440
|
+
```yaml
|
|
441
|
+
name: Project Review
|
|
442
|
+
description: Phân tích project và đề xuất cấu hình
|
|
443
|
+
trigger: Manual hoặc khi join project mới
|
|
444
|
+
|
|
445
|
+
steps:
|
|
446
|
+
- name: "Analyze Structure"
|
|
447
|
+
action: "Scan project files"
|
|
448
|
+
output: "structure-report.md"
|
|
449
|
+
|
|
450
|
+
- name: "Detect Tech Stack"
|
|
451
|
+
action: "Identify frameworks, tools"
|
|
452
|
+
output: "tech-stack.md"
|
|
453
|
+
|
|
454
|
+
- name: "Code Quality Check"
|
|
455
|
+
action: "Run linters, test coverage"
|
|
456
|
+
output: "quality-report.md"
|
|
457
|
+
|
|
458
|
+
- name: "Generate Suggestions"
|
|
459
|
+
action: "Recommend improvements"
|
|
460
|
+
output: "suggestions.md"
|
|
461
|
+
|
|
462
|
+
- name: "Create Agent Config"
|
|
463
|
+
action: "Generate agent.sh setup command"
|
|
464
|
+
output: "recommended-config.yaml"
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
## 🧠 Learn Workflow
|
|
470
|
+
|
|
471
|
+
### Usage
|
|
472
|
+
|
|
473
|
+
```bash
|
|
474
|
+
# Phân tích và học từ project hiện tại
|
|
475
|
+
./agent.sh learn
|
|
476
|
+
|
|
477
|
+
# Hoặc sau khi hoàn thành feature
|
|
478
|
+
/retrospect-work
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
### Learn Output
|
|
482
|
+
|
|
483
|
+
```
|
|
484
|
+
═══════════════════════════════════════════════════════════════
|
|
485
|
+
🧠 LEARNING FROM PROJECT - ecommerce-api
|
|
486
|
+
═══════════════════════════════════════════════════════════════
|
|
487
|
+
|
|
488
|
+
📖 Analyzing code patterns...
|
|
489
|
+
|
|
490
|
+
✅ Found Patterns:
|
|
491
|
+
├── Repository Pattern (used in 5 modules)
|
|
492
|
+
├── DTO Validation (using class-validator + zod)
|
|
493
|
+
├── Error Handling (custom exception filters)
|
|
494
|
+
├── Logging (winston with custom format)
|
|
495
|
+
└── Caching (redis with decorator pattern)
|
|
496
|
+
|
|
497
|
+
⚠️ Found Anti-patterns:
|
|
498
|
+
├── God Class (UserModule has 500+ lines)
|
|
499
|
+
├── N+1 Query (in OrderService.getOrders)
|
|
500
|
+
└── Hardcoded Values (API keys in config)
|
|
501
|
+
|
|
502
|
+
📝 Extracted Knowledge:
|
|
503
|
+
|
|
504
|
+
## Pattern: Repository with Prisma
|
|
505
|
+
```typescript
|
|
506
|
+
// Pattern found in 5 modules
|
|
507
|
+
@Injectable()
|
|
508
|
+
export class UserRepository {
|
|
509
|
+
constructor(private prisma: PrismaService) {}
|
|
510
|
+
|
|
511
|
+
async findById(id: string) {
|
|
512
|
+
return this.prisma.user.findUnique({ where: { id } });
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
## Anti-pattern: N+1 Query
|
|
518
|
+
```typescript
|
|
519
|
+
// Found in OrderService.getOrders
|
|
520
|
+
// BAD: Query in loop
|
|
521
|
+
for (const order of orders) {
|
|
522
|
+
order.items = await this.getItems(order.id);
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// GOOD: Use include
|
|
526
|
+
const orders = await this.prisma.order.findMany({
|
|
527
|
+
include: { items: true }
|
|
528
|
+
});
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
📁 Updating Knowledge Base:
|
|
532
|
+
✅ Added to: .claude/agents/main-api/knowledge.md
|
|
533
|
+
- Pattern: Repository with Prisma
|
|
534
|
+
- Anti-pattern: N+1 Query
|
|
535
|
+
- Pitfall: Hardcoded API keys
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
### Learn Workflow Definition
|
|
539
|
+
|
|
540
|
+
```yaml
|
|
541
|
+
name: Learn
|
|
542
|
+
description: Phân tích và extract knowledge từ project/session
|
|
543
|
+
trigger: Manual hoặc sau khi hoàn thành feature
|
|
544
|
+
|
|
545
|
+
steps:
|
|
546
|
+
- name: "Analyze Code"
|
|
547
|
+
action: "Scan for patterns"
|
|
548
|
+
skills: [pattern-detection]
|
|
549
|
+
|
|
550
|
+
- name: "Find Anti-patterns"
|
|
551
|
+
action: "Identify code smells"
|
|
552
|
+
output: "anti-patterns.md"
|
|
553
|
+
|
|
554
|
+
- name: "Extract Learnings"
|
|
555
|
+
action: "Create knowledge entries"
|
|
556
|
+
output: "learnings.md"
|
|
557
|
+
|
|
558
|
+
- name: "Update Knowledge Base"
|
|
559
|
+
action: "Add to knowledge.md"
|
|
560
|
+
script: "./agent.sh learn --update"
|
|
561
|
+
|
|
562
|
+
- name: "Share Knowledge"
|
|
563
|
+
action: "Sync to related agents"
|
|
564
|
+
script: "./agent.sh sync --to-role dev-be"
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
---
|
|
568
|
+
|
|
569
|
+
## 🔄 Self-Improvement Loop
|
|
570
|
+
|
|
571
|
+
### Loop Structure
|
|
572
|
+
|
|
573
|
+
```
|
|
574
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
575
|
+
│ SELF-IMPROVEMENT LOOP │
|
|
576
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
577
|
+
│ │
|
|
578
|
+
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
|
|
579
|
+
│ │ WORK │ │ CAPTURE │ │ PROCESS │ │ UPDATE │ │
|
|
580
|
+
│ │ SESSION │───▶│ LEARNING │───▶│ & ANALYZE│───▶│KNOWLEDGE │ │
|
|
581
|
+
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
|
|
582
|
+
│ │ │ │
|
|
583
|
+
│ │ ┌──────────┐ │ │
|
|
584
|
+
│ └──────────────│ FEEDBACK │◀────────────────────┘ │
|
|
585
|
+
│ │ LOOP │ │
|
|
586
|
+
│ └──────────┘ │
|
|
587
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
### Self-Improvement Rules
|
|
591
|
+
|
|
592
|
+
```markdown
|
|
593
|
+
## Self-Improvement Protocol
|
|
594
|
+
|
|
595
|
+
### After ANY correction from user:
|
|
596
|
+
1. Update `lessons.md` with the pattern
|
|
597
|
+
2. Write rules that prevent the same mistake
|
|
598
|
+
3. Ruthlessly iterate until mistake rate drops
|
|
599
|
+
|
|
600
|
+
### At session start:
|
|
601
|
+
1. Review lessons.md for relevant project
|
|
602
|
+
2. Check knowledge.md for patterns
|
|
603
|
+
3. Load relevant skills
|
|
604
|
+
|
|
605
|
+
### After task completion:
|
|
606
|
+
1. Run /retrospect-work
|
|
607
|
+
2. Extract patterns used
|
|
608
|
+
3. Update knowledge base
|
|
609
|
+
4. Share to related agents
|
|
610
|
+
|
|
611
|
+
### Pattern Promotion:
|
|
612
|
+
- Low confidence + 3 successful uses → Medium confidence
|
|
613
|
+
- Medium confidence + 5 successful uses → High confidence
|
|
614
|
+
- High confidence + 10 successful uses → Best Practice
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
### Instinct-Based Learning
|
|
618
|
+
|
|
619
|
+
```yaml
|
|
620
|
+
# Instincts are learned behaviors with confidence scores
|
|
621
|
+
# They evolve into skills over time
|
|
622
|
+
|
|
623
|
+
instinct_system:
|
|
624
|
+
commands:
|
|
625
|
+
- /instinct-status # Show learned instincts
|
|
626
|
+
- /instinct-import <file> # Import from others
|
|
627
|
+
- /instinct-export # Export for sharing
|
|
628
|
+
- /evolve # Cluster instincts into skills
|
|
629
|
+
|
|
630
|
+
evolution_path:
|
|
631
|
+
- stage: "Instinct"
|
|
632
|
+
condition: "confidence < 0.7"
|
|
633
|
+
description: "Individual learned behavior"
|
|
634
|
+
|
|
635
|
+
- stage: "Pattern"
|
|
636
|
+
condition: "confidence 0.7-0.9"
|
|
637
|
+
description: "Reusable pattern"
|
|
638
|
+
|
|
639
|
+
- stage: "Skill"
|
|
640
|
+
condition: "confidence > 0.9"
|
|
641
|
+
description: "Codified into SKILL.md"
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
---
|
|
645
|
+
|
|
646
|
+
## 📅 Daily Workflows
|
|
647
|
+
|
|
648
|
+
### Morning Start
|
|
649
|
+
|
|
650
|
+
```bash
|
|
651
|
+
# 1. Switch to PM/Tech Lead
|
|
652
|
+
./agent.sh switch lead
|
|
653
|
+
|
|
654
|
+
# 2. Check project status
|
|
655
|
+
./agent.sh review
|
|
656
|
+
|
|
657
|
+
# 3. Get today's tasks
|
|
658
|
+
# Query Jira/GitHub for tasks
|
|
659
|
+
|
|
660
|
+
# 4. Switch to working agent
|
|
661
|
+
./agent.sh switch payment-fe
|
|
662
|
+
|
|
663
|
+
# 5. Start work
|
|
664
|
+
# Agent loads relevant skills and knowledge
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
### End of Day
|
|
668
|
+
|
|
669
|
+
```bash
|
|
670
|
+
# 1. Run self-learning
|
|
671
|
+
/retrospect-work
|
|
672
|
+
|
|
673
|
+
# 2. Review learnings
|
|
674
|
+
# Check proposed updates to knowledge.md
|
|
675
|
+
|
|
676
|
+
# 3. Sync to related agents
|
|
677
|
+
./agent.sh sync payment-fe --to-role dev-fe
|
|
678
|
+
|
|
679
|
+
# 4. Create WIP commit if needed
|
|
680
|
+
/git-commit --wip
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
### Weekly Retrospective
|
|
684
|
+
|
|
685
|
+
```bash
|
|
686
|
+
# Run comprehensive learning
|
|
687
|
+
./agent.sh learn --deep
|
|
688
|
+
|
|
689
|
+
# Review knowledge base health
|
|
690
|
+
/knowledge-review --stats
|
|
691
|
+
|
|
692
|
+
# Update skills based on learnings
|
|
693
|
+
/knowledge-upgrade skills
|
|
694
|
+
|
|
695
|
+
# Share across all agents
|
|
696
|
+
/sync-all
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
---
|
|
700
|
+
|
|
701
|
+
## 👀 Code Review Workflow
|
|
702
|
+
|
|
703
|
+
### Review Protocol (From ClaudeKit)
|
|
704
|
+
|
|
705
|
+
```markdown
|
|
706
|
+
## Code Review Principles
|
|
707
|
+
|
|
708
|
+
### Core Principle
|
|
709
|
+
Technical correctness over social comfort.
|
|
710
|
+
|
|
711
|
+
❌ NO performative agreement:
|
|
712
|
+
- "You're absolutely right!"
|
|
713
|
+
- "Great point!"
|
|
714
|
+
|
|
715
|
+
✅ DO:
|
|
716
|
+
- Restate requirement
|
|
717
|
+
- Ask questions
|
|
718
|
+
- Push back with technical reasoning
|
|
719
|
+
- If unclear: STOP and ask for clarification first
|
|
720
|
+
|
|
721
|
+
### Three Practices
|
|
722
|
+
|
|
723
|
+
1. **Receiving Feedback**
|
|
724
|
+
- Technical evaluation over performative agreement
|
|
725
|
+
- Understand → Verify → Implement
|
|
726
|
+
|
|
727
|
+
2. **Requesting Reviews**
|
|
728
|
+
- Systematic review via code-reviewer subagent
|
|
729
|
+
- Clear description of changes
|
|
730
|
+
- Link to requirements
|
|
731
|
+
|
|
732
|
+
3. **Verification Gates**
|
|
733
|
+
- Evidence before any completion claims
|
|
734
|
+
- No "should"/"probably"/"seems to"
|
|
735
|
+
|
|
736
|
+
### Review Checklist
|
|
737
|
+
|
|
738
|
+
- [ ] Does it meet requirements?
|
|
739
|
+
- [ ] Are there tests?
|
|
740
|
+
- [ ] Is it performant?
|
|
741
|
+
- [ ] Is it secure?
|
|
742
|
+
- [ ] Is it maintainable?
|
|
743
|
+
- [ ] Are there any code smells?
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
### Review Steps
|
|
747
|
+
|
|
748
|
+
```bash
|
|
749
|
+
# 1. Switch to tech-lead
|
|
750
|
+
./agent.sh switch lead
|
|
751
|
+
|
|
752
|
+
# 2. Review PR
|
|
753
|
+
/review-pr 42
|
|
754
|
+
|
|
755
|
+
# Output:
|
|
756
|
+
# ═══════════════════════════════════════════════════════════════
|
|
757
|
+
# 🔍 CODE REVIEW - PR #42: Add payment form
|
|
758
|
+
# ═══════════════════════════════════════════════════════════════
|
|
759
|
+
#
|
|
760
|
+
# 📁 Files changed: 5
|
|
761
|
+
# ➕ Additions: 234
|
|
762
|
+
# ➖ Deletions: 12
|
|
763
|
+
#
|
|
764
|
+
# ✅ Strengths:
|
|
765
|
+
# - Good component structure
|
|
766
|
+
# - Proper TypeScript types
|
|
767
|
+
# - Tests included
|
|
768
|
+
#
|
|
769
|
+
# ⚠️ Suggestions:
|
|
770
|
+
# - Consider extracting validation to separate file
|
|
771
|
+
# - Add error boundary
|
|
772
|
+
# - Missing loading state
|
|
773
|
+
#
|
|
774
|
+
# 🔴 Issues:
|
|
775
|
+
# - Potential XSS in user input (line 45)
|
|
776
|
+
#
|
|
777
|
+
# 💡 Recommendation: Request changes
|
|
778
|
+
|
|
779
|
+
# 3. Submit review
|
|
780
|
+
/review-pr 42 --request-changes --comment "See feedback above"
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
---
|
|
784
|
+
|
|
785
|
+
## 📚 Related Documentation
|
|
786
|
+
|
|
787
|
+
- [Architecture](01-architecture.md) - System architecture
|
|
788
|
+
- [Setup Guide](02-setup-guide.md) - Setup instructions
|
|
789
|
+
- [Skills Guide](03-skills-guide.md) - Managing skills
|
|
790
|
+
- [Model Strategy](05-model-strategy.md) - Model selection
|
|
791
|
+
- [Extend Guide](06-extend-guide.md) - Creating workflows
|
|
792
|
+
- [Quick Reference](07-quick-reference.md) - Cheat sheet
|