@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.
Files changed (124) hide show
  1. package/.claude/commands/skills/discover.md +127 -0
  2. package/.claude/commands/skills/install.md +225 -0
  3. package/.claude/commands/skills/review.md +234 -0
  4. package/.claude/commands/utils/learn.md +142 -0
  5. package/.claude/commands/utils/retrospect.md +62 -0
  6. package/.claude/commands/utils/switch.md +113 -0
  7. package/.claude/commands/utils/sync.md +183 -0
  8. package/.claude/rules/common/general-rules.md +6 -0
  9. package/.claude/rules/role-rules/dev-be-rules.md +241 -0
  10. package/.claude/rules/role-rules/dev-fe-rules.md +76 -0
  11. package/.claude/skills/SKILL-INDEX.md +24 -5
  12. package/.claude/skills/core/knowledge-graph/SKILL.md +214 -0
  13. package/.claude/skills/core/sequential-thinking/SKILL.md +112 -0
  14. package/.claude/skills/core/sequential-thinking/references/advanced.md +122 -0
  15. package/.claude/skills/core/sequential-thinking/references/examples.md +274 -0
  16. package/.claude/skills/domain/architecture/c4-architecture/SKILL.md +314 -0
  17. package/.claude/skills/domain/architecture/c4-architecture/references/advanced-patterns.md +552 -0
  18. package/.claude/skills/domain/architecture/c4-architecture/references/c4-syntax.md +492 -0
  19. package/.claude/skills/domain/architecture/c4-architecture/references/common-mistakes.md +437 -0
  20. package/.claude/skills/domain/architecture/mermaid-diagrams/SKILL.md +238 -0
  21. package/.claude/skills/domain/architecture/mermaid-diagrams/references/advanced-features.md +556 -0
  22. package/.claude/skills/domain/architecture/mermaid-diagrams/references/architecture-diagrams.md +192 -0
  23. package/.claude/skills/domain/architecture/mermaid-diagrams/references/c4-diagrams.md +410 -0
  24. package/.claude/skills/domain/architecture/mermaid-diagrams/references/class-diagrams.md +361 -0
  25. package/.claude/skills/domain/architecture/mermaid-diagrams/references/erd-diagrams.md +510 -0
  26. package/.claude/skills/domain/architecture/mermaid-diagrams/references/flowcharts.md +450 -0
  27. package/.claude/skills/domain/architecture/mermaid-diagrams/references/sequence-diagrams.md +394 -0
  28. package/.claude/skills/domain/backend/testing-be/SKILL.md +121 -17
  29. package/.claude/skills/domain/design/design-system/SKILL.md +169 -0
  30. package/.claude/skills/domain/design/html-css-output/SKILL.md +253 -0
  31. package/.claude/skills/domain/design/mockup-creation/SKILL.md +230 -0
  32. package/.claude/skills/domain/design/responsive-design/SKILL.md +207 -0
  33. package/.claude/skills/domain/design/ui-design/SKILL.md +124 -0
  34. package/.claude/skills/domain/frontend/testing-fe/SKILL.md +143 -38
  35. package/.claude/skills/domain/frontend/ui-ux-pro-max/README.md +45 -0
  36. package/.claude/skills/domain/frontend/ui-ux-pro-max/SKILL.md +404 -0
  37. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/charts.csv +26 -0
  38. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/colors.csv +97 -0
  39. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/icons.csv +101 -0
  40. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/landing.csv +31 -0
  41. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/products.csv +97 -0
  42. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/react-performance.csv +45 -0
  43. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  44. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  45. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  46. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  47. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  48. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  49. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  50. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  51. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/react.csv +54 -0
  52. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  53. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  54. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  55. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  56. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/styles.csv +68 -0
  57. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/typography.csv +58 -0
  58. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  59. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  60. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/web-interface.csv +31 -0
  61. package/.claude/skills/domain/frontend/ui-ux-pro-max/scripts/core.py +253 -0
  62. package/.claude/skills/domain/frontend/ui-ux-pro-max/scripts/design_system.py +1067 -0
  63. package/.claude/skills/domain/frontend/ui-ux-pro-max/scripts/search.py +114 -0
  64. package/.claude/skills/domain/product/requirements-clarity/SKILL.md +340 -0
  65. package/.claude/skills/skills-registry.yaml +103 -8
  66. package/README.md +107 -33
  67. package/README.npm.md +252 -0
  68. package/TUTORIAL.md +256 -0
  69. package/bin/agent-team.js +26 -7
  70. package/config/roles.yaml +107 -0
  71. package/docs/01-architecture.md +699 -0
  72. package/docs/02-setup-guide.md +634 -0
  73. package/docs/03-skills-guide.md +628 -0
  74. package/docs/04-workflows.md +792 -0
  75. package/docs/05-model-strategy.md +550 -0
  76. package/docs/06-extend-guide.md +1226 -0
  77. package/docs/07-quick-reference.md +578 -0
  78. package/docs/08-skills-discovery.md +342 -0
  79. package/docs/README.md +134 -0
  80. package/docs/rqm.md +560 -0
  81. package/package.json +10 -4
  82. package/scripts/postinstall.js +46 -0
  83. package/src/commands/add.js +131 -67
  84. package/src/commands/init.js +419 -9
  85. package/src/commands/list.js +20 -16
  86. package/src/commands/projects.js +127 -0
  87. package/src/commands/setup-hooks.js +261 -0
  88. package/src/index.js +0 -1
  89. package/src/utils/file-utils.js +147 -50
  90. package/src/utils/global-registry.js +224 -0
  91. package/templates/CLAUDE.md.tmpl +128 -20
  92. package/templates/MEMORY.md.tmpl +119 -0
  93. package/templates/agent.md.tmpl +205 -0
  94. package/templates/code/nestjs-controller.ts.tmpl +49 -0
  95. package/templates/code/nestjs-dto.ts.tmpl +63 -0
  96. package/templates/code/nestjs-service.ts.tmpl +45 -0
  97. package/templates/code/react-component.tsx.tmpl +24 -0
  98. package/templates/code/react-hook.ts.tmpl +54 -0
  99. package/templates/code/test.spec.ts.tmpl +50 -0
  100. package/templates/code/vue-component.vue.tmpl +49 -0
  101. package/templates/code/vue-composable.ts.tmpl +54 -0
  102. package/templates/knowledge.md.tmpl +152 -17
  103. package/templates/meeting-notes.md.tmpl +110 -0
  104. package/templates/memory/hooks.memory.json +50 -0
  105. package/templates/memory/settings.memory.json +16 -0
  106. package/templates/reports/bug-report.md.tmpl +164 -0
  107. package/templates/reports/code-review.md.tmpl +201 -0
  108. package/templates/reports/sprint-report.md.tmpl +218 -0
  109. package/templates/roles/ba.md +53 -0
  110. package/templates/roles/designer.md +82 -0
  111. package/templates/roles/dev-be.md +49 -0
  112. package/templates/roles/dev-fe.md +49 -0
  113. package/templates/roles/devops.md +53 -0
  114. package/templates/roles/pm.md +49 -0
  115. package/templates/roles/qa.md +53 -0
  116. package/templates/roles/sa.md +49 -0
  117. package/templates/roles/tech-lead.md +132 -0
  118. package/templates/skills/memory/memory-status.md +78 -0
  119. package/templates/skills/memory/recall.md +160 -0
  120. package/templates/skills/memory/reflect.md +168 -0
  121. package/templates/skills/memory/remember.md +105 -0
  122. package/templates/tasks/lessons.md.tmpl +77 -0
  123. package/templates/tasks/todo.md.tmpl +53 -0
  124. package/src/commands/switch.js +0 -53
@@ -0,0 +1,699 @@
1
+ # Architecture Overview
2
+
3
+ > **Phiên bản:** 2.1
4
+ > **Cập nhật:** 2025-02-27
5
+ > **Related:** [Setup Guide](02-setup-guide.md) | [Skills Guide](03-skills-guide.md)
6
+
7
+ ---
8
+
9
+ ## 🆕 What's New in v2.1
10
+
11
+ Patterns từ **OpenFang** (Agent Operating System):
12
+
13
+ 1. **Tool Profiles** - Predefined tool sets per role (minimal, coding, research, orchestration, full)
14
+ 2. **Capability-Based Security** - Fine-grained permissions for files, shell, network
15
+ 3. **Orchestrator Pattern** - Tech-lead delegation and coordination methodology
16
+ 4. **Operational Phases** - Multi-phase workflow (ANALYZE → PLAN → IMPLEMENT → VERIFY → DOCUMENT)
17
+ 5. **Knowledge Graph Skill** - Entity-relation storage for cross-agent knowledge
18
+
19
+ ---
20
+
21
+ ## 📋 Mục Lục
22
+
23
+ 1. [Tổng Quan](#-tổng-quan)
24
+ 2. [Base Role + Variants System](#-base-role--variants-system)
25
+ 3. [Multi-Agent Setup](#-multi-agent-setup)
26
+ 4. [Directory Structure](#-directory-structure)
27
+ 5. [Rules System](#-rules-system)
28
+ 6. [Skill Categories](#-skill-categories)
29
+ 7. [Key Design Decisions](#-key-design-decisions)
30
+
31
+ ---
32
+
33
+ ## 🎯 Tổng Quan
34
+
35
+ **Agent Team Template** là hệ thống để:
36
+ - Tạo team với nhiều AI agents chuyên môn
37
+ - Mỗi agent có skills, knowledge base riêng
38
+ - Tự học và cải thiện qua thời gian
39
+ - Setup nhanh cho mỗi dự án
40
+
41
+ ### Core Concepts
42
+
43
+ ```
44
+ ┌─────────────────────────────────────────────────────────────────────────┐
45
+ │ AGENT TEAM ARCHITECTURE │
46
+ ├─────────────────────────────────────────────────────────────────────────┤
47
+ │ │
48
+ │ ┌────────────────────────────────────────────────────────────────┐ │
49
+ │ │ TEMPLATE (agent-team-template/) │ │
50
+ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │
51
+ │ │ │ Roles │ │ Skills │ │ Rules │ │ │
52
+ │ │ │ (variants) │ │ (categorized)│ │ (general + │ │ │
53
+ │ │ │ │ │ │ │ per-role) │ │ │
54
+ │ │ └──────────────┘ └──────────────┘ └──────────────┘ │ │
55
+ │ └────────────────────────────────────────────────────────────────┘ │
56
+ │ │ │
57
+ │ │ Setup Script │
58
+ │ ▼ │
59
+ │ ┌────────────────────────────────────────────────────────────────┐ │
60
+ │ │ PROJECT INSTANCE (my-project/) │ │
61
+ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │
62
+ │ │ │ Agent 1 │ │ Agent 2 │ │ Agent N │ │ │
63
+ │ │ │ payment-fe │ │ auth-be │ │ ... │ │ │
64
+ │ │ │ (React) │ │ (NestJS) │ │ │ │ │
65
+ │ │ └──────────────┘ └──────────────┘ └──────────────┘ │ │
66
+ │ └────────────────────────────────────────────────────────────────┘ │
67
+ │ │
68
+ └─────────────────────────────────────────────────────────────────────────┘
69
+ ```
70
+
71
+ ---
72
+
73
+ ## 🔄 Base Role + Variants System
74
+
75
+ ### Concept: Base Role + Variants
76
+
77
+ ```
78
+ ┌─────────────────────────────────────────────────────────────────────┐
79
+ │ ROLE STRUCTURE │
80
+ ├─────────────────────────────────────────────────────────────────────┤
81
+ │ │
82
+ │ ┌──────────────────────────────────────────────────────────────┐ │
83
+ │ │ BASE ROLE (dev-fe) │ │
84
+ │ │ ┌─────────────────────────────────────────────────────────┐ │ │
85
+ │ │ │ Common Skills: frontend-design, web-design-guidelines │ │ │
86
+ │ │ │ Common MCPs: Context7, GitHub │ │ │
87
+ │ │ │ Common Workflows: code-review, testing │ │ │
88
+ │ │ │ Common Knowledge: UI patterns, accessibility │ │ │
89
+ │ │ └─────────────────────────────────────────────────────────┘ │ │
90
+ │ └──────────────────────────────────────────────────────────────┘ │
91
+ │ │ │
92
+ │ ┌────────┼────────┬────────────┐ │
93
+ │ ▼ ▼ ▼ ▼ │
94
+ │ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
95
+ │ │ REACT │ │ VUE │ │ ANGULAR │ │ VANILLA │ │
96
+ │ │ VARIANT │ │ VARIANT │ │ VARIANT │ │ VARIANT │ │
97
+ │ ├───────────┤ ├───────────┤ ├───────────┤ ├───────────┤ │
98
+ │ │ react- │ │ vue- │ │ angular- │ │ js- │ │
99
+ │ │ best- │ │ patterns │ │ cli │ │ native │ │
100
+ │ │ practices │ │ vuex │ │ ngrx │ │ webpack │ │
101
+ │ │ nextjs │ │ nuxt │ │ nx │ │ vite │ │
102
+ │ │ vite │ │ vite │ │ │ │ │ │
103
+ │ └───────────┘ └───────────┘ └───────────┘ └───────────┘ │
104
+ └─────────────────────────────────────────────────────────────────────┘
105
+ ```
106
+
107
+ ### Multi-Variant Composition
108
+
109
+ **Concept:** 1 Role có thể combine NHIỀU variants từ different categories.
110
+
111
+ ```
112
+ ┌─────────────────────────────────────────────────────────────────────────────┐
113
+ │ MULTI-VARIANT COMPOSITION │
114
+ ├─────────────────────────────────────────────────────────────────────────────┤
115
+ │ │
116
+ │ Agent: payment-fe (dev-fe base) │
117
+ │ │
118
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
119
+ │ │ COMBINED VARIANTS │ │
120
+ │ │ │ │
121
+ │ │ [framework] [styling] [state] [testing] [i18n] │ │
122
+ │ │ ┌─────────┐ ┌──────────┐ ┌────────┐ ┌────────┐ ┌──────┐ │ │
123
+ │ │ │ REACT │ + │ TAILWIND │ + │ ZUSTAND│ + │ VITEST │ + │ I18N │ │ │
124
+ │ │ └─────────┘ └──────────┘ └────────┘ └────────┘ └──────┘ │ │
125
+ │ │ │ │ │ │ │ │ │
126
+ │ │ ▼ ▼ ▼ ▼ ▼ │ │
127
+ │ │ react-best- tailwind- zustand- vitest- react- │ │
128
+ │ │ practices patterns patterns testing i18next │ │
129
+ │ │ │ │
130
+ │ └─────────────────────────────────────────────────────────────────────┘ │
131
+ │ │
132
+ │ Result: 1 agent với ALL skills from ALL selected variants │
133
+ │ │
134
+ └─────────────────────────────────────────────────────────────────────────────┘
135
+ ```
136
+
137
+ ### Variant Categories
138
+
139
+ | Category | Description | Options |
140
+ |----------|-------------|---------|
141
+ | `framework` | UI framework (CHỌN 1) | `react`, `vue`, `angular`, `vanilla`, `svelte` |
142
+ | `meta-framework` | Meta framework | `nextjs`, `nuxt`, `remix`, `astro` |
143
+ | `styling` | CSS solution | `tailwind`, `css-modules`, `styled-components`, `scss` |
144
+ | `state` | State management | `zustand`, `redux`, `recoil`, `jotai`, `mobx` |
145
+ | `data` | Data fetching | `tanstack-query`, `swr`, `apollo`, `urql` |
146
+ | `testing` | Test framework | `vitest`, `jest`, `testing-library`, `cypress`, `playwright` |
147
+ | `i18n` | Internationalization | `react-i18next`, `formatjs`, `next-intl` |
148
+ | `form` | Form handling | `react-hook-form`, `formik`, `zod` |
149
+ | `ui-lib` | UI component library | `shadcn`, `mui`, `ant-design`, `chakra` |
150
+
151
+ ---
152
+
153
+ ## 👥 Multi-Agent Setup
154
+
155
+ ### Multiple Agents trong 1 Project
156
+
157
+ ```bash
158
+ # Ví dụ: Team với nhiều FE dev khác tech stack
159
+ ./agent.sh setup payment-fe dev-fe \
160
+ --framework react --styling tailwind --state zustand
161
+
162
+ ./agent.sh setup admin-fe dev-fe \
163
+ --framework vue --styling tailwind --state pinia
164
+
165
+ ./agent.sh setup auth-be dev-be \
166
+ --framework nestjs --database postgresql --orm prisma
167
+ ```
168
+
169
+ ### Project Instance Structure
170
+
171
+ ```text
172
+ my-project/
173
+ ├── .claude/
174
+ │ ├── CLAUDE.md # Project context
175
+ │ │
176
+ │ ├── agents/ # Multiple agent instances
177
+ │ │ ├── payment-fe/ # Agent instance
178
+ │ │ │ ├── CLAUDE.md # Agent config
179
+ │ │ │ ├── knowledge.md # Knowledge base
180
+ │ │ │ └── skills/ # Skills (copied/symlinked)
181
+ │ │ │ ├── frontend-design/ # From base (symlink)
182
+ │ │ │ └── react-best-practices/ # From variant (copy)
183
+ │ │ │
184
+ │ │ ├── admin-fe/
185
+ │ │ │ ├── CLAUDE.md
186
+ │ │ │ ├── knowledge.md
187
+ │ │ │ └── skills/
188
+ │ │ │ ├── frontend-design/ # Shared base skill (symlink)
189
+ │ │ │ ├── vue-patterns/
190
+ │ │ │ └── testing-vue/
191
+ │ │ │
192
+ │ │ └── auth-be/
193
+ │ │ ├── CLAUDE.md
194
+ │ │ ├── knowledge.md
195
+ │ │ └── skills/
196
+ │ │ ├── api-design/
197
+ │ │ ├── nestjs-patterns/
198
+ │ │ └── security/
199
+ │ │
200
+ │ ├── shared-skills/ # Shared skills (symlinks)
201
+ │ │ ├── frontend-design/ # → template/skills/roles/dev-fe/
202
+ │ │ └── git-automation/ # → template/skills/base/
203
+ │ │
204
+ │ ├── rules/ # Rules (copy from template)
205
+ │ │ ├── general-rules.md
206
+ │ │ ├── dev-fe-rules.md
207
+ │ │ └── lessons.md
208
+ │ │
209
+ │ └── settings.json
210
+
211
+ └── docs/
212
+ ├── architecture.md
213
+ └── patterns.md
214
+ ```
215
+
216
+ ---
217
+
218
+ ## 📁 Directory Structure
219
+
220
+ ### Template Structure
221
+
222
+ ```text
223
+ agent-team-template/
224
+ ├── .claude/
225
+ │ ├── commands/ # Slash commands
226
+ │ │ ├── roles/ # Role switch commands
227
+ │ │ │ ├── pm.md
228
+ │ │ │ ├── dev-fe.md
229
+ │ │ │ └── dev-be.md
230
+ │ │ ├── utils/ # Utility commands
231
+ │ │ │ ├── learn.md
232
+ │ │ │ ├── retrospect.md
233
+ │ │ │ ├── sync.md
234
+ │ │ │ └── switch.md
235
+ │ │ └── workflows/ # Workflow commands
236
+ │ │ └── retrospective.md
237
+ │ │
238
+ │ ├── skills/ # Skills (NEW STRUCTURE v2.0)
239
+ │ │ ├── SKILL-INDEX.md # Central hub with dependency graph
240
+ │ │ │
241
+ │ │ ├── core/ # Universal skills (3)
242
+ │ │ │ ├── code-review/
243
+ │ │ │ ├── git-automation/
244
+ │ │ │ └── retrospect-work/
245
+ │ │ │
246
+ │ │ ├── domain/ # Domain-specific (31 skills)
247
+ │ │ │ ├── frontend/ # 5 skills
248
+ │ │ │ │ ├── frontend-design/
249
+ │ │ │ │ ├── accessibility/
250
+ │ │ │ │ ├── state-management/
251
+ │ │ │ │ ├── testing-fe/
252
+ │ │ │ │ └── performance-fe/
253
+ │ │ │ │
254
+ │ │ │ ├── backend/ # 5 skills
255
+ │ │ │ │ ├── api-design/
256
+ │ │ │ │ ├── database-design/
257
+ │ │ │ │ ├── security/
258
+ │ │ │ │ ├── testing-be/
259
+ │ │ │ │ └── performance-be/
260
+ │ │ │ │
261
+ │ │ │ ├── architecture/ # 6 skills
262
+ │ │ │ │ ├── system-design/
263
+ │ │ │ │ ├── architecture-patterns/
264
+ │ │ │ │ ├── adr-writing/
265
+ │ │ │ │ ├── tech-selection/
266
+ │ │ │ │ ├── performance-engineering/
267
+ │ │ │ │ └── security-architecture/
268
+ │ │ │ │
269
+ │ │ │ ├── devops/ # 5 skills (NEW)
270
+ │ │ │ │ ├── ci-cd/
271
+ │ │ │ │ ├── containerization/
272
+ │ │ │ │ ├── infrastructure-as-code/
273
+ │ │ │ │ ├── monitoring/
274
+ │ │ │ │ └── deployment/
275
+ │ │ │ │
276
+ │ │ │ ├── product/ # 5 skills (NEW)
277
+ │ │ │ │ ├── requirements-gathering/
278
+ │ │ │ │ ├── user-stories/
279
+ │ │ │ │ ├── sprint-planning/
280
+ │ │ │ │ ├── roadmap-planning/
281
+ │ │ │ │ └── stakeholder-communication/
282
+ │ │ │ │
283
+ │ │ │ └── quality/ # 4 skills (NEW)
284
+ │ │ │ ├── test-planning/
285
+ │ │ │ ├── bug-reporting/
286
+ │ │ │ ├── test-automation/
287
+ │ │ │ └── regression-testing/
288
+ │ │ │
289
+ │ │ ├── leadership/ # Tech Lead skills (4 - NEW)
290
+ │ │ │ ├── code-review-advanced/
291
+ │ │ │ ├── technical-decision/
292
+ │ │ │ ├── mentoring/
293
+ │ │ │ └── technical-debt/
294
+ │ │ │
295
+ │ │ └── community/ # Community contributions
296
+ │ │
297
+ │ ├── rules/ # Rules System
298
+ │ │ ├── common/ # Universal rules
299
+ │ │ │ └── general-rules.md
300
+ │ │ ├── role-rules/ # Per-role rules
301
+ │ │ │ ├── dev-fe-rules.md
302
+ │ │ │ ├── dev-be-rules.md
303
+ │ │ │ ├── sa-rules.md
304
+ │ │ │ └── tech-lead-rules.md
305
+ │ │ └── lessons/
306
+ │ │ └── lessons.md # Lessons learned
307
+ │ │
308
+ │ └── settings.json # MCP configurations
309
+
310
+ ├── roles/ # Role definitions
311
+ │ ├── base/ # Base role templates
312
+ │ │ ├── dev-fe/CLAUDE.md.tmpl
313
+ │ │ ├── dev-be/CLAUDE.md.tmpl
314
+ │ │ ├── sa/CLAUDE.md.tmpl
315
+ │ │ └── tech-lead/CLAUDE.md.tmpl
316
+ │ └── variants/ # Variant additions
317
+ │ ├── dev-fe/react/CLAUDE.md.tmpl
318
+ │ └── dev-be/nestjs/CLAUDE.md.tmpl
319
+
320
+ ├── scripts/ # Setup scripts
321
+ │ ├── agent.sh # UNIFIED script
322
+ │ ├── check-skills.sh # Skill verification
323
+ │ └── copy-skills.sh # Skill copying
324
+
325
+ ├── presets/ # Quick setup presets
326
+ │ ├── react-full-stack.yaml
327
+ │ └── nestjs-api.yaml
328
+
329
+ └── docs/ # Documentation
330
+ └── (7 files)
331
+ ```
332
+
333
+ ---
334
+
335
+ ## 📜 Rules System
336
+
337
+ ### Nguồn tham khảo
338
+ - Boris Cherny (Anthropic engineer - người tạo Claude Code) internal workflows
339
+ - everything-claude-code research
340
+
341
+ ### Cấu trúc Rules
342
+
343
+ ```text
344
+ rules/
345
+ ├── common/ # Universal principles (always install)
346
+ │ ├── coding-style.md # Coding conventions
347
+ │ ├── git-workflow.md # Git conventions
348
+ │ ├── testing.md # Testing standards
349
+ │ ├── performance.md # Performance guidelines
350
+ │ ├── patterns.md # Design patterns
351
+ │ ├── hooks.md # Claude Code hooks
352
+ │ ├── agents.md # Agent patterns
353
+ │ └── security.md # Security guidelines
354
+ ├── role-rules/ # Role-specific rules
355
+ │ ├── dev-fe-rules.md
356
+ │ ├── dev-be-rules.md
357
+ │ ├── qa-rules.md
358
+ │ └── tech-lead-rules.md
359
+ ├── language-rules/ # Language-specific (NEW)
360
+ │ ├── typescript/
361
+ │ ├── python/
362
+ │ └── golang/
363
+ ├── lessons/
364
+ │ └── lessons.md # Lessons learned
365
+ ├── rules_10k.md # <10k chars version
366
+ └── rules_4k.md # <4k chars (Copilot limit)
367
+ ```
368
+
369
+ ### General Rules (Áp dụng cho TẤT CẢ agents)
370
+
371
+ ```markdown
372
+ # General Rules - Áp dụng cho TẤT CẢ agents
373
+
374
+ ## Workflow Orchestration
375
+
376
+ 1. **Plan Mode Default**
377
+ - Enter plan mode for ANY non-trivial task (3+ steps or architectural decisions)
378
+ - If something goes sideways, STOP and re-plan immediately
379
+ - Use plan mode for verification steps, not just building
380
+ - Write detailed specs upfront to reduce ambiguity
381
+
382
+ 2. **Subagent Strategy**
383
+ - Use subagents liberally to keep main context window clean
384
+ - Offload research, exploration, and parallel analysis to subagents
385
+ - For complex problems, throw more compute via subagents
386
+ - One task per subagent for focused execution
387
+
388
+ 3. **Self-Improvement Loop**
389
+ - After ANY correction from user: update `lessons.md` with the pattern
390
+ - Write rules for yourself that prevent the same mistake
391
+ - Ruthlessly iterate on these lessons until mistake rate drops
392
+ - Review lessons at session start for relevant project
393
+
394
+ 4. **Verification Before Done**
395
+ - Never mark task complete without proving it works
396
+ - Diff behavior between main and your changes when relevant
397
+ - Ask yourself: "Would a staff engineer approve this?"
398
+ - Run tests, check logs, demonstrate correctness
399
+
400
+ 5. **Autonomous Bug Fixing**
401
+ - When given a bug report: just fix it. Don't ask for hand-holding
402
+ - Point at logs, errors, failing tests – then resolve them
403
+ - Zero context switching required from user
404
+
405
+ ## Task Management
406
+
407
+ 1. **Plan First**: Write plan to `tasks/todo.md` with checkable items
408
+ 2. **Verify Plan**: Check in before starting implementation
409
+ 3. **Track Progress**: Mark items complete as you go
410
+ 4. **Explain Changes**: High-level summary at each step
411
+ 5. **Document Results**: Add review section to `tasks/todo.md`
412
+ 6. **Capture Lessons**: Update `lessons.md` after corrections
413
+
414
+ ## Core Principles
415
+
416
+ - **Simplicity First**: Make every change as simple as possible
417
+ - **No Laziness**: Find root causes. No temporary fixes. Senior standards.
418
+ - **Minimal Impact**: Changes should only touch what's necessary
419
+ ```
420
+
421
+ ### Per-Role Rules Example (dev-fe-rules.md)
422
+
423
+ ```markdown
424
+ # dev-fe Rules - Rules riêng cho Frontend Developers
425
+
426
+ ## FE-Specific Rules
427
+
428
+ 1. **Context7 Mandatory**
429
+ - ALWAYS use Context7 to lookup React/Vite docs BEFORE coding
430
+ - Never assume API behavior without verification
431
+
432
+ 2. **Component Structure**
433
+ - Tách UI thành src/components/ và src/features/
434
+ - Always use function components + hooks
435
+ - Write TypeScript rõ ràng, avoid any
436
+
437
+ 3. **Testing Requirements**
438
+ - Every component must have corresponding test file
439
+ - Use Vitest + Testing Library
440
+ - Test user interactions, not implementation details
441
+
442
+ 4. **Performance Checks**
443
+ - Check for unnecessary re-renders
444
+ - Use React DevTools Profiler
445
+ - Lazy load components when appropriate
446
+
447
+ 5. **Accessibility**
448
+ - All interactive elements must be keyboard accessible
449
+ - Use semantic HTML
450
+ - Add ARIA labels where needed
451
+
452
+ ## Anti-Patterns to Avoid
453
+
454
+ - ❌ Using useEffect for derived state
455
+ - ❌ Storing props in state
456
+ - ❌ Inline functions in render (use useCallback)
457
+ - ❌ Importing entire libraries (use tree-shaking)
458
+ ```
459
+
460
+ ---
461
+
462
+ ## 🎯 Skill Categories
463
+
464
+ ### New Categorization System (v2.0)
465
+
466
+ ```
467
+ skills/
468
+ ├── core/ # Universal skills (5 skills)
469
+ │ ├── code-review/
470
+ │ ├── git-automation/
471
+ │ ├── retrospect-work/
472
+ │ ├── agent-creation/
473
+ │ └── sequential-thinking/
474
+
475
+ ├── domain/ # Domain-specific (39 skills)
476
+ │ ├── frontend/ # 6 skills
477
+ │ │ ├── frontend-design/
478
+ │ │ ├── accessibility/
479
+ │ │ ├── state-management/
480
+ │ │ ├── testing-fe/
481
+ │ │ ├── performance-fe/
482
+ │ │ └── ui-ux-pro-max/
483
+ │ │
484
+ │ ├── backend/ # 5 skills
485
+ │ │ ├── api-design/
486
+ │ │ ├── database-design/
487
+ │ │ ├── security/
488
+ │ │ ├── testing-be/
489
+ │ │ └── performance-be/
490
+ │ │
491
+ │ ├── architecture/ # 8 skills
492
+ │ │ ├── system-design/
493
+ │ │ ├── architecture-patterns/
494
+ │ │ ├── adr-writing/
495
+ │ │ ├── tech-selection/
496
+ │ │ ├── performance-engineering/
497
+ │ │ ├── security-architecture/
498
+ │ │ ├── c4-architecture/
499
+ │ │ └── mermaid-diagrams/
500
+ │ │
501
+ │ ├── devops/ # 5 skills
502
+ │ │ ├── ci-cd/
503
+ │ │ ├── containerization/
504
+ │ │ ├── infrastructure-as-code/
505
+ │ │ ├── monitoring/
506
+ │ │ └── deployment/
507
+ │ │
508
+ │ ├── product/ # 6 skills
509
+ │ │ ├── requirements-gathering/
510
+ │ │ ├── user-stories/
511
+ │ │ ├── sprint-planning/
512
+ │ │ ├── roadmap-planning/
513
+ │ │ ├── stakeholder-communication/
514
+ │ │ └── requirements-clarity/
515
+ │ │
516
+ │ ├── quality/ # 4 skills
517
+ │ │ ├── test-planning/
518
+ │ │ ├── bug-reporting/
519
+ │ │ ├── test-automation/
520
+ │ │ └── regression-testing/
521
+ │ │
522
+ │ └── design/ # 5 skills (NEW)
523
+ │ ├── ui-design/
524
+ │ ├── design-system/
525
+ │ ├── responsive-design/
526
+ │ ├── html-css-output/
527
+ │ └── mockup-creation/
528
+
529
+ ├── leadership/ # Tech Lead skills (4 skills)
530
+ │ ├── code-review-advanced/
531
+ │ ├── technical-decision/
532
+ │ ├── mentoring/
533
+ │ └── technical-debt/
534
+
535
+ ├── community/ # Community contributions (1 skill)
536
+ │ └── security-validator/
537
+
538
+ └── SKILL-INDEX.md # Central hub with dependency graph
539
+ ```
540
+
541
+ ### Skill Dependency Mechanism
542
+
543
+ Each skill has a YAML frontmatter with dependencies:
544
+
545
+ ```yaml
546
+ ---
547
+ name: skill-name
548
+ version: 1.0.0
549
+ description: What and WHEN to use this skill
550
+ category: domain-name
551
+ tags: [tag1, tag2]
552
+
553
+ # Dependency mechanism - "Skill dùng Skill"
554
+ depends_on: [] # Hard dependencies (must load)
555
+ recommends: [] # Soft dependencies (suggest in context)
556
+ used_by: [] # Reverse reference (for discovery)
557
+ ---
558
+ ```
559
+
560
+ ### Total: 50 Skills
561
+
562
+ | Category | Count | Description |
563
+ |----------|-------|-------------|
564
+ | Core | 6 | Universal skills for all roles (includes knowledge-graph) |
565
+ | Frontend | 6 | React/Vue/UI development |
566
+ | Backend | 5 | API/Database/Security |
567
+ | Architecture | 8 | System design, ADRs, C4, Mermaid |
568
+ | DevOps | 5 | CI/CD, Docker, Terraform |
569
+ | Product | 6 | Requirements, Sprints, Clarity |
570
+ | Quality | 4 | Testing, QA |
571
+ | Design | 5 | UI design, Design systems, Mockups |
572
+ | Leadership | 4 | Tech Lead skills |
573
+ | **Total** | **50** | All skills complete |
574
+
575
+ ### Skill Sources Policy
576
+
577
+ | Type | Source | Installation Strategy |
578
+ |------|--------|----------------------|
579
+ | **Official** | Anthropic, Vercel, Microsoft | INSTALL/REFERENCE |
580
+ | **Community** | ClaudeKit, VoltAgent | COPY to source |
581
+ | **Custom** | Project-specific | COPY to source |
582
+
583
+ **Why COPY for Community?**
584
+ 1. ✅ Độc lập - Không cần internet để dùng
585
+ 2. ✅ Version control - Skills được track trong git
586
+ 3. ✅ Customizable - Có thể sửa theo project needs
587
+ 4. ✅ Stable - Không bị break khi external repo update
588
+
589
+ ---
590
+
591
+ ## 🔑 Key Design Decisions
592
+
593
+ ### 0. Tool Profiles & Capability Security (v2.1 - từ OpenFang)
594
+
595
+ **Decision:** Predefined tool sets with fine-grained permissions
596
+
597
+ ```yaml
598
+ # config/roles.yaml
599
+ tool_profiles:
600
+ minimal:
601
+ tools: [read, write, edit]
602
+ mcp_servers: []
603
+
604
+ coding:
605
+ tools: [read, write, edit, bash, grep, glob]
606
+ mcp_servers: [filesystem, github]
607
+
608
+ research:
609
+ tools: [read, web_search, web_fetch]
610
+ mcp_servers: [context7, docs-seeker]
611
+
612
+ orchestration:
613
+ tools: [read, write, edit, bash, grep, glob, task]
614
+ mcp_servers: [filesystem, github, context7]
615
+
616
+ full:
617
+ tools: all
618
+ mcp_servers: all
619
+ ```
620
+
621
+ **Role Mapping:**
622
+
623
+ | Role | Tool Profile |
624
+ |------|--------------|
625
+ | dev-fe, dev-be, devops, qa | coding |
626
+ | pm, ba | research |
627
+ | tech-lead | orchestration |
628
+ | sa | full |
629
+ | designer | minimal |
630
+
631
+ **Capability-Based Security (in role rules):**
632
+
633
+ ```markdown
634
+ ## Tool Access Control
635
+
636
+ ### File Operations
637
+ - READ: src/**, public/**
638
+ - WRITE: src/**
639
+ - DENY: .env*, secrets/**
640
+
641
+ ### Shell Commands
642
+ - ALLOW: npm run *, git *
643
+ - DENY: rm -rf, sudo *
644
+ ```
645
+
646
+ **Rationale:** Fine-grained control, deny-by-default security, scoped access
647
+
648
+ ### 1. Base + Variants Architecture
649
+
650
+ **Decision:** Use composition over inheritance
651
+ - Base role provides common skills/MCPs
652
+ - Variants add tech-specific capabilities
653
+ - Agents can combine multiple variants
654
+
655
+ **Rationale:** Flexibility to support any tech stack combination
656
+
657
+ ### 2. Skill Categorization (v2.0)
658
+
659
+ **Decision:** Four-level categorization (core/domain/leadership/community)
660
+ - `core/` - Universal skills (code-review, git-automation, retrospect-work)
661
+ - `domain/` - Domain-specific (frontend, backend, architecture, devops, product, quality)
662
+ - `leadership/` - Tech Lead skills (code-review-advanced, technical-decision, mentoring, technical-debt)
663
+ - `community/` - Community contributions
664
+
665
+ **Rationale:**
666
+
667
+ 1. Clear domain boundaries
668
+ 2. Skill dependency mechanism (depends_on, recommends, used_by)
669
+ 3. Progressive disclosure (metadata → instructions → resources)
670
+ 4. Central hub (SKILL-INDEX.md) for navigation
671
+
672
+ ### 3. Rules System
673
+
674
+ **Decision:** Multi-level rules with lessons learned
675
+ - General rules for all agents
676
+ - Role-specific rules
677
+ - Lessons learned from corrections
678
+
679
+ **Rationale:** Self-improvement mechanism built into the system
680
+
681
+ ### 4. Directory Independence
682
+
683
+ **Decision:** Template separate from project instances
684
+ - Template is the source of truth
685
+ - Projects copy/symlink what they need
686
+ - No dependency on external repos
687
+
688
+ **Rationale:** Reliability, offline capability, version control
689
+
690
+ ---
691
+
692
+ ## 📚 Related Documentation
693
+
694
+ - [Setup Guide](02-setup-guide.md) - How to setup agents
695
+ - [Skills Guide](03-skills-guide.md) - Managing skills
696
+ - [Workflows](04-workflows.md) - Workflow orchestration
697
+ - [Model Strategy](05-model-strategy.md) - Model selection by task
698
+ - [Extend Guide](06-extend-guide.md) - Creating new agents/skills
699
+ - [Quick Reference](07-quick-reference.md) - Cheat sheet