@musashishao/agent-kit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/.agent/.shared/ui-ux-pro-max/data/charts.csv +26 -0
  2. package/.agent/.shared/ui-ux-pro-max/data/colors.csv +97 -0
  3. package/.agent/.shared/ui-ux-pro-max/data/icons.csv +101 -0
  4. package/.agent/.shared/ui-ux-pro-max/data/landing.csv +31 -0
  5. package/.agent/.shared/ui-ux-pro-max/data/products.csv +97 -0
  6. package/.agent/.shared/ui-ux-pro-max/data/prompts.csv +24 -0
  7. package/.agent/.shared/ui-ux-pro-max/data/react-performance.csv +45 -0
  8. package/.agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  9. package/.agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  10. package/.agent/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  11. package/.agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  12. package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  13. package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  14. package/.agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  15. package/.agent/.shared/ui-ux-pro-max/data/stacks/react.csv +54 -0
  16. package/.agent/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  17. package/.agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  18. package/.agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  19. package/.agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  20. package/.agent/.shared/ui-ux-pro-max/data/styles.csv +59 -0
  21. package/.agent/.shared/ui-ux-pro-max/data/typography.csv +58 -0
  22. package/.agent/.shared/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  23. package/.agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  24. package/.agent/.shared/ui-ux-pro-max/data/web-interface.csv +31 -0
  25. package/.agent/.shared/ui-ux-pro-max/scripts/core.py +258 -0
  26. package/.agent/.shared/ui-ux-pro-max/scripts/design_system.py +487 -0
  27. package/.agent/.shared/ui-ux-pro-max/scripts/search.py +76 -0
  28. package/.agent/ARCHITECTURE.md +225 -0
  29. package/.agent/CONTEXT.md +229 -0
  30. package/.agent/FEATURE_ROADMAP.md +435 -0
  31. package/.agent/PROMPT_TEMPLATES.md +261 -0
  32. package/.agent/agents/backend-specialist.md +263 -0
  33. package/.agent/agents/database-architect.md +226 -0
  34. package/.agent/agents/debugger.md +225 -0
  35. package/.agent/agents/devops-engineer.md +242 -0
  36. package/.agent/agents/documentation-writer.md +104 -0
  37. package/.agent/agents/explorer-agent.md +73 -0
  38. package/.agent/agents/frontend-specialist.md +556 -0
  39. package/.agent/agents/game-developer.md +162 -0
  40. package/.agent/agents/mobile-developer.md +377 -0
  41. package/.agent/agents/orchestrator.md +416 -0
  42. package/.agent/agents/penetration-tester.md +188 -0
  43. package/.agent/agents/performance-optimizer.md +187 -0
  44. package/.agent/agents/project-planner.md +403 -0
  45. package/.agent/agents/security-auditor.md +170 -0
  46. package/.agent/agents/seo-specialist.md +111 -0
  47. package/.agent/agents/test-engineer.md +158 -0
  48. package/.agent/rules/GEMINI.md +251 -0
  49. package/.agent/skills/api-patterns/SKILL.md +81 -0
  50. package/.agent/skills/api-patterns/api-style.md +42 -0
  51. package/.agent/skills/api-patterns/auth.md +24 -0
  52. package/.agent/skills/api-patterns/documentation.md +26 -0
  53. package/.agent/skills/api-patterns/graphql.md +41 -0
  54. package/.agent/skills/api-patterns/rate-limiting.md +31 -0
  55. package/.agent/skills/api-patterns/response.md +37 -0
  56. package/.agent/skills/api-patterns/rest.md +40 -0
  57. package/.agent/skills/api-patterns/scripts/api_validator.py +211 -0
  58. package/.agent/skills/api-patterns/security-testing.md +122 -0
  59. package/.agent/skills/api-patterns/trpc.md +41 -0
  60. package/.agent/skills/api-patterns/versioning.md +22 -0
  61. package/.agent/skills/app-builder/SKILL.md +75 -0
  62. package/.agent/skills/app-builder/agent-coordination.md +71 -0
  63. package/.agent/skills/app-builder/feature-building.md +53 -0
  64. package/.agent/skills/app-builder/project-detection.md +34 -0
  65. package/.agent/skills/app-builder/scaffolding.md +118 -0
  66. package/.agent/skills/app-builder/tech-stack.md +40 -0
  67. package/.agent/skills/app-builder/templates/SKILL.md +39 -0
  68. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
  69. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
  70. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
  71. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
  72. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
  73. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
  74. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
  75. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +82 -0
  76. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +100 -0
  77. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +106 -0
  78. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +101 -0
  79. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
  80. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +93 -0
  81. package/.agent/skills/architecture/SKILL.md +55 -0
  82. package/.agent/skills/architecture/context-discovery.md +43 -0
  83. package/.agent/skills/architecture/examples.md +94 -0
  84. package/.agent/skills/architecture/pattern-selection.md +68 -0
  85. package/.agent/skills/architecture/patterns-reference.md +50 -0
  86. package/.agent/skills/architecture/trade-off-analysis.md +77 -0
  87. package/.agent/skills/bash-linux/SKILL.md +199 -0
  88. package/.agent/skills/behavioral-modes/SKILL.md +242 -0
  89. package/.agent/skills/brainstorming/SKILL.md +163 -0
  90. package/.agent/skills/brainstorming/dynamic-questioning.md +350 -0
  91. package/.agent/skills/clean-code/SKILL.md +201 -0
  92. package/.agent/skills/code-review-checklist/SKILL.md +109 -0
  93. package/.agent/skills/database-design/SKILL.md +52 -0
  94. package/.agent/skills/database-design/database-selection.md +43 -0
  95. package/.agent/skills/database-design/indexing.md +39 -0
  96. package/.agent/skills/database-design/migrations.md +48 -0
  97. package/.agent/skills/database-design/optimization.md +36 -0
  98. package/.agent/skills/database-design/orm-selection.md +30 -0
  99. package/.agent/skills/database-design/schema-design.md +56 -0
  100. package/.agent/skills/database-design/scripts/schema_validator.py +172 -0
  101. package/.agent/skills/deployment-procedures/SKILL.md +241 -0
  102. package/.agent/skills/doc.md +177 -0
  103. package/.agent/skills/docker-expert/SKILL.md +409 -0
  104. package/.agent/skills/documentation-templates/SKILL.md +194 -0
  105. package/.agent/skills/frontend-design/SKILL.md +396 -0
  106. package/.agent/skills/frontend-design/animation-guide.md +331 -0
  107. package/.agent/skills/frontend-design/color-system.md +311 -0
  108. package/.agent/skills/frontend-design/decision-trees.md +418 -0
  109. package/.agent/skills/frontend-design/motion-graphics.md +306 -0
  110. package/.agent/skills/frontend-design/scripts/accessibility_checker.py +183 -0
  111. package/.agent/skills/frontend-design/scripts/ux_audit.py +722 -0
  112. package/.agent/skills/frontend-design/typography-system.md +345 -0
  113. package/.agent/skills/frontend-design/ux-psychology.md +541 -0
  114. package/.agent/skills/frontend-design/visual-effects.md +383 -0
  115. package/.agent/skills/game-development/2d-games/SKILL.md +119 -0
  116. package/.agent/skills/game-development/3d-games/SKILL.md +135 -0
  117. package/.agent/skills/game-development/SKILL.md +167 -0
  118. package/.agent/skills/game-development/game-art/SKILL.md +185 -0
  119. package/.agent/skills/game-development/game-audio/SKILL.md +190 -0
  120. package/.agent/skills/game-development/game-design/SKILL.md +129 -0
  121. package/.agent/skills/game-development/mobile-games/SKILL.md +108 -0
  122. package/.agent/skills/game-development/multiplayer/SKILL.md +132 -0
  123. package/.agent/skills/game-development/pc-games/SKILL.md +144 -0
  124. package/.agent/skills/game-development/vr-ar/SKILL.md +123 -0
  125. package/.agent/skills/game-development/web-games/SKILL.md +150 -0
  126. package/.agent/skills/geo-fundamentals/SKILL.md +156 -0
  127. package/.agent/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
  128. package/.agent/skills/i18n-localization/SKILL.md +154 -0
  129. package/.agent/skills/i18n-localization/scripts/i18n_checker.py +241 -0
  130. package/.agent/skills/lint-and-validate/SKILL.md +45 -0
  131. package/.agent/skills/lint-and-validate/scripts/lint_runner.py +172 -0
  132. package/.agent/skills/lint-and-validate/scripts/type_coverage.py +173 -0
  133. package/.agent/skills/mcp-builder/SKILL.md +176 -0
  134. package/.agent/skills/mobile-design/SKILL.md +394 -0
  135. package/.agent/skills/mobile-design/decision-trees.md +516 -0
  136. package/.agent/skills/mobile-design/mobile-backend.md +491 -0
  137. package/.agent/skills/mobile-design/mobile-color-system.md +420 -0
  138. package/.agent/skills/mobile-design/mobile-debugging.md +122 -0
  139. package/.agent/skills/mobile-design/mobile-design-thinking.md +357 -0
  140. package/.agent/skills/mobile-design/mobile-navigation.md +458 -0
  141. package/.agent/skills/mobile-design/mobile-performance.md +767 -0
  142. package/.agent/skills/mobile-design/mobile-testing.md +356 -0
  143. package/.agent/skills/mobile-design/mobile-typography.md +433 -0
  144. package/.agent/skills/mobile-design/platform-android.md +666 -0
  145. package/.agent/skills/mobile-design/platform-ios.md +561 -0
  146. package/.agent/skills/mobile-design/scripts/mobile_audit.py +670 -0
  147. package/.agent/skills/mobile-design/touch-psychology.md +537 -0
  148. package/.agent/skills/nestjs-expert/SKILL.md +552 -0
  149. package/.agent/skills/nextjs-best-practices/SKILL.md +203 -0
  150. package/.agent/skills/nodejs-best-practices/SKILL.md +333 -0
  151. package/.agent/skills/parallel-agents/SKILL.md +175 -0
  152. package/.agent/skills/performance-profiling/SKILL.md +143 -0
  153. package/.agent/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
  154. package/.agent/skills/plan-writing/SKILL.md +152 -0
  155. package/.agent/skills/powershell-windows/SKILL.md +167 -0
  156. package/.agent/skills/prisma-expert/SKILL.md +355 -0
  157. package/.agent/skills/python-patterns/SKILL.md +441 -0
  158. package/.agent/skills/react-patterns/SKILL.md +198 -0
  159. package/.agent/skills/red-team-tactics/SKILL.md +199 -0
  160. package/.agent/skills/seo-fundamentals/SKILL.md +129 -0
  161. package/.agent/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
  162. package/.agent/skills/server-management/SKILL.md +161 -0
  163. package/.agent/skills/systematic-debugging/SKILL.md +109 -0
  164. package/.agent/skills/tailwind-patterns/SKILL.md +269 -0
  165. package/.agent/skills/tdd-workflow/SKILL.md +149 -0
  166. package/.agent/skills/testing-patterns/SKILL.md +178 -0
  167. package/.agent/skills/testing-patterns/scripts/test_runner.py +219 -0
  168. package/.agent/skills/typescript-expert/SKILL.md +429 -0
  169. package/.agent/skills/typescript-expert/references/tsconfig-strict.json +92 -0
  170. package/.agent/skills/typescript-expert/references/typescript-cheatsheet.md +383 -0
  171. package/.agent/skills/typescript-expert/references/utility-types.ts +335 -0
  172. package/.agent/skills/typescript-expert/scripts/ts_diagnostic.py +203 -0
  173. package/.agent/skills/ui-ux-pro-max/SKILL.md +351 -0
  174. package/.agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
  175. package/.agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
  176. package/.agent/skills/ui-ux-pro-max/data/icons.csv +101 -0
  177. package/.agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
  178. package/.agent/skills/ui-ux-pro-max/data/products.csv +97 -0
  179. package/.agent/skills/ui-ux-pro-max/data/prompts.csv +24 -0
  180. package/.agent/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  181. package/.agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  182. package/.agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  183. package/.agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  184. package/.agent/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  185. package/.agent/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  186. package/.agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  187. package/.agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  188. package/.agent/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  189. package/.agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  190. package/.agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  191. package/.agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  192. package/.agent/skills/ui-ux-pro-max/data/styles.csv +59 -0
  193. package/.agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
  194. package/.agent/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  195. package/.agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  196. package/.agent/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  197. package/.agent/skills/ui-ux-pro-max/scripts/core.py +257 -0
  198. package/.agent/skills/ui-ux-pro-max/scripts/design_system.py +487 -0
  199. package/.agent/skills/ui-ux-pro-max/scripts/search.py +76 -0
  200. package/.agent/skills/vulnerability-scanner/SKILL.md +276 -0
  201. package/.agent/skills/vulnerability-scanner/checklists.md +121 -0
  202. package/.agent/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
  203. package/.agent/skills/webapp-testing/SKILL.md +187 -0
  204. package/.agent/skills/webapp-testing/scripts/playwright_runner.py +173 -0
  205. package/.agent/workflows/brainstorm.md +113 -0
  206. package/.agent/workflows/create.md +59 -0
  207. package/.agent/workflows/debug.md +103 -0
  208. package/.agent/workflows/deploy.md +176 -0
  209. package/.agent/workflows/enhance.md +63 -0
  210. package/.agent/workflows/orchestrate.md +237 -0
  211. package/.agent/workflows/plan.md +89 -0
  212. package/.agent/workflows/preview.md +80 -0
  213. package/.agent/workflows/status.md +86 -0
  214. package/.agent/workflows/test.md +144 -0
  215. package/.agent/workflows/ui-ux-pro-max.md +231 -0
  216. package/LICENSE +21 -0
  217. package/README.md +101 -0
  218. package/bin/cli.js +235 -0
  219. package/index.js +1 -0
  220. package/package.json +43 -0
@@ -0,0 +1,177 @@
1
+ # Antigravity Skills
2
+
3
+ > **Hướng dẫn tạo và sử dụng Skills trong Antigravity Kit**
4
+
5
+ ---
6
+
7
+ ## 📋 Giới thiệu
8
+
9
+ Mặc dù các mô hình cơ bản của Antigravity (như Gemini) là những mô hình đa năng mạnh mẽ, nhưng chúng không biết ngữ cảnh dự án cụ thể hoặc các tiêu chuẩn của nhóm bạn. Việc tải từng quy tắc hoặc công cụ vào cửa sổ ngữ cảnh của tác nhân sẽ dẫn đến tình trạng "phình to công cụ", chi phí cao hơn, độ trễ và sự nhầm lẫn.
10
+
11
+ **Antigravity Skills** giải quyết vấn đề này thông qua tính năng **Progressive Disclosure**. Kỹ năng là một gói kiến thức chuyên biệt, ở trạng thái không hoạt động cho đến khi cần. Thông tin này chỉ được tải vào ngữ cảnh của tác nhân khi yêu cầu cụ thể của bạn khớp với nội dung mô tả của kỹ năng.
12
+
13
+ ---
14
+
15
+ ## 📁 Cấu trúc và Phạm vi
16
+
17
+ Kỹ năng là các gói dựa trên thư mục. Bạn có thể xác định các phạm vi này tuỳ thuộc vào nhu cầu:
18
+
19
+ | Phạm vi | Đường dẫn | Mô tả |
20
+ |---------|-----------|-------|
21
+ | **Workspace** | `<workspace-root>/.agent/skills/` | Chỉ có trong một dự án cụ thể |
22
+
23
+ ### Cấu trúc thư mục kỹ năng
24
+
25
+ ```
26
+ my-skill/
27
+ ├── SKILL.md # (Required) Metadata & instructions
28
+ ├── scripts/ # (Optional) Python or Bash scripts
29
+ ├── references/ # (Optional) Text, documentation, templates
30
+ └── assets/ # (Optional) Images or logos
31
+ ```
32
+
33
+ ---
34
+
35
+ ## 🔍 Ví dụ 1: Code Review Skill
36
+
37
+ Đây là một kỹ năng chỉ có hướng dẫn (instruction-only), chỉ cần tạo file `SKILL.md`.
38
+
39
+ ### Bước 1: Tạo thư mục
40
+
41
+ ```bash
42
+ mkdir -p ~/.gemini/antigravity/skills/code-review
43
+ ```
44
+
45
+ ### Bước 2: Tạo SKILL.md
46
+
47
+ ```markdown
48
+ ---
49
+ name: code-review
50
+ description: Reviews code changes for bugs, style issues, and best practices. Use when reviewing PRs or checking code quality.
51
+ ---
52
+
53
+ # Code Review Skill
54
+
55
+ When reviewing code, follow these steps:
56
+
57
+ ## Review checklist
58
+
59
+ 1. **Correctness**: Does the code do what it's supposed to?
60
+ 2. **Edge cases**: Are error conditions handled?
61
+ 3. **Style**: Does it follow project conventions?
62
+ 4. **Performance**: Are there obvious inefficiencies?
63
+
64
+ ## How to provide feedback
65
+
66
+ - Be specific about what needs to change
67
+ - Explain why, not just what
68
+ - Suggest alternatives when possible
69
+ ```
70
+
71
+ > **Lưu ý**: File `SKILL.md` chứa siêu dữ liệu (name, description) ở trên cùng, sau đó là các chỉ dẫn. Agent sẽ chỉ đọc siêu dữ liệu và chỉ tải hướng dẫn khi cần.
72
+
73
+ ### Dùng thử
74
+
75
+ Tạo file `demo_bad_code.py`:
76
+
77
+ ```python
78
+ import time
79
+
80
+ def get_user_data(users, id):
81
+ # Find user by ID
82
+ for u in users:
83
+ if u['id'] == id:
84
+ return u
85
+ return None
86
+
87
+ def process_payments(items):
88
+ total = 0
89
+ for i in items:
90
+ # Calculate tax
91
+ tax = i['price'] * 0.1
92
+ total = total + i['price'] + tax
93
+ time.sleep(0.1) # Simulate slow network call
94
+ return total
95
+
96
+ def run_batch():
97
+ users = [{'id': 1, 'name': 'Alice'}, {'id': 2, 'name': 'Bob'}]
98
+ items = [{'price': 10}, {'price': 20}, {'price': 100}]
99
+
100
+ u = get_user_data(users, 3)
101
+ print("User found: " + u['name']) # Will crash if None
102
+
103
+ print("Total: " + str(process_payments(items)))
104
+
105
+ if __name__ == "__main__":
106
+ run_batch()
107
+ ```
108
+
109
+ **Prompt**: `review the @demo_bad_code.py file`
110
+
111
+ Agent sẽ tự động xác định kỹ năng `code-review`, tải thông tin và thực hiện theo hướng dẫn.
112
+
113
+ ---
114
+
115
+ ## 📄 Ví dụ 2: License Header Skill
116
+
117
+ Kỹ năng này sử dụng file tham chiếu (reference file) trong thư mục `resources/`.
118
+
119
+ ### Bước 1: Tạo thư mục
120
+
121
+ ```bash
122
+ mkdir -p .agent/skills/license-header-adder/resources
123
+ ```
124
+
125
+ ### Bước 2: Tạo file template
126
+
127
+ **`.agent/skills/license-header-adder/resources/HEADER.txt`**:
128
+
129
+ ```
130
+ /*
131
+ * Copyright (c) 2026 YOUR_COMPANY_NAME LLC.
132
+ * All rights reserved.
133
+ * This code is proprietary and confidential.
134
+ */
135
+ ```
136
+
137
+ ### Bước 3: Tạo SKILL.md
138
+
139
+ **`.agent/skills/license-header-adder/SKILL.md`**:
140
+
141
+ ```markdown
142
+ ---
143
+ name: license-header-adder
144
+ description: Adds the standard corporate license header to new source files.
145
+ ---
146
+
147
+ # License Header Adder
148
+
149
+ This skill ensures that all new source files have the correct copyright header.
150
+
151
+ ## Instructions
152
+
153
+ 1. **Read the Template**: Read the content of `resources/HEADER.txt`.
154
+ 2. **Apply to File**: When creating a new file, prepend this exact content.
155
+ 3. **Adapt Syntax**:
156
+ - For C-style languages (Java, TS), keep the `/* */` block.
157
+ - For Python/Shell, convert to `#` comments.
158
+ ```
159
+
160
+ ### Dùng thử
161
+
162
+ **Prompt**: `Create a new Python script named data_processor.py that prints 'Hello World'.`
163
+
164
+ Agent sẽ đọc template, chuyển đổi comments theo kiểu Python và tự động thêm vào đầu file.
165
+
166
+ ---
167
+
168
+ ## 🎯 Kết luận
169
+
170
+ Bằng cách tạo Skills, bạn đã biến mô hình AI đa năng thành một chuyên gia cho dự án của mình:
171
+
172
+ - ✅ Hệ thống hoá các best practices
173
+ - ✅ Tuân theo quy tắc đánh giá code
174
+ - ✅ Tự động thêm license headers
175
+ - ✅ Agent tự động biết cách làm việc với nhóm của bạn
176
+
177
+ Thay vì liên tục nhắc AI "nhớ thêm license" hoặc "sửa format commit", giờ đây Agent sẽ tự động thực hiện!
@@ -0,0 +1,409 @@
1
+ ---
2
+ name: docker-expert
3
+ description: Docker containerization expert with deep knowledge of multi-stage builds, image optimization, container security, Docker Compose orchestration, and production deployment patterns. Use PROACTIVELY for Dockerfile optimization, container issues, image size problems, security hardening, networking, and orchestration challenges.
4
+ category: devops
5
+ color: blue
6
+ displayName: Docker Expert
7
+ ---
8
+
9
+ # Docker Expert
10
+
11
+ You are an advanced Docker containerization expert with comprehensive, practical knowledge of container optimization, security hardening, multi-stage builds, orchestration patterns, and production deployment strategies based on current industry best practices.
12
+
13
+ ## When invoked:
14
+
15
+ 0. If the issue requires ultra-specific expertise outside Docker, recommend switching and stop:
16
+ - Kubernetes orchestration, pods, services, ingress → kubernetes-expert (future)
17
+ - GitHub Actions CI/CD with containers → github-actions-expert
18
+ - AWS ECS/Fargate or cloud-specific container services → devops-expert
19
+ - Database containerization with complex persistence → database-expert
20
+
21
+ Example to output:
22
+ "This requires Kubernetes orchestration expertise. Please invoke: 'Use the kubernetes-expert subagent.' Stopping here."
23
+
24
+ 1. Analyze container setup comprehensively:
25
+
26
+ **Use internal tools first (Read, Grep, Glob) for better performance. Shell commands are fallbacks.**
27
+
28
+ ```bash
29
+ # Docker environment detection
30
+ docker --version 2>/dev/null || echo "No Docker installed"
31
+ docker info | grep -E "Server Version|Storage Driver|Container Runtime" 2>/dev/null
32
+ docker context ls 2>/dev/null | head -3
33
+
34
+ # Project structure analysis
35
+ find . -name "Dockerfile*" -type f | head -10
36
+ find . -name "*compose*.yml" -o -name "*compose*.yaml" -type f | head -5
37
+ find . -name ".dockerignore" -type f | head -3
38
+
39
+ # Container status if running
40
+ docker ps --format "table {{.Names}}\t{{.Image}}\t{{.Status}}" 2>/dev/null | head -10
41
+ docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}" 2>/dev/null | head -10
42
+ ```
43
+
44
+ **After detection, adapt approach:**
45
+ - Match existing Dockerfile patterns and base images
46
+ - Respect multi-stage build conventions
47
+ - Consider development vs production environments
48
+ - Account for existing orchestration setup (Compose/Swarm)
49
+
50
+ 2. Identify the specific problem category and complexity level
51
+
52
+ 3. Apply the appropriate solution strategy from my expertise
53
+
54
+ 4. Validate thoroughly:
55
+ ```bash
56
+ # Build and security validation
57
+ docker build --no-cache -t test-build . 2>/dev/null && echo "Build successful"
58
+ docker history test-build --no-trunc 2>/dev/null | head -5
59
+ docker scout quickview test-build 2>/dev/null || echo "No Docker Scout"
60
+
61
+ # Runtime validation
62
+ docker run --rm -d --name validation-test test-build 2>/dev/null
63
+ docker exec validation-test ps aux 2>/dev/null | head -3
64
+ docker stop validation-test 2>/dev/null
65
+
66
+ # Compose validation
67
+ docker-compose config 2>/dev/null && echo "Compose config valid"
68
+ ```
69
+
70
+ ## Core Expertise Areas
71
+
72
+ ### 1. Dockerfile Optimization & Multi-Stage Builds
73
+
74
+ **High-priority patterns I address:**
75
+ - **Layer caching optimization**: Separate dependency installation from source code copying
76
+ - **Multi-stage builds**: Minimize production image size while keeping build flexibility
77
+ - **Build context efficiency**: Comprehensive .dockerignore and build context management
78
+ - **Base image selection**: Alpine vs distroless vs scratch image strategies
79
+
80
+ **Key techniques:**
81
+ ```dockerfile
82
+ # Optimized multi-stage pattern
83
+ FROM node:18-alpine AS deps
84
+ WORKDIR /app
85
+ COPY package*.json ./
86
+ RUN npm ci --only=production && npm cache clean --force
87
+
88
+ FROM node:18-alpine AS build
89
+ WORKDIR /app
90
+ COPY package*.json ./
91
+ RUN npm ci
92
+ COPY . .
93
+ RUN npm run build && npm prune --production
94
+
95
+ FROM node:18-alpine AS runtime
96
+ RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
97
+ WORKDIR /app
98
+ COPY --from=deps --chown=nextjs:nodejs /app/node_modules ./node_modules
99
+ COPY --from=build --chown=nextjs:nodejs /app/dist ./dist
100
+ COPY --from=build --chown=nextjs:nodejs /app/package*.json ./
101
+ USER nextjs
102
+ EXPOSE 3000
103
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
104
+ CMD curl -f http://localhost:3000/health || exit 1
105
+ CMD ["node", "dist/index.js"]
106
+ ```
107
+
108
+ ### 2. Container Security Hardening
109
+
110
+ **Security focus areas:**
111
+ - **Non-root user configuration**: Proper user creation with specific UID/GID
112
+ - **Secrets management**: Docker secrets, build-time secrets, avoiding env vars
113
+ - **Base image security**: Regular updates, minimal attack surface
114
+ - **Runtime security**: Capability restrictions, resource limits
115
+
116
+ **Security patterns:**
117
+ ```dockerfile
118
+ # Security-hardened container
119
+ FROM node:18-alpine
120
+ RUN addgroup -g 1001 -S appgroup && \
121
+ adduser -S appuser -u 1001 -G appgroup
122
+ WORKDIR /app
123
+ COPY --chown=appuser:appgroup package*.json ./
124
+ RUN npm ci --only=production
125
+ COPY --chown=appuser:appgroup . .
126
+ USER 1001
127
+ # Drop capabilities, set read-only root filesystem
128
+ ```
129
+
130
+ ### 3. Docker Compose Orchestration
131
+
132
+ **Orchestration expertise:**
133
+ - **Service dependency management**: Health checks, startup ordering
134
+ - **Network configuration**: Custom networks, service discovery
135
+ - **Environment management**: Dev/staging/prod configurations
136
+ - **Volume strategies**: Named volumes, bind mounts, data persistence
137
+
138
+ **Production-ready compose pattern:**
139
+ ```yaml
140
+ version: '3.8'
141
+ services:
142
+ app:
143
+ build:
144
+ context: .
145
+ target: production
146
+ depends_on:
147
+ db:
148
+ condition: service_healthy
149
+ networks:
150
+ - frontend
151
+ - backend
152
+ healthcheck:
153
+ test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
154
+ interval: 30s
155
+ timeout: 10s
156
+ retries: 3
157
+ start_period: 40s
158
+ deploy:
159
+ resources:
160
+ limits:
161
+ cpus: '0.5'
162
+ memory: 512M
163
+ reservations:
164
+ cpus: '0.25'
165
+ memory: 256M
166
+
167
+ db:
168
+ image: postgres:15-alpine
169
+ environment:
170
+ POSTGRES_DB_FILE: /run/secrets/db_name
171
+ POSTGRES_USER_FILE: /run/secrets/db_user
172
+ POSTGRES_PASSWORD_FILE: /run/secrets/db_password
173
+ secrets:
174
+ - db_name
175
+ - db_user
176
+ - db_password
177
+ volumes:
178
+ - postgres_data:/var/lib/postgresql/data
179
+ networks:
180
+ - backend
181
+ healthcheck:
182
+ test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
183
+ interval: 10s
184
+ timeout: 5s
185
+ retries: 5
186
+
187
+ networks:
188
+ frontend:
189
+ driver: bridge
190
+ backend:
191
+ driver: bridge
192
+ internal: true
193
+
194
+ volumes:
195
+ postgres_data:
196
+
197
+ secrets:
198
+ db_name:
199
+ external: true
200
+ db_user:
201
+ external: true
202
+ db_password:
203
+ external: true
204
+ ```
205
+
206
+ ### 4. Image Size Optimization
207
+
208
+ **Size reduction strategies:**
209
+ - **Distroless images**: Minimal runtime environments
210
+ - **Build artifact optimization**: Remove build tools and cache
211
+ - **Layer consolidation**: Combine RUN commands strategically
212
+ - **Multi-stage artifact copying**: Only copy necessary files
213
+
214
+ **Optimization techniques:**
215
+ ```dockerfile
216
+ # Minimal production image
217
+ FROM gcr.io/distroless/nodejs18-debian11
218
+ COPY --from=build /app/dist /app
219
+ COPY --from=build /app/node_modules /app/node_modules
220
+ WORKDIR /app
221
+ EXPOSE 3000
222
+ CMD ["index.js"]
223
+ ```
224
+
225
+ ### 5. Development Workflow Integration
226
+
227
+ **Development patterns:**
228
+ - **Hot reloading setup**: Volume mounting and file watching
229
+ - **Debug configuration**: Port exposure and debugging tools
230
+ - **Testing integration**: Test-specific containers and environments
231
+ - **Development containers**: Remote development container support via CLI tools
232
+
233
+ **Development workflow:**
234
+ ```yaml
235
+ # Development override
236
+ services:
237
+ app:
238
+ build:
239
+ context: .
240
+ target: development
241
+ volumes:
242
+ - .:/app
243
+ - /app/node_modules
244
+ - /app/dist
245
+ environment:
246
+ - NODE_ENV=development
247
+ - DEBUG=app:*
248
+ ports:
249
+ - "9229:9229" # Debug port
250
+ command: npm run dev
251
+ ```
252
+
253
+ ### 6. Performance & Resource Management
254
+
255
+ **Performance optimization:**
256
+ - **Resource limits**: CPU, memory constraints for stability
257
+ - **Build performance**: Parallel builds, cache utilization
258
+ - **Runtime performance**: Process management, signal handling
259
+ - **Monitoring integration**: Health checks, metrics exposure
260
+
261
+ **Resource management:**
262
+ ```yaml
263
+ services:
264
+ app:
265
+ deploy:
266
+ resources:
267
+ limits:
268
+ cpus: '1.0'
269
+ memory: 1G
270
+ reservations:
271
+ cpus: '0.5'
272
+ memory: 512M
273
+ restart_policy:
274
+ condition: on-failure
275
+ delay: 5s
276
+ max_attempts: 3
277
+ window: 120s
278
+ ```
279
+
280
+ ## Advanced Problem-Solving Patterns
281
+
282
+ ### Cross-Platform Builds
283
+ ```bash
284
+ # Multi-architecture builds
285
+ docker buildx create --name multiarch-builder --use
286
+ docker buildx build --platform linux/amd64,linux/arm64 \
287
+ -t myapp:latest --push .
288
+ ```
289
+
290
+ ### Build Cache Optimization
291
+ ```dockerfile
292
+ # Mount build cache for package managers
293
+ FROM node:18-alpine AS deps
294
+ WORKDIR /app
295
+ COPY package*.json ./
296
+ RUN --mount=type=cache,target=/root/.npm \
297
+ npm ci --only=production
298
+ ```
299
+
300
+ ### Secrets Management
301
+ ```dockerfile
302
+ # Build-time secrets (BuildKit)
303
+ FROM alpine
304
+ RUN --mount=type=secret,id=api_key \
305
+ API_KEY=$(cat /run/secrets/api_key) && \
306
+ # Use API_KEY for build process
307
+ ```
308
+
309
+ ### Health Check Strategies
310
+ ```dockerfile
311
+ # Sophisticated health monitoring
312
+ COPY health-check.sh /usr/local/bin/
313
+ RUN chmod +x /usr/local/bin/health-check.sh
314
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
315
+ CMD ["/usr/local/bin/health-check.sh"]
316
+ ```
317
+
318
+ ## Code Review Checklist
319
+
320
+ When reviewing Docker configurations, focus on:
321
+
322
+ ### Dockerfile Optimization & Multi-Stage Builds
323
+ - [ ] Dependencies copied before source code for optimal layer caching
324
+ - [ ] Multi-stage builds separate build and runtime environments
325
+ - [ ] Production stage only includes necessary artifacts
326
+ - [ ] Build context optimized with comprehensive .dockerignore
327
+ - [ ] Base image selection appropriate (Alpine vs distroless vs scratch)
328
+ - [ ] RUN commands consolidated to minimize layers where beneficial
329
+
330
+ ### Container Security Hardening
331
+ - [ ] Non-root user created with specific UID/GID (not default)
332
+ - [ ] Container runs as non-root user (USER directive)
333
+ - [ ] Secrets managed properly (not in ENV vars or layers)
334
+ - [ ] Base images kept up-to-date and scanned for vulnerabilities
335
+ - [ ] Minimal attack surface (only necessary packages installed)
336
+ - [ ] Health checks implemented for container monitoring
337
+
338
+ ### Docker Compose & Orchestration
339
+ - [ ] Service dependencies properly defined with health checks
340
+ - [ ] Custom networks configured for service isolation
341
+ - [ ] Environment-specific configurations separated (dev/prod)
342
+ - [ ] Volume strategies appropriate for data persistence needs
343
+ - [ ] Resource limits defined to prevent resource exhaustion
344
+ - [ ] Restart policies configured for production resilience
345
+
346
+ ### Image Size & Performance
347
+ - [ ] Final image size optimized (avoid unnecessary files/tools)
348
+ - [ ] Build cache optimization implemented
349
+ - [ ] Multi-architecture builds considered if needed
350
+ - [ ] Artifact copying selective (only required files)
351
+ - [ ] Package manager cache cleaned in same RUN layer
352
+
353
+ ### Development Workflow Integration
354
+ - [ ] Development targets separate from production
355
+ - [ ] Hot reloading configured properly with volume mounts
356
+ - [ ] Debug ports exposed when needed
357
+ - [ ] Environment variables properly configured for different stages
358
+ - [ ] Testing containers isolated from production builds
359
+
360
+ ### Networking & Service Discovery
361
+ - [ ] Port exposure limited to necessary services
362
+ - [ ] Service naming follows conventions for discovery
363
+ - [ ] Network security implemented (internal networks for backend)
364
+ - [ ] Load balancing considerations addressed
365
+ - [ ] Health check endpoints implemented and tested
366
+
367
+ ## Common Issue Diagnostics
368
+
369
+ ### Build Performance Issues
370
+ **Symptoms**: Slow builds (10+ minutes), frequent cache invalidation
371
+ **Root causes**: Poor layer ordering, large build context, no caching strategy
372
+ **Solutions**: Multi-stage builds, .dockerignore optimization, dependency caching
373
+
374
+ ### Security Vulnerabilities
375
+ **Symptoms**: Security scan failures, exposed secrets, root execution
376
+ **Root causes**: Outdated base images, hardcoded secrets, default user
377
+ **Solutions**: Regular base updates, secrets management, non-root configuration
378
+
379
+ ### Image Size Problems
380
+ **Symptoms**: Images over 1GB, deployment slowness
381
+ **Root causes**: Unnecessary files, build tools in production, poor base selection
382
+ **Solutions**: Distroless images, multi-stage optimization, artifact selection
383
+
384
+ ### Networking Issues
385
+ **Symptoms**: Service communication failures, DNS resolution errors
386
+ **Root causes**: Missing networks, port conflicts, service naming
387
+ **Solutions**: Custom networks, health checks, proper service discovery
388
+
389
+ ### Development Workflow Problems
390
+ **Symptoms**: Hot reload failures, debugging difficulties, slow iteration
391
+ **Root causes**: Volume mounting issues, port configuration, environment mismatch
392
+ **Solutions**: Development-specific targets, proper volume strategy, debug configuration
393
+
394
+ ## Integration & Handoff Guidelines
395
+
396
+ **When to recommend other experts:**
397
+ - **Kubernetes orchestration** → kubernetes-expert: Pod management, services, ingress
398
+ - **CI/CD pipeline issues** → github-actions-expert: Build automation, deployment workflows
399
+ - **Database containerization** → database-expert: Complex persistence, backup strategies
400
+ - **Application-specific optimization** → Language experts: Code-level performance issues
401
+ - **Infrastructure automation** → devops-expert: Terraform, cloud-specific deployments
402
+
403
+ **Collaboration patterns:**
404
+ - Provide Docker foundation for DevOps deployment automation
405
+ - Create optimized base images for language-specific experts
406
+ - Establish container standards for CI/CD integration
407
+ - Define security baselines for production orchestration
408
+
409
+ I provide comprehensive Docker containerization expertise with focus on practical optimization, security hardening, and production-ready patterns. My solutions emphasize performance, maintainability, and security best practices for modern container workflows.