@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.
- package/.agent/.shared/ui-ux-pro-max/data/charts.csv +26 -0
- package/.agent/.shared/ui-ux-pro-max/data/colors.csv +97 -0
- package/.agent/.shared/ui-ux-pro-max/data/icons.csv +101 -0
- package/.agent/.shared/ui-ux-pro-max/data/landing.csv +31 -0
- package/.agent/.shared/ui-ux-pro-max/data/products.csv +97 -0
- package/.agent/.shared/ui-ux-pro-max/data/prompts.csv +24 -0
- package/.agent/.shared/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.agent/.shared/ui-ux-pro-max/data/styles.csv +59 -0
- package/.agent/.shared/ui-ux-pro-max/data/typography.csv +58 -0
- package/.agent/.shared/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.agent/.shared/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/core.py +258 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/design_system.py +487 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/search.py +76 -0
- package/.agent/ARCHITECTURE.md +225 -0
- package/.agent/CONTEXT.md +229 -0
- package/.agent/FEATURE_ROADMAP.md +435 -0
- package/.agent/PROMPT_TEMPLATES.md +261 -0
- package/.agent/agents/backend-specialist.md +263 -0
- package/.agent/agents/database-architect.md +226 -0
- package/.agent/agents/debugger.md +225 -0
- package/.agent/agents/devops-engineer.md +242 -0
- package/.agent/agents/documentation-writer.md +104 -0
- package/.agent/agents/explorer-agent.md +73 -0
- package/.agent/agents/frontend-specialist.md +556 -0
- package/.agent/agents/game-developer.md +162 -0
- package/.agent/agents/mobile-developer.md +377 -0
- package/.agent/agents/orchestrator.md +416 -0
- package/.agent/agents/penetration-tester.md +188 -0
- package/.agent/agents/performance-optimizer.md +187 -0
- package/.agent/agents/project-planner.md +403 -0
- package/.agent/agents/security-auditor.md +170 -0
- package/.agent/agents/seo-specialist.md +111 -0
- package/.agent/agents/test-engineer.md +158 -0
- package/.agent/rules/GEMINI.md +251 -0
- package/.agent/skills/api-patterns/SKILL.md +81 -0
- package/.agent/skills/api-patterns/api-style.md +42 -0
- package/.agent/skills/api-patterns/auth.md +24 -0
- package/.agent/skills/api-patterns/documentation.md +26 -0
- package/.agent/skills/api-patterns/graphql.md +41 -0
- package/.agent/skills/api-patterns/rate-limiting.md +31 -0
- package/.agent/skills/api-patterns/response.md +37 -0
- package/.agent/skills/api-patterns/rest.md +40 -0
- package/.agent/skills/api-patterns/scripts/api_validator.py +211 -0
- package/.agent/skills/api-patterns/security-testing.md +122 -0
- package/.agent/skills/api-patterns/trpc.md +41 -0
- package/.agent/skills/api-patterns/versioning.md +22 -0
- package/.agent/skills/app-builder/SKILL.md +75 -0
- package/.agent/skills/app-builder/agent-coordination.md +71 -0
- package/.agent/skills/app-builder/feature-building.md +53 -0
- package/.agent/skills/app-builder/project-detection.md +34 -0
- package/.agent/skills/app-builder/scaffolding.md +118 -0
- package/.agent/skills/app-builder/tech-stack.md +40 -0
- package/.agent/skills/app-builder/templates/SKILL.md +39 -0
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +82 -0
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +100 -0
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +106 -0
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +101 -0
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +93 -0
- package/.agent/skills/architecture/SKILL.md +55 -0
- package/.agent/skills/architecture/context-discovery.md +43 -0
- package/.agent/skills/architecture/examples.md +94 -0
- package/.agent/skills/architecture/pattern-selection.md +68 -0
- package/.agent/skills/architecture/patterns-reference.md +50 -0
- package/.agent/skills/architecture/trade-off-analysis.md +77 -0
- package/.agent/skills/bash-linux/SKILL.md +199 -0
- package/.agent/skills/behavioral-modes/SKILL.md +242 -0
- package/.agent/skills/brainstorming/SKILL.md +163 -0
- package/.agent/skills/brainstorming/dynamic-questioning.md +350 -0
- package/.agent/skills/clean-code/SKILL.md +201 -0
- package/.agent/skills/code-review-checklist/SKILL.md +109 -0
- package/.agent/skills/database-design/SKILL.md +52 -0
- package/.agent/skills/database-design/database-selection.md +43 -0
- package/.agent/skills/database-design/indexing.md +39 -0
- package/.agent/skills/database-design/migrations.md +48 -0
- package/.agent/skills/database-design/optimization.md +36 -0
- package/.agent/skills/database-design/orm-selection.md +30 -0
- package/.agent/skills/database-design/schema-design.md +56 -0
- package/.agent/skills/database-design/scripts/schema_validator.py +172 -0
- package/.agent/skills/deployment-procedures/SKILL.md +241 -0
- package/.agent/skills/doc.md +177 -0
- package/.agent/skills/docker-expert/SKILL.md +409 -0
- package/.agent/skills/documentation-templates/SKILL.md +194 -0
- package/.agent/skills/frontend-design/SKILL.md +396 -0
- package/.agent/skills/frontend-design/animation-guide.md +331 -0
- package/.agent/skills/frontend-design/color-system.md +311 -0
- package/.agent/skills/frontend-design/decision-trees.md +418 -0
- package/.agent/skills/frontend-design/motion-graphics.md +306 -0
- package/.agent/skills/frontend-design/scripts/accessibility_checker.py +183 -0
- package/.agent/skills/frontend-design/scripts/ux_audit.py +722 -0
- package/.agent/skills/frontend-design/typography-system.md +345 -0
- package/.agent/skills/frontend-design/ux-psychology.md +541 -0
- package/.agent/skills/frontend-design/visual-effects.md +383 -0
- package/.agent/skills/game-development/2d-games/SKILL.md +119 -0
- package/.agent/skills/game-development/3d-games/SKILL.md +135 -0
- package/.agent/skills/game-development/SKILL.md +167 -0
- package/.agent/skills/game-development/game-art/SKILL.md +185 -0
- package/.agent/skills/game-development/game-audio/SKILL.md +190 -0
- package/.agent/skills/game-development/game-design/SKILL.md +129 -0
- package/.agent/skills/game-development/mobile-games/SKILL.md +108 -0
- package/.agent/skills/game-development/multiplayer/SKILL.md +132 -0
- package/.agent/skills/game-development/pc-games/SKILL.md +144 -0
- package/.agent/skills/game-development/vr-ar/SKILL.md +123 -0
- package/.agent/skills/game-development/web-games/SKILL.md +150 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +156 -0
- package/.agent/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
- package/.agent/skills/i18n-localization/SKILL.md +154 -0
- package/.agent/skills/i18n-localization/scripts/i18n_checker.py +241 -0
- package/.agent/skills/lint-and-validate/SKILL.md +45 -0
- package/.agent/skills/lint-and-validate/scripts/lint_runner.py +172 -0
- package/.agent/skills/lint-and-validate/scripts/type_coverage.py +173 -0
- package/.agent/skills/mcp-builder/SKILL.md +176 -0
- package/.agent/skills/mobile-design/SKILL.md +394 -0
- package/.agent/skills/mobile-design/decision-trees.md +516 -0
- package/.agent/skills/mobile-design/mobile-backend.md +491 -0
- package/.agent/skills/mobile-design/mobile-color-system.md +420 -0
- package/.agent/skills/mobile-design/mobile-debugging.md +122 -0
- package/.agent/skills/mobile-design/mobile-design-thinking.md +357 -0
- package/.agent/skills/mobile-design/mobile-navigation.md +458 -0
- package/.agent/skills/mobile-design/mobile-performance.md +767 -0
- package/.agent/skills/mobile-design/mobile-testing.md +356 -0
- package/.agent/skills/mobile-design/mobile-typography.md +433 -0
- package/.agent/skills/mobile-design/platform-android.md +666 -0
- package/.agent/skills/mobile-design/platform-ios.md +561 -0
- package/.agent/skills/mobile-design/scripts/mobile_audit.py +670 -0
- package/.agent/skills/mobile-design/touch-psychology.md +537 -0
- package/.agent/skills/nestjs-expert/SKILL.md +552 -0
- package/.agent/skills/nextjs-best-practices/SKILL.md +203 -0
- package/.agent/skills/nodejs-best-practices/SKILL.md +333 -0
- package/.agent/skills/parallel-agents/SKILL.md +175 -0
- package/.agent/skills/performance-profiling/SKILL.md +143 -0
- package/.agent/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
- package/.agent/skills/plan-writing/SKILL.md +152 -0
- package/.agent/skills/powershell-windows/SKILL.md +167 -0
- package/.agent/skills/prisma-expert/SKILL.md +355 -0
- package/.agent/skills/python-patterns/SKILL.md +441 -0
- package/.agent/skills/react-patterns/SKILL.md +198 -0
- package/.agent/skills/red-team-tactics/SKILL.md +199 -0
- package/.agent/skills/seo-fundamentals/SKILL.md +129 -0
- package/.agent/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
- package/.agent/skills/server-management/SKILL.md +161 -0
- package/.agent/skills/systematic-debugging/SKILL.md +109 -0
- package/.agent/skills/tailwind-patterns/SKILL.md +269 -0
- package/.agent/skills/tdd-workflow/SKILL.md +149 -0
- package/.agent/skills/testing-patterns/SKILL.md +178 -0
- package/.agent/skills/testing-patterns/scripts/test_runner.py +219 -0
- package/.agent/skills/typescript-expert/SKILL.md +429 -0
- package/.agent/skills/typescript-expert/references/tsconfig-strict.json +92 -0
- package/.agent/skills/typescript-expert/references/typescript-cheatsheet.md +383 -0
- package/.agent/skills/typescript-expert/references/utility-types.ts +335 -0
- package/.agent/skills/typescript-expert/scripts/ts_diagnostic.py +203 -0
- package/.agent/skills/ui-ux-pro-max/SKILL.md +351 -0
- package/.agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/.agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/.agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/.agent/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/prompts.csv +24 -0
- package/.agent/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.agent/skills/ui-ux-pro-max/data/styles.csv +59 -0
- package/.agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/.agent/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.agent/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/.agent/skills/ui-ux-pro-max/scripts/core.py +257 -0
- package/.agent/skills/ui-ux-pro-max/scripts/design_system.py +487 -0
- package/.agent/skills/ui-ux-pro-max/scripts/search.py +76 -0
- package/.agent/skills/vulnerability-scanner/SKILL.md +276 -0
- package/.agent/skills/vulnerability-scanner/checklists.md +121 -0
- package/.agent/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
- package/.agent/skills/webapp-testing/SKILL.md +187 -0
- package/.agent/skills/webapp-testing/scripts/playwright_runner.py +173 -0
- package/.agent/workflows/brainstorm.md +113 -0
- package/.agent/workflows/create.md +59 -0
- package/.agent/workflows/debug.md +103 -0
- package/.agent/workflows/deploy.md +176 -0
- package/.agent/workflows/enhance.md +63 -0
- package/.agent/workflows/orchestrate.md +237 -0
- package/.agent/workflows/plan.md +89 -0
- package/.agent/workflows/preview.md +80 -0
- package/.agent/workflows/status.md +86 -0
- package/.agent/workflows/test.md +144 -0
- package/.agent/workflows/ui-ux-pro-max.md +231 -0
- package/LICENSE +21 -0
- package/README.md +101 -0
- package/bin/cli.js +235 -0
- package/index.js +1 -0
- 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.
|