@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,1226 @@
1
+ # Extend Guide
2
+
3
+ > **Phiên bản:** 1.1
4
+ > **Cập nhật:** 2025-02-26
5
+ > **Related:** [Architecture](01-architecture.md) | [Skills Guide](03-skills-guide.md) | [Skills Discovery](08-skills-discovery.md)
6
+
7
+ ---
8
+
9
+ ## 📋 Mục Lục
10
+
11
+ 1. [Overview](#-overview)
12
+ 2. [🔍 How to Find & Install Skills from skills.sh](#-how-to-find--install-skills-from-skillssh) **(MANDATORY)**
13
+ 3. [How to Create New Agent](#-how-to-create-new-agent)
14
+ 4. [How to Create New Variant](#-how-to-create-new-variant)
15
+ 5. [How to Create New Skill](#-how-to-create-new-skill)
16
+ 6. [How to Create New Workflow](#-how-to-create-new-workflow)
17
+ 7. [How to Add New Rules](#-how-to-add-new-rules)
18
+ 8. [Format Standards & Templates](#-format-standards--templates)
19
+ 9. [Common Mistakes to Avoid](#-common-mistakes-to-avoid)
20
+
21
+ ---
22
+
23
+ ## 🎯 Overview
24
+
25
+ Guide này giúp bạn mở rộng Agent Team Template với:
26
+ - **New Agents**: Tạo agent mới với roles và variants
27
+ - **New Variants**: Thêm tech stack mới
28
+ - **New Skills**: Tạo skills mới
29
+ - **New Workflows**: Định nghĩa workflows mới
30
+ - **New Rules**: Thêm rules cho agents
31
+
32
+ ### Extension Points
33
+
34
+ ```
35
+ ┌─────────────────────────────────────────────────────────────────────────────┐
36
+ │ EXTENSION POINTS │
37
+ ├─────────────────────────────────────────────────────────────────────────────┤
38
+ │ │
39
+ │ roles/base/ → Create new base roles │
40
+ │ roles/variants/ → Add tech variants │
41
+ │ .claude/skills/ → Add new skills │
42
+ │ .claude/commands/ → Add slash commands │
43
+ │ .claude/rules/ → Add rules │
44
+ │ workflows/ → Add workflow definitions │
45
+ │ presets/ → Add setup presets │
46
+ │ │
47
+ └─────────────────────────────────────────────────────────────────────────────┘
48
+ ```
49
+
50
+ ---
51
+
52
+ ## 🔍 How to Find & Install Skills from skills.sh
53
+
54
+ > **⚠️ QUAN TRỌNG:** Đây là bước BẮT BUỘC trước khi tạo bất kỳ skill nào.
55
+
56
+ ### Step 0: Search skills.sh BEFORE Creating New Skill
57
+
58
+ **QUY TẮC:** Trước khi tạo skill mới, LUÔN:
59
+ 1. **Search skills.sh** để xem skill đã tồn tại chưa
60
+ 2. **Nếu tồn tại** → Copy về và customize (nếu cần)
61
+ 3. **Nếu không tồn tại** → Mới tạo mới
62
+
63
+ ### Using /discover Command
64
+
65
+ ```bash
66
+ # Search for React skills
67
+ /discover react
68
+
69
+ # Search for API design skills
70
+ /discover api design
71
+
72
+ # Search for frontend skills
73
+ /discover frontend --category frontend
74
+
75
+ # Search official sources only
76
+ /discover testing --official
77
+ ```
78
+
79
+ ### Manual Search on skills.sh
80
+
81
+ 1. Visit [https://skills.sh](https://skills.sh)
82
+ 2. Search for relevant keywords
83
+ 3. Check install count and source
84
+ 4. Note the `owner/repo` for installation
85
+
86
+ ### Installing Skills
87
+
88
+ ```bash
89
+ # Install specific skill from multi-skill repo
90
+ /install-skill vercel-labs/agent-skills --skill react-best-practices
91
+
92
+ # Install from official source
93
+ /install-skill anthropics/skills --skill pdf
94
+
95
+ # Dry run to check before installing
96
+ /install-skill community/skill --dry-run
97
+ ```
98
+
99
+ ### Security Validation
100
+
101
+ **Official Sources** (Auto-validated):
102
+ - anthropics, vercel-labs, microsoft, google, expo, supabase
103
+
104
+ **Community Sources** (Require Review):
105
+ - All other sources require security validation
106
+ - Issues are reported for user decision
107
+ - NEVER auto-reject, let user decide
108
+
109
+ ### Decision Flow
110
+
111
+ ```
112
+ ┌────────────────────────────────────────────────────────────────┐
113
+ │ SKILL DISCOVERY DECISION FLOW │
114
+ ├────────────────────────────────────────────────────────────────┤
115
+ │ │
116
+ │ Need a skill? │
117
+ │ │ │
118
+ │ ▼ │
119
+ │ /discover <keyword> ──► Found? │
120
+ │ │ │ │
121
+ │ │ ┌────┴────┐ │
122
+ │ │ │ │ │
123
+ │ NO YES YES (community) │
124
+ │ │ │ │ │
125
+ │ ▼ ▼ ▼ │
126
+ │ Create new Install & Security │
127
+ │ skill customize validation │
128
+ │ │ │
129
+ │ ▼ │
130
+ │ Issues? │
131
+ │ ┌──┴──┐ │
132
+ │ NO YES │
133
+ │ │ │ │
134
+ │ Install Report & │
135
+ │ User decides │
136
+ │ │
137
+ └────────────────────────────────────────────────────────────────┘
138
+ ```
139
+
140
+ ### Review Existing Skills
141
+
142
+ ```bash
143
+ # Review all existing skills
144
+ /review-skills --all
145
+
146
+ # Review specific category
147
+ /review-skills --category frontend
148
+
149
+ # Review and suggest alternatives
150
+ /review-skills --all --suggest
151
+ ```
152
+
153
+ ---
154
+
155
+ ## 👤 How to Create New Agent
156
+
157
+ ### Step 1: Define Agent Purpose
158
+
159
+ Trước khi tạo agent, trả lời các câu hỏi:
160
+ - Mục đích của agent này là gì?
161
+ - Agent này thuộc role nào (base role)?
162
+ - Agent cần skills gì?
163
+ - Agent cần MCPs gì?
164
+
165
+ ### Step 2: Choose Creation Method
166
+
167
+ #### Method A: Using Setup Script (Recommended)
168
+
169
+ ```bash
170
+ # Create agent with existing role + variants
171
+ ./agent.sh setup my-agent dev-fe \
172
+ --framework react \
173
+ --styling tailwind \
174
+ --state zustand
175
+ ```
176
+
177
+ #### Method B: Create Custom Role
178
+
179
+ If you need a completely new role type, follow these steps:
180
+
181
+ ### Step 3: Create Base Role Template
182
+
183
+ ```bash
184
+ # Create directory
185
+ mkdir -p roles/base/data-engineer
186
+
187
+ # Create CLAUDE.md template
188
+ cat > roles/base/data-engineer/CLAUDE.md.tmpl << 'EOF'
189
+ # Project: {{PROJECT_NAME}} - Data Engineer
190
+
191
+ ## Role
192
+ - Bạn là Data Engineer chuyên sâu về:
193
+ - ETL/ELT pipelines
194
+ - Data warehouse design
195
+ - Data quality & governance
196
+ - Streaming data processing
197
+
198
+ ## Tech Stack & Conventions
199
+ - Languages: Python, SQL
200
+ - Tools: Airflow, dbt, Spark
201
+ - Cloud: AWS/GCP data services
202
+
203
+ ### Code Style
204
+ - Follow PEP 8 for Python
205
+ - Use type hints
206
+ - Document data schemas
207
+
208
+ ## How to Work
209
+ ### Khi nhận task:
210
+ 1. Analyze data requirements
211
+ 2. Design pipeline architecture
212
+ 3. Implement with tests
213
+ 4. Document data lineage
214
+
215
+ ## MCP Integration
216
+ - Context7: Dùng để tra cứu documentation (BẮT BUỘC)
217
+ - PostgreSQL: Database operations
218
+ - AWS/GCP: Cloud services
219
+
220
+ ## Knowledge Base
221
+ - Đọc từ: `.claude/agents/{{AGENT_NAME}}/knowledge.md`
222
+ - Cập nhật qua: `/retrospect-work` skill
223
+ EOF
224
+ ```
225
+
226
+ ### Step 4: Create Role Skills
227
+
228
+ ```bash
229
+ # Create skill directory
230
+ mkdir -p .claude/skills/roles/data-engineer/etl-design
231
+
232
+ # Create skill file
233
+ cat > .claude/skills/roles/data-engineer/etl-design/SKILL.md << 'EOF'
234
+ ---
235
+ name: etl-design
236
+ description: Design and implement ETL pipelines
237
+ category: data
238
+ ---
239
+
240
+ # Skill: ETL Design
241
+
242
+ ## Core Principle
243
+ Design reliable, maintainable data pipelines.
244
+
245
+ ## When to Use
246
+ - Creating new data pipeline
247
+ - Modifying existing ETL
248
+ - Data migration tasks
249
+
250
+ ## Steps
251
+ 1. Analyze source data
252
+ 2. Design transformations
253
+ 3. Implement pipeline
254
+ 4. Add monitoring
255
+
256
+ ## Output
257
+ - Pipeline code
258
+ - Documentation
259
+ - Tests
260
+ EOF
261
+ ```
262
+
263
+ ### Step 5: Create Agent with New Role
264
+
265
+ ```bash
266
+ ./agent.sh setup data-pipeline data-engineer
267
+ ```
268
+
269
+ ### Agent Template Format
270
+
271
+ ```markdown
272
+ # CLAUDE.md.tmpl Template
273
+
274
+ # Project: {{PROJECT_NAME}} - {{ROLE_NAME}}
275
+
276
+ ## Role
277
+ - Bạn là {{ROLE_NAME}} chuyên sâu về:
278
+ - {{SKILL_1}}
279
+ - {{SKILL_2}}
280
+ - {{SKILL_3}}
281
+
282
+ ## Tech Stack & Conventions
283
+ - {{TECH_STACK_DETAILS}}
284
+
285
+ ### Code Style
286
+ - {{CONVENTION_1}}
287
+ - {{CONVENTION_2}}
288
+
289
+ ## How to Work
290
+ ### Khi nhận task:
291
+ 1. {{STEP_1}}
292
+ 2. {{STEP_2}}
293
+ 3. {{STEP_3}}
294
+
295
+ ## MCP Integration
296
+ - Context7: Dùng để tra cứu documentation (BẮT BUỘC)
297
+ - {{MCP_1}}: {{PURPOSE_1}}
298
+ - {{MCP_2}}: {{PURPOSE_2}}
299
+
300
+ ## Knowledge Base
301
+ - Đọc từ: `.claude/agents/{{AGENT_NAME}}/knowledge.md`
302
+ - Cập nhật qua: `/retrospect-work` skill
303
+ ```
304
+
305
+ ---
306
+
307
+ ## 🎨 How to Create New Variant
308
+
309
+ ### Step 1: Identify Variant Category
310
+
311
+ | Category | Description | Examples |
312
+ |----------|-------------|----------|
313
+ | `framework` | UI/Backend framework | react, vue, nestjs, fastapi |
314
+ | `styling` | CSS solution | tailwind, css-modules, styled-components |
315
+ | `state` | State management | zustand, redux, pinia |
316
+ | `data` | Data fetching | tanstack-query, swr, apollo |
317
+ | `testing` | Test framework | vitest, jest, playwright |
318
+ | `database` | Database type | postgresql, mongodb, mysql |
319
+ | `orm` | ORM tool | prisma, typeorm, sequelize |
320
+
321
+ ### Step 2: Create Variant Directory
322
+
323
+ ```bash
324
+ # For framework variant
325
+ mkdir -p roles/variants/dev-fe/svelte
326
+
327
+ # For styling variant
328
+ mkdir -p roles/variants/styling/css-modules
329
+
330
+ # For backend variant
331
+ mkdir -p roles/variants/dev-be/fastapi
332
+ ```
333
+
334
+ ### Step 3: Create Variant CLAUDE.md
335
+
336
+ ```bash
337
+ cat > roles/variants/dev-fe/svelte/CLAUDE.md.tmpl << 'EOF'
338
+ # Svelte Variant Additions
339
+
340
+ ## Additional Tech Stack
341
+ - Framework: Svelte/SvelteKit
342
+ - Build: Vite
343
+ - State: Svelte stores
344
+
345
+ ## Svelte-Specific Patterns
346
+
347
+ ### Component Structure
348
+ ```
349
+ src/lib/components/
350
+ ├── ComponentName.svelte
351
+ ├── ComponentName.test.ts
352
+ └── index.ts
353
+ ```
354
+
355
+ ### Best Practices
356
+ 1. Use SvelteKit for full-stack apps
357
+ 2. Leverage Svelte stores for state
358
+ 3. Use Svelte actions for DOM behavior
359
+ 4. Optimize with compiler directives
360
+
361
+ ## Skills to Install
362
+ - svelte-patterns
363
+ - sveltekit-routing
364
+ - testing-svelte
365
+ EOF
366
+ ```
367
+
368
+ ### Step 4: Create Variant Skills
369
+
370
+ ```bash
371
+ # Create skill directory
372
+ mkdir -p .claude/skills/variants/frameworks/svelte/svelte-patterns
373
+
374
+ # Create skill
375
+ cat > .claude/skills/variants/frameworks/svelte/svelte-patterns/SKILL.md << 'EOF'
376
+ ---
377
+ name: svelte-patterns
378
+ description: Svelte best practices and patterns
379
+ variant: svelte
380
+ ---
381
+
382
+ # Skill: Svelte Patterns
383
+
384
+ ## Core Principle
385
+ Leverage Svelte's reactivity and compiler.
386
+
387
+ ## When to Use
388
+ - Building Svelte components
389
+ - State management with stores
390
+ - SvelteKit routing
391
+
392
+ ## Patterns
393
+
394
+ ### Reactive Declarations
395
+ ```svelte
396
+ <script>
397
+ let count = 0;
398
+ $: doubled = count * 2;
399
+ </script>
400
+ ```
401
+
402
+ ### Stores
403
+ ```javascript
404
+ import { writable } from 'svelte/store';
405
+ export const count = writable(0);
406
+ ```
407
+
408
+ ### Actions
409
+ ```javascript
410
+ function clickOutside(node, callback) {
411
+ const handleClick = (event) => {
412
+ if (!node.contains(event.target)) callback();
413
+ };
414
+ document.addEventListener('click', handleClick);
415
+ return { destroy: () => document.removeEventListener('click', handleClick) };
416
+ }
417
+ ```
418
+ EOF
419
+ ```
420
+
421
+ ### Step 5: Update Variant Categories
422
+
423
+ ```bash
424
+ # Edit the variant categories configuration
425
+ # In scripts/setup/setup-agent.sh or config file
426
+
427
+ VARIANT_CATEGORIES["framework"]="react vue angular svelte vanilla"
428
+ ```
429
+
430
+ ### Step 6: Test the Variant
431
+
432
+ ```bash
433
+ # Create agent with new variant
434
+ ./agent.sh setup test-svelte dev-fe --framework svelte
435
+
436
+ # Verify
437
+ ./agent.sh check test-svelte --fix
438
+ ```
439
+
440
+ ---
441
+
442
+ ## 🛠️ How to Create New Skill
443
+
444
+ ### Step 1: Identify Skill Type
445
+
446
+ | Type | Directory | Purpose |
447
+ |------|-----------|---------|
448
+ | Base | `.claude/skills/base/` | Shared across all agents |
449
+ | Role | `.claude/skills/roles/{role}/` | Role-specific |
450
+ | Variant | `.claude/skills/variants/{category}/` | Tech-specific |
451
+ | Community | `.claude/skills/community/` | Copied from community |
452
+
453
+ ### Step 2: Create Skill Directory
454
+
455
+ ```bash
456
+ # Base skill (shared)
457
+ mkdir -p .claude/skills/base/api-documentation
458
+
459
+ # Role skill
460
+ mkdir -p .claude/skills/roles/dev-be/performance-optimization
461
+
462
+ # Variant skill
463
+ mkdir -p .claude/skills/variants/testing/cypress
464
+ ```
465
+
466
+ ### Step 3: Create SKILL.md
467
+
468
+ ```bash
469
+ cat > .claude/skills/base/api-documentation/SKILL.md << 'EOF'
470
+ ---
471
+ name: api-documentation
472
+ description: |
473
+ Generate comprehensive API documentation from code.
474
+ Creates OpenAPI/Swagger specs and markdown docs.
475
+ version: 1.0.0
476
+ category: documentation
477
+ tags:
478
+ - api
479
+ - documentation
480
+ - openapi
481
+ depends_on: []
482
+ ---
483
+
484
+ # Skill: API Documentation
485
+
486
+ ## Core Principle
487
+ Documentation should be generated from code, not written separately.
488
+
489
+ ## When to Use This Skill
490
+
491
+ ### Trigger Conditions
492
+ - New API endpoint created
493
+ - API contract changed
494
+ - Documentation update needed
495
+ - Onboarding new team members
496
+
497
+ ## Prerequisites
498
+ - Code has proper type annotations
499
+ - Route handlers are well-structured
500
+
501
+ ## Inputs
502
+ - `--format`: Output format (openapi, markdown, both)
503
+ - `--output`: Output directory (default: docs/api)
504
+
505
+ ## Steps
506
+
507
+ ### Step 1: Scan API Endpoints
508
+ Scan route files to identify endpoints.
509
+ - Extract route paths
510
+ - Extract HTTP methods
511
+ - Extract parameters
512
+
513
+ ### Step 2: Extract Type Information
514
+ Extract types from:
515
+ - Request bodies
516
+ - Response schemas
517
+ - Path/query parameters
518
+
519
+ ### Step 3: Generate OpenAPI Spec
520
+ Create OpenAPI 3.0 specification.
521
+ - Define paths
522
+ - Define schemas
523
+ - Add descriptions
524
+
525
+ ### Step 4: Generate Markdown Docs
526
+ Create human-readable documentation.
527
+ - Endpoint descriptions
528
+ - Request/response examples
529
+ - Authentication requirements
530
+
531
+ ### Step 5: Validate
532
+ Validate generated documentation.
533
+ - OpenAPI spec is valid
534
+ - All endpoints documented
535
+ - Examples are correct
536
+
537
+ ## Output
538
+ ```
539
+ docs/api/
540
+ ├── openapi.yaml
541
+ ├── endpoints.md
542
+ └── schemas/
543
+ └── *.md
544
+ ```
545
+
546
+ ## Rules
547
+ - ✅ Document all public endpoints
548
+ - ✅ Include request/response examples
549
+ - ✅ Document error responses
550
+ - ❌ Don't document internal endpoints
551
+ - ❌ Don't skip authentication docs
552
+
553
+ ## Example Usage
554
+ ```
555
+ /api-documentation --format both --output docs/api
556
+ ```
557
+ EOF
558
+ ```
559
+
560
+ ### Step 4: Add Reference Files (Optional)
561
+
562
+ ```bash
563
+ mkdir -p .claude/skills/base/api-documentation/references
564
+
565
+ cat > .claude/skills/base/api-documentation/references/openapi-template.md << 'EOF'
566
+ # OpenAPI Template
567
+
568
+ ## Basic Structure
569
+ ```yaml
570
+ openapi: 3.0.0
571
+ info:
572
+ title: API Title
573
+ version: 1.0.0
574
+ paths:
575
+ /endpoint:
576
+ get:
577
+ summary: Description
578
+ responses:
579
+ '200':
580
+ description: Success
581
+ ```
582
+
583
+ ## Common Patterns
584
+ - Authentication: Bearer token
585
+ - Pagination: cursor-based
586
+ - Errors: RFC 7807 Problem Details
587
+ EOF
588
+ ```
589
+
590
+ ### Step 5: Test the Skill
591
+
592
+ ```bash
593
+ # Test by invoking the skill
594
+ /api-documentation --format markdown --output test-docs
595
+
596
+ # Verify output
597
+ ls test-docs/
598
+ ```
599
+
600
+ ### Skill Template Format
601
+
602
+ ```markdown
603
+ ---
604
+ name: skill-name
605
+ description: |
606
+ Multi-line description of what the skill does.
607
+ Include when to use it.
608
+ version: 1.0.0
609
+ category: category-name
610
+ tags:
611
+ - tag1
612
+ - tag2
613
+ depends_on:
614
+ - prerequisite-skill
615
+ ---
616
+
617
+ # Skill: Skill Name
618
+
619
+ ## Core Principle
620
+ **One sentence that captures the essence.**
621
+
622
+ ## When to Use This Skill
623
+
624
+ ### Trigger Condition 1
625
+ - Situation A
626
+ - Situation B
627
+
628
+ ### Trigger Condition 2
629
+ - Situation C
630
+
631
+ ## Prerequisites
632
+ - Prerequisite 1
633
+ - Prerequisite 2
634
+
635
+ ## Inputs
636
+ - `input1`: Description (default: value)
637
+ - `input2`: Description (default: value)
638
+
639
+ ## Steps
640
+
641
+ ### Step 1: Step Name
642
+ Description of what to do.
643
+
644
+ ### Step 2: Step Name
645
+ Description of what to do.
646
+
647
+ ## Output
648
+ - Output 1
649
+ - Output 2
650
+
651
+ ## Rules
652
+ - ✅ What TO do
653
+ - ❌ What NOT to do
654
+
655
+ ## Example Usage
656
+ ```
657
+ /command --option value
658
+ ```
659
+ ```
660
+
661
+ ---
662
+
663
+ ## 🔄 How to Create New Workflow
664
+
665
+ ### Step 1: Define Workflow Purpose
666
+
667
+ - Workflow name và description
668
+ - Trigger conditions
669
+ - Roles involved
670
+ - Expected outputs
671
+
672
+ ### Step 2: Create Workflow File
673
+
674
+ ```bash
675
+ mkdir -p workflows
676
+
677
+ cat > workflows/database-migration.yaml << 'EOF'
678
+ name: Database Migration
679
+ description: Quy trình migrate database với safety checks
680
+ trigger: Manual hoặc khi có schema change
681
+
682
+ roles:
683
+ - dev-be
684
+ - tech-lead
685
+ - devops
686
+
687
+ phases:
688
+ - name: Planning
689
+ role: tech-lead
690
+ steps:
691
+ - name: analyze_changes
692
+ action: Phân tích schema changes
693
+ skills: [database-design]
694
+ output: migration-plan.md
695
+
696
+ - name: review_impact
697
+ action: Đánh giá impact
698
+ output: impact-analysis.md
699
+
700
+ - name: Implementation
701
+ role: dev-be
702
+ steps:
703
+ - name: create_migration
704
+ action: Tạo migration file
705
+ skills: [database-design]
706
+ output: migrations/*.sql
707
+
708
+ - name: write_rollback
709
+ action: Viết rollback script
710
+ output: rollbacks/*.sql
711
+
712
+ - name: write_tests
713
+ action: Viết migration tests
714
+ skills: [backend-testing]
715
+ output: tests/migration.test.ts
716
+
717
+ - name: Review
718
+ role: tech-lead
719
+ steps:
720
+ - name: review_migration
721
+ action: Review migration code
722
+ skills: [code-review]
723
+
724
+ - name: approve
725
+ action: Approve migration
726
+ requires_approval: true
727
+
728
+ - name: Execution
729
+ role: devops
730
+ steps:
731
+ - name: backup_database
732
+ action: Backup database
733
+ output: backup-{timestamp}.sql
734
+
735
+ - name: run_staging
736
+ action: Run on staging
737
+ mcp: [postgresql]
738
+
739
+ - name: verify_staging
740
+ action: Verify staging
741
+ skills: [database-design]
742
+
743
+ - name: run_production
744
+ action: Run on production
745
+ requires_approval: true
746
+ mcp: [postgresql]
747
+
748
+ - name: verify_production
749
+ action: Verify production
750
+
751
+ - name: Cleanup
752
+ role: devops
753
+ steps:
754
+ - name: update_docs
755
+ action: Update documentation
756
+ output: docs/database-schema.md
757
+
758
+ - name: notify_team
759
+ action: Notify team
760
+ skills: [internal-comms]
761
+ EOF
762
+ ```
763
+
764
+ ### Step 3: Create Workflow Command (Optional)
765
+
766
+ ```bash
767
+ mkdir -p .claude/commands/workflows
768
+
769
+ cat > .claude/commands/workflows/db-migrate.md << 'EOF'
770
+ ---
771
+ name: db-migrate
772
+ description: Run database migration workflow
773
+ ---
774
+
775
+ # Database Migration Workflow
776
+
777
+ ## Usage
778
+ /db-migrate [options]
779
+
780
+ ## Options
781
+ - `--dry-run`: Show plan without executing
782
+ - `--staging-only`: Run on staging only
783
+ - `--skip-backup`: Skip backup (not recommended)
784
+
785
+ ## Steps
786
+ 1. Load workflow from workflows/database-migration.yaml
787
+ 2. Execute phases in order
788
+ 3. Request approvals where needed
789
+ 4. Report results
790
+ EOF
791
+ ```
792
+
793
+ ### Step 4: Test the Workflow
794
+
795
+ ```bash
796
+ # Dry run
797
+ ./agent.sh run-workflow database-migration --dry-run
798
+
799
+ # Execute
800
+ ./agent.sh run-workflow database-migration
801
+ ```
802
+
803
+ ### Workflow Template Format
804
+
805
+ ```yaml
806
+ name: Workflow Name
807
+ description: Description of what this workflow does
808
+ trigger: Manual | Automatic condition
809
+
810
+ roles:
811
+ - role1
812
+ - role2
813
+
814
+ phases:
815
+ - name: Phase Name
816
+ role: responsible-role
817
+ parallel: false # Set true for parallel execution
818
+ steps:
819
+ - name: step_name
820
+ action: Description of action
821
+ skills: [skill1, skill2]
822
+ mcp: [mcp1]
823
+ output: output-file.md
824
+ requires_approval: false
825
+
826
+ - name: another_step
827
+ action: Another action
828
+ output: another-output.md
829
+
830
+ - name: Next Phase
831
+ role: another-role
832
+ steps:
833
+ - name: step
834
+ action: Action
835
+ ```
836
+
837
+ ---
838
+
839
+ ## 📜 How to Add New Rules
840
+
841
+ ### Step 1: Choose Rule Type
842
+
843
+ | Type | File | Applies To |
844
+ |------|------|------------|
845
+ | General | `.claude/rules/common/` | All agents |
846
+ | Role-specific | `.claude/rules/role-rules/` | Specific role |
847
+ | Language | `.claude/rules/languages/` | Specific language |
848
+
849
+ ### Step 2: Create General Rules
850
+
851
+ ```bash
852
+ mkdir -p .claude/rules/common
853
+
854
+ cat > .claude/rules/common/error-handling.md << 'EOF'
855
+ # Error Handling Rules
856
+
857
+ ## Applies To
858
+ - All agents
859
+ - All code types
860
+
861
+ ## Rules
862
+
863
+ ### 1. Always Handle Errors Explicitly
864
+ ```typescript
865
+ // ✅ Good
866
+ try {
867
+ await processData(data);
868
+ } catch (error) {
869
+ logger.error('Failed to process data', { error, data });
870
+ throw new ProcessingError('Data processing failed', { cause: error });
871
+ }
872
+
873
+ // ❌ Bad
874
+ try {
875
+ await processData(data);
876
+ } catch (e) {
877
+ // silent fail
878
+ }
879
+ ```
880
+
881
+ ### 2. Use Custom Error Types
882
+ ```typescript
883
+ class ValidationError extends Error {
884
+ constructor(message: string, public field: string) {
885
+ super(message);
886
+ this.name = 'ValidationError';
887
+ }
888
+ }
889
+ ```
890
+
891
+ ### 3. Log Meaningful Context
892
+ Always include:
893
+ - What operation failed
894
+ - Input that caused failure
895
+ - Error message
896
+ - Stack trace (in development)
897
+
898
+ ### 4. Provide Recovery Options
899
+ - Retry mechanism for transient errors
900
+ - Fallback for non-critical errors
901
+ - User-friendly error messages
902
+ EOF
903
+ ```
904
+
905
+ ### Step 3: Create Role-Specific Rules
906
+
907
+ ```bash
908
+ mkdir -p .claude/rules/role-rules
909
+
910
+ cat > .claude/rules/role-rules/dev-be-rules.md << 'EOF'
911
+ # dev-be Rules - Rules riêng cho Backend Developers
912
+
913
+ ## BE-Specific Rules
914
+
915
+ ### 1. API Design
916
+ - RESTful conventions
917
+ - Proper HTTP status codes
918
+ - Consistent error response format
919
+ - API versioning
920
+
921
+ ### 2. Database
922
+ - Use migrations for schema changes
923
+ - Index frequently queried fields
924
+ - Never use SELECT *
925
+ - Use connection pooling
926
+
927
+ ### 3. Security
928
+ - Validate all inputs
929
+ - Use parameterized queries
930
+ - Never log sensitive data
931
+ - Implement rate limiting
932
+
933
+ ### 4. Performance
934
+ - Implement caching strategy
935
+ - Use async operations
936
+ - Monitor query performance
937
+ - Set appropriate timeouts
938
+
939
+ ## Anti-Patterns to Avoid
940
+ - ❌ N+1 queries
941
+ - ❌ God services
942
+ - ❌ Hardcoded configuration
943
+ - ❌ Missing error handling
944
+ EOF
945
+ ```
946
+
947
+ ### Step 4: Create Language-Specific Rules
948
+
949
+ ```bash
950
+ mkdir -p .claude/rules/languages/typescript
951
+
952
+ cat > .claude/rules/languages/typescript/rules.md << 'EOF'
953
+ # TypeScript Rules
954
+
955
+ ## Type System
956
+ - Enable strict mode
957
+ - No `any` types in production code
958
+ - Use type inference where obvious
959
+ - Explicit types for public APIs
960
+
961
+ ## Naming Conventions
962
+ - PascalCase: types, interfaces, classes, enums
963
+ - camelCase: variables, functions, methods
964
+ - UPPER_SNAKE_CASE: constants
965
+
966
+ ## Code Organization
967
+ ```
968
+ src/
969
+ ├── types/ # Shared types
970
+ ├── utils/ # Utility functions
971
+ ├── services/ # Business logic
972
+ └── __tests__/ # Test files
973
+ ```
974
+
975
+ ## Import Order
976
+ 1. Node built-ins
977
+ 2. External packages
978
+ 3. Internal modules
979
+ 4. Relative imports
980
+ EOF
981
+ ```
982
+
983
+ ### Step 5: Update lessons.md
984
+
985
+ ```bash
986
+ cat > .claude/rules/lessons/lessons.md << 'EOF'
987
+ # Lessons Learned
988
+
989
+ ## Recent Lessons
990
+
991
+ ### 2025-02-25: Always verify Context7 docs
992
+ **What happened:** Implemented feature using outdated API
993
+ **Lesson:** Always use Context7 to fetch latest docs before implementing
994
+ **Rule added:** "Use Context7 before any API implementation"
995
+
996
+ ### 2025-02-24: N+1 Query in OrderService
997
+ **What happened:** Performance issue due to N+1 queries
998
+ **Lesson:** Use Prisma include for relations instead of separate queries
999
+ **Code:**
1000
+ ```typescript
1001
+ // Bad
1002
+ for (const order of orders) {
1003
+ order.items = await this.getItems(order.id);
1004
+ }
1005
+
1006
+ // Good
1007
+ const orders = await this.prisma.order.findMany({
1008
+ include: { items: true }
1009
+ });
1010
+ ```
1011
+
1012
+ ## Pattern Categories
1013
+
1014
+ ### Performance Patterns
1015
+ - Use database indexing
1016
+ - Implement caching
1017
+ - Batch operations
1018
+
1019
+ ### Security Patterns
1020
+ - Input validation
1021
+ - Parameterized queries
1022
+ - Rate limiting
1023
+
1024
+ ### Code Quality Patterns
1025
+ - Small functions
1026
+ - Single responsibility
1027
+ - Meaningful names
1028
+ EOF
1029
+ ```
1030
+
1031
+ ### Rules Template Format
1032
+
1033
+ ```markdown
1034
+ # [Category] Rules
1035
+
1036
+ ## Applies To
1037
+ - Agent types
1038
+ - Code types
1039
+ - Scenarios
1040
+
1041
+ ## Rules
1042
+
1043
+ ### 1. Rule Name
1044
+ Description of the rule.
1045
+
1046
+ ```language
1047
+ // ✅ Good example
1048
+ good_code_here();
1049
+
1050
+ // ❌ Bad example
1051
+ bad_code_here();
1052
+ ```
1053
+
1054
+ ### 2. Another Rule
1055
+ Description.
1056
+
1057
+ ## Anti-Patterns to Avoid
1058
+ - ❌ Anti-pattern 1
1059
+ - ❌ Anti-pattern 2
1060
+ ```
1061
+
1062
+ ---
1063
+
1064
+ ## 📐 Format Standards & Templates
1065
+
1066
+ ### File Naming Conventions
1067
+
1068
+ | Type | Pattern | Example |
1069
+ |------|---------|---------|
1070
+ | Role template | `CLAUDE.md.tmpl` | `roles/base/dev-fe/CLAUDE.md.tmpl` |
1071
+ | Skill | `SKILL.md` | `skills/base/code-review/SKILL.md` |
1072
+ | Workflow | `*.yaml` | `workflows/feature-development.yaml` |
1073
+ | Rules | `*.md` | `rules/common/coding-style.md` |
1074
+ | Config | `*.yaml` | `configs/agent.yaml` |
1075
+
1076
+ ### Directory Structure Standards
1077
+
1078
+ ```
1079
+ agent-team-template/
1080
+ ├── roles/
1081
+ │ ├── base/{role}/
1082
+ │ │ └── CLAUDE.md.tmpl
1083
+ │ └── variants/{role}/{variant}/
1084
+ │ └── CLAUDE.md.tmpl
1085
+
1086
+ ├── .claude/
1087
+ │ ├── skills/
1088
+ │ │ ├── {type}/{category}/{skill}/
1089
+ │ │ │ ├── SKILL.md
1090
+ │ │ │ └── references/
1091
+ │ │ └── ...
1092
+ │ └── rules/
1093
+ │ ├── common/
1094
+ │ ├── role-rules/
1095
+ │ ├── languages/
1096
+ │ └── lessons/
1097
+
1098
+ ├── workflows/
1099
+ │ └── {workflow-name}.yaml
1100
+
1101
+ └── presets/
1102
+ └── {preset-name}.yaml
1103
+ ```
1104
+
1105
+ ### YAML Configuration Standards
1106
+
1107
+ ```yaml
1108
+ # Standard config structure
1109
+ agent:
1110
+ name: string
1111
+ role: string
1112
+ description: string (optional)
1113
+
1114
+ variants:
1115
+ category: value
1116
+
1117
+ model:
1118
+ default: string
1119
+ thinking_mode: boolean
1120
+ thinking_tasks: array (optional)
1121
+
1122
+ skills:
1123
+ - name: string
1124
+ path: string (optional)
1125
+ strategy: copy|link|reference (optional)
1126
+
1127
+ mcp:
1128
+ - string
1129
+
1130
+ knowledge:
1131
+ import_from: string (optional)
1132
+ ```
1133
+
1134
+ ---
1135
+
1136
+ ## ⚠️ Common Mistakes to Avoid
1137
+
1138
+ ### 1. Creating Skills Without Clear Purpose
1139
+
1140
+ ```
1141
+ ❌ Bad: Creating a skill that's too broad
1142
+ "frontend-skill" - Does everything
1143
+
1144
+ ✅ Good: Focused, single responsibility
1145
+ "form-validation" - Only handles form validation
1146
+ "scaffold-react-page" - Only scaffolds pages
1147
+ ```
1148
+
1149
+ ### 2. Duplicating Existing Skills
1150
+
1151
+ ```
1152
+ ❌ Bad: Creating "my-react-patterns" when "react-best-practices" exists
1153
+
1154
+ ✅ Good: Extend or reference existing skills
1155
+ - Reference: Use existing skill
1156
+ - Extend: Create focused addition
1157
+ ```
1158
+
1159
+ ### 3. Missing Dependencies
1160
+
1161
+ ```markdown
1162
+ ❌ Bad:
1163
+ depends_on: []
1164
+
1165
+ ✅ Good:
1166
+ depends_on:
1167
+ - frontend-design
1168
+ - react-best-practices
1169
+ ```
1170
+
1171
+ ### 4. Not Testing New Components
1172
+
1173
+ ```
1174
+ ❌ Bad: Creating and immediately using
1175
+
1176
+ ✅ Good:
1177
+ 1. Create component
1178
+ 2. Test in isolation
1179
+ 3. Verify with ./agent.sh check
1180
+ 4. Use in production
1181
+ ```
1182
+
1183
+ ### 5. Over-Engineering Workflows
1184
+
1185
+ ```yaml
1186
+ ❌ Bad: Workflow with 20 phases and 50 steps
1187
+
1188
+ ✅ Good: Focused workflow with clear phases
1189
+ phases:
1190
+ - name: Plan
1191
+ - name: Implement
1192
+ - name: Review
1193
+ ```
1194
+
1195
+ ### 6. Missing Documentation
1196
+
1197
+ ```
1198
+ ❌ Bad: Skill without description or examples
1199
+
1200
+ ✅ Good:
1201
+ - Clear description
1202
+ - When to use
1203
+ - Examples
1204
+ - Rules
1205
+ ```
1206
+
1207
+ ### 7. Ignoring Rules System
1208
+
1209
+ ```
1210
+ ❌ Bad: Hardcoding patterns in skills
1211
+
1212
+ ✅ Good:
1213
+ - Extract patterns to rules
1214
+ - Reference rules in skills
1215
+ - Update lessons.md with learnings
1216
+ ```
1217
+
1218
+ ---
1219
+
1220
+ ## 📚 Related Documentation
1221
+
1222
+ - [Architecture](01-architecture.md) - System architecture
1223
+ - [Setup Guide](02-setup-guide.md) - Setup instructions
1224
+ - [Skills Guide](03-skills-guide.md) - Managing skills
1225
+ - [Workflows](04-workflows.md) - Workflow orchestration
1226
+ - [Quick Reference](07-quick-reference.md) - Cheat sheet