@musashishao/agent-kit 1.2.2
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/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/mcp/README.md +69 -0
- package/.agent/mcp/config/mcp-config.json +62 -0
- package/.agent/mcp/config/registry.json +54 -0
- package/.agent/mcp/servers/agent-kit-core/package.json +28 -0
- package/.agent/mcp/servers/agent-kit-core/src/index.ts +455 -0
- package/.agent/mcp/servers/agent-kit-core/tsconfig.json +16 -0
- package/.agent/mcp/servers/agent-kit-fs/package.json +25 -0
- package/.agent/mcp/servers/agent-kit-fs/src/index.ts +399 -0
- package/.agent/mcp/servers/agent-kit-fs/tsconfig.json +16 -0
- package/.agent/mcp/servers/agent-kit-git/package.json +24 -0
- package/.agent/mcp/servers/agent-kit-git/src/index.ts +283 -0
- package/.agent/mcp/servers/agent-kit-git/tsconfig.json +16 -0
- package/.agent/mcp/templates/README.md +49 -0
- package/.agent/mcp/templates/api/README.md.template +45 -0
- package/.agent/mcp/templates/api/src/index.ts.template +185 -0
- package/.agent/mcp/templates/base-package.json.template +27 -0
- package/.agent/mcp/templates/base-tsconfig.json +21 -0
- package/.agent/mcp/templates/custom/src/index.ts.template +133 -0
- package/.agent/mcp/templates/database/src/index.ts.template +273 -0
- package/.agent/mcp/templates/web-scraper/src/index.ts.template +239 -0
- package/.agent/rules/CODEX.md +250 -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/context-engineering/SKILL.md +74 -0
- package/.agent/skills/context-engineering/examples/advanced_code_request.md +73 -0
- package/.agent/skills/context-engineering/scripts/quality_validator.py +294 -0
- package/.agent/skills/context-engineering/scripts/repo_mapper.py +27 -0
- package/.agent/skills/context-engineering/scripts/skill_checker.py +194 -0
- package/.agent/skills/context-engineering/scripts/token_counter.py +65 -0
- package/.agent/skills/context-engineering/strategies/context-caching.md +50 -0
- package/.agent/skills/context-engineering/strategies/few-shot-examples.md +56 -0
- package/.agent/skills/context-engineering/strategies/skeleton-code.md +59 -0
- package/.agent/skills/context-engineering/strategies/xml-framing.md +57 -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 +662 -0
- package/.agent/skills/mcp-builder/python-template.md +522 -0
- package/.agent/skills/mcp-builder/tool-patterns.md +642 -0
- package/.agent/skills/mcp-builder/typescript-template.md +361 -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/problem-solving/SKILL.md +556 -0
- package/.agent/skills/problem-solving/collision-zone-thinking.md +285 -0
- package/.agent/skills/problem-solving/inversion-exercise.md +205 -0
- package/.agent/skills/problem-solving/meta-pattern-recognition.md +313 -0
- package/.agent/skills/problem-solving/scale-game.md +300 -0
- package/.agent/skills/problem-solving/simplification-cascades.md +321 -0
- package/.agent/skills/problem-solving/when-stuck.md +146 -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/templates/AGENTS.backend.md +230 -0
- package/.agent/templates/AGENTS.md +121 -0
- package/.agent/templates/AGENTS.mobile.md +183 -0
- package/.agent/templates/AGENTS.web.md +192 -0
- package/.agent/workflows/brainstorm.md +113 -0
- package/.agent/workflows/context.md +47 -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/quality.md +89 -0
- package/.agent/workflows/status.md +86 -0
- package/.agent/workflows/test.md +144 -0
- package/.agent/workflows/ui-ux-pro-max.md +250 -0
- package/LICENSE +21 -0
- package/README.md +317 -0
- package/bin/cli.js +1267 -0
- package/index.js +1 -0
- package/package.json +50 -0
|
@@ -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.
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documentation-templates
|
|
3
|
+
description: Documentation templates and structure guidelines. README, API docs, code comments, and AI-friendly documentation.
|
|
4
|
+
allowed-tools: Read, Glob, Grep
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Documentation Templates
|
|
8
|
+
|
|
9
|
+
> Templates and structure guidelines for common documentation types.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. README Structure
|
|
14
|
+
|
|
15
|
+
### Essential Sections (Priority Order)
|
|
16
|
+
|
|
17
|
+
| Section | Purpose |
|
|
18
|
+
|---------|---------|
|
|
19
|
+
| **Title + One-liner** | What is this? |
|
|
20
|
+
| **Quick Start** | Running in <5 min |
|
|
21
|
+
| **Features** | What can I do? |
|
|
22
|
+
| **Configuration** | How to customize |
|
|
23
|
+
| **API Reference** | Link to detailed docs |
|
|
24
|
+
| **Contributing** | How to help |
|
|
25
|
+
| **License** | Legal |
|
|
26
|
+
|
|
27
|
+
### README Template
|
|
28
|
+
|
|
29
|
+
```markdown
|
|
30
|
+
# Project Name
|
|
31
|
+
|
|
32
|
+
Brief one-line description.
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
[Minimum steps to run]
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- Feature 1
|
|
41
|
+
- Feature 2
|
|
42
|
+
|
|
43
|
+
## Configuration
|
|
44
|
+
|
|
45
|
+
| Variable | Description | Default |
|
|
46
|
+
|----------|-------------|---------|
|
|
47
|
+
| PORT | Server port | 3000 |
|
|
48
|
+
|
|
49
|
+
## Documentation
|
|
50
|
+
|
|
51
|
+
- [API Reference](./docs/api.md)
|
|
52
|
+
- [Architecture](./docs/architecture.md)
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
MIT
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 2. API Documentation Structure
|
|
62
|
+
|
|
63
|
+
### Per-Endpoint Template
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
## GET /users/:id
|
|
67
|
+
|
|
68
|
+
Get a user by ID.
|
|
69
|
+
|
|
70
|
+
**Parameters:**
|
|
71
|
+
| Name | Type | Required | Description |
|
|
72
|
+
|------|------|----------|-------------|
|
|
73
|
+
| id | string | Yes | User ID |
|
|
74
|
+
|
|
75
|
+
**Response:**
|
|
76
|
+
- 200: User object
|
|
77
|
+
- 404: User not found
|
|
78
|
+
|
|
79
|
+
**Example:**
|
|
80
|
+
[Request and response example]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 3. Code Comment Guidelines
|
|
86
|
+
|
|
87
|
+
### JSDoc/TSDoc Template
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
/**
|
|
91
|
+
* Brief description of what the function does.
|
|
92
|
+
*
|
|
93
|
+
* @param paramName - Description of parameter
|
|
94
|
+
* @returns Description of return value
|
|
95
|
+
* @throws ErrorType - When this error occurs
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* const result = functionName(input);
|
|
99
|
+
*/
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### When to Comment
|
|
103
|
+
|
|
104
|
+
| ✅ Comment | ❌ Don't Comment |
|
|
105
|
+
|-----------|-----------------|
|
|
106
|
+
| Why (business logic) | What (obvious) |
|
|
107
|
+
| Complex algorithms | Every line |
|
|
108
|
+
| Non-obvious behavior | Self-explanatory code |
|
|
109
|
+
| API contracts | Implementation details |
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 4. Changelog Template (Keep a Changelog)
|
|
114
|
+
|
|
115
|
+
```markdown
|
|
116
|
+
# Changelog
|
|
117
|
+
|
|
118
|
+
## [Unreleased]
|
|
119
|
+
### Added
|
|
120
|
+
- New feature
|
|
121
|
+
|
|
122
|
+
## [1.0.0] - 2025-01-01
|
|
123
|
+
### Added
|
|
124
|
+
- Initial release
|
|
125
|
+
### Changed
|
|
126
|
+
- Updated dependency
|
|
127
|
+
### Fixed
|
|
128
|
+
- Bug fix
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 5. Architecture Decision Record (ADR)
|
|
134
|
+
|
|
135
|
+
```markdown
|
|
136
|
+
# ADR-001: [Title]
|
|
137
|
+
|
|
138
|
+
## Status
|
|
139
|
+
Accepted / Deprecated / Superseded
|
|
140
|
+
|
|
141
|
+
## Context
|
|
142
|
+
Why are we making this decision?
|
|
143
|
+
|
|
144
|
+
## Decision
|
|
145
|
+
What did we decide?
|
|
146
|
+
|
|
147
|
+
## Consequences
|
|
148
|
+
What are the trade-offs?
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 6. AI-Friendly Documentation (2025)
|
|
154
|
+
|
|
155
|
+
### llms.txt Template
|
|
156
|
+
|
|
157
|
+
For AI crawlers and agents:
|
|
158
|
+
|
|
159
|
+
```markdown
|
|
160
|
+
# Project Name
|
|
161
|
+
> One-line objective.
|
|
162
|
+
|
|
163
|
+
## Core Files
|
|
164
|
+
- [src/index.ts]: Main entry
|
|
165
|
+
- [src/api/]: API routes
|
|
166
|
+
- [docs/]: Documentation
|
|
167
|
+
|
|
168
|
+
## Key Concepts
|
|
169
|
+
- Concept 1: Brief explanation
|
|
170
|
+
- Concept 2: Brief explanation
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### MCP-Ready Documentation
|
|
174
|
+
|
|
175
|
+
For RAG indexing:
|
|
176
|
+
- Clear H1-H3 hierarchy
|
|
177
|
+
- JSON/YAML examples for data structures
|
|
178
|
+
- Mermaid diagrams for flows
|
|
179
|
+
- Self-contained sections
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 7. Structure Principles
|
|
184
|
+
|
|
185
|
+
| Principle | Why |
|
|
186
|
+
|-----------|-----|
|
|
187
|
+
| **Scannable** | Headers, lists, tables |
|
|
188
|
+
| **Examples first** | Show, don't just tell |
|
|
189
|
+
| **Progressive detail** | Simple → Complex |
|
|
190
|
+
| **Up to date** | Outdated = misleading |
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
> **Remember:** Templates are starting points. Adapt to your project's needs.
|