做什么
Python和Node.js应用的生产级多克容器化. 当用户要求将应用程序容器化,创建多克文件,多克项目,或设置多克编译时,应该使用这种技能. 自动检测项目结构,分析.env为机密,验证安全性,并生成被测试的多克文件.
技能库 智客分类:安全测试 docker
Python和Node.js应用的生产级多克容器化. 当用户要求将应用程序容器化,创建多克文件,多克项目,或设置多克编译时,应该使用这种技能. 自动检测项目结构,分析.env为机密,验证安全性,并生成被测试的多克文件.
官方网址:skills.sh
先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。
Python和Node.js应用的生产级多克容器化. 当用户要求将应用程序容器化,创建多克文件,多克项目,或设置多克编译时,应该使用这种技能. 自动检测项目结构,分析.env为机密,验证安全性,并生成被测试的多克文件.
权衡
按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Docker、Resource Detection & Adaptation、Detect host machine memory、Detect Docker allocated resources、Detect available disk space、Agent Behavior。
文件分析:除 SKILL.md 外,正文引用了 references/env-analysis.md、references/production-checklist.md、references/python/fastapi.md、references/python/flask.md、references/python/django.md、references/python/native-deps.md,属于带资源的技能包,这些文件按需再读。
Production-grade Docker containerization for Python and Node.js applications. This skill should be used when users ask to containerize applications, create Dockerfiles, dockerize projects, or set up Docker Compose. Auto-detects project structure, analyzes .env for secrets, validates security, and generates tested Dockerfiles.
DockerResource Detection & AdaptationDetect host machine memoryDetect Docker allocated resourcesDetect available disk spaceAgent BehaviorAdaptive Compose TemplatesPre-Build ValidationCheck available memoryWhat This Skill DoesWhat This Skill Does NOT DoBefore Implementation
来源分类:skills.sh agent-skill
namedockerdescriptionreferences/env-analysis.mdreferences/production-checklist.mdreferences/python/fastapi.mdreferences/python/flask.mdreferences/python/django.mdreferences/python/native-deps.mdreferences/node/nextjs.mdreferences/node/package-managers.mdreferences/docker-hardened-images.mdreferences/multi-stage-builds.md以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。
具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗
先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。
该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。
复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。
把 Agent Skill「docker」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-5cfc39167fbe5849-%E5%A4%B9%E5%85%8B.html 请存为 .cursor/skills/docker/SKILL.md 或 .claude/skills/docker/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。 该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/mjunaidca/mjs-agent-skills 取完整目录,不要只建一个 SKILL.md。
需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。
npx skills add 'https://github.com/mjunaidca/mjs-agent-skills' --list
npx skills add 'https://github.com/mjunaidca/mjs-agent-skills' --skill 'docker'
CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。
Production-grade Docker containerization with security-first defaults.
Before generating Dockerfiles/Compose, detect the environment:
# Detect host machine memory
sysctl -n hw.memsize 2>/dev/null | awk '{print $0/1024/1024/1024 " GB"}' || \
grep MemTotal /proc/meminfo | awk '{print $2/1024/1024 " GB"}'
# Detect Docker allocated resources
docker info --format 'Memory: {{.MemTotal}}, CPUs: {{.NCPU}}'
# Detect available disk space
docker system df
Adapt configurations based on detection:
| Detected Docker Memory | Profile | Build Memory | Container Limits | |-----------------------|---------|--------------|------------------| | < 4GB | Constrained | 1GB | 256Mi | | 4-8GB | Minimal | 2GB | 512Mi | | 8-12GB | Standard | 4GB | 1Gi | | > 12GB | Extended | 8GB | 2Gi |
docker_memory * 0.6 / container_countConstrained (< 4GB Docker):
services:
app:
deploy:
resources:
limits:
memory: 256M
cpus: '0.25'
build:
args:
- BUILDKIT_STEP_LOG_MAX_SIZE=10000000
⚠️ Agent should warn: "Docker memory low. Multi-stage builds may fail."
Standard (4-8GB Docker):
services:
app:
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
reservations:
memory: 256M
Extended (> 8GB Docker):
services:
app:
deploy:
resources:
limits:
memory: 1G
cpus: '1.0'
reservations:
memory: 512M
Before running docker build, agent should verify:
# Check available memory
docker info --format '{{.MemTotal}}' | awk '{if ($1 < 4000000000) print "WARNING: Low memory"}'
If constrained: use --memory flag and warn user about potential build failures.
Analysis & Detection:
Generation:
output: 'standalone' to Next.js, etc.)Validation:
Security:
:latest)Gather context to ensure successful implementation:
| Source | Gather | |--------|--------| | Codebase | Package files, existing Dockerfile, .env patterns | | Conversation | Dev vs production target, base image preferences | | Skill References | Framework patterns, multi-stage builds, security | | User Guidelines | Registry conventions, naming standards |
Ask when not auto-detectable:
| Question | When to Ask | |----------|-------------| | Target environment | "Building for development or production?" | | Base image preference | "Standard slim images or enterprise hardened?" | | Existing Docker files | "Enhance existing Dockerfile or create new?" | | Registry target | "Local only or pushing to registry?" |
| File Present | Runtime | Package Manager |
|--------------|---------|-----------------|
| requirements.txt, pyproject.toml, uv.lock | Python | pip/uv |
| pnpm-lock.yaml | Node.js | pnpm |
| yarn.lock | Node.js | yarn |
| package-lock.json | Node.js | npm |
| What | Detect From |
|------|-------------|
| Python version | pyproject.toml (requires-python), .python-version, runtime.txt |
| Framework | Imports in code (from fastapi, from flask, import django) |
| Package manager | uv.lock → uv, poetry.lock → poetry, else pip |
| Native deps | Scan requirements: psycopg2, cryptography, numpy, pillow |
| App entrypoint | Find app = FastAPI(), app = Flask(), or manage.py |
| What | Detect From |
|------|-------------|
| Node version | .nvmrc, .node-version, package.json (engines.node) |
| Framework | package.json dependencies (next, express, @nestjs/core) |
| Package manager | pnpm-lock.yaml → pnpm, yarn.lock → yarn, else npm |
| Output type | Next.js: check next.config.js for output: 'standalone' |
| Issue | Action |
|-------|--------|
| Next.js missing output: 'standalone' | Add it to next.config.js |
| No health endpoint found | Create /health/live and /health/ready |
| Using uv but no uv.lock | Run uv lock first |
| pyproject.toml but no build system | Use uv pip install -r pyproject.toml |
1. SCAN PROJECT
- Detect runtime, framework, version, entrypoint
- Find dependency files, native deps
- Locate existing Docker files (don't blindly overwrite)
↓
2. ANALYZE ENVIRONMENT
- Scan all .env* files
- Classify: SECRET (never bake) / BUILD_ARG / RUNTIME
- Flag security issues
↓
3. FIX CONFIGURATION
- Add Next.js `output: 'standalone'` if missing
- Create health endpoints if missing
- Generate .env.example with safe placeholders
↓
4. GENERATE FILES
- Dockerfile (customized CMD, paths, build deps)
- .dockerignore (excludes .env, secrets)
- compose.yaml (with security defaults)
↓
5. VALIDATE & TEST
- docker build --target dev -t app:dev .
- docker build --target production -t app:prod .
- Test health endpoints
- Verify non-root user
- Report image size
↓
6. DELIVER WITH CONTEXT
- All files with explanations
- Security scan command
- Any warnings about secrets
- Rollback instructions if replacing existing
Only ask if genuinely ambiguous (e.g., multiple apps in monorepo, conflicting configs)
| Choice | When to Use | Tradeoffs |
|--------|-------------|-----------|
| Slim {runtime}:X-slim | General production (default) | Works everywhere, no auth |
| DHI dhi.io/{runtime}:X | SOC2/HIPAA, enterprise | Requires docker login dhi.io |
| Alpine {runtime}:X-alpine | Smallest size | musl issues with native deps |
Default: Slim (works everywhere without authentication)
deps/base → Install dependencies (cached layer)
↓
builder → Build/compile application
↓
dev → Hot-reload, volume mounts (--target dev)
↓
production → Minimal DHI runtime (--target production)
docker build --target dev -t myapp:dev .
docker build --target production -t myapp:prod .
| Framework | Development | Production |
|-----------|-------------|------------|
| FastAPI | uvicorn app.main:app --reload | uvicorn app.main:app --workers 4 |
| Flask | flask run --debug | gunicorn -w 4 app:app |
| Django | python manage.py runserver | gunicorn -w 4 project.wsgi |
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=cache,target=/root/.cache/pip \
uv pip install -r requirements.txt
@asynccontextmanager
async def lifespan(app: FastAPI):
yield # startup
# shutdown logic here
| Framework | Build | Output |
|-----------|-------|--------|
| Next.js | next build | .next/standalone |
| Express | tsc | dist/ |
| NestJS | nest build | dist/ |
# pnpm
RUN --mount=type=cache,target=/root/.local/share/pnpm/store \
pnpm install --frozen-lockfile
# npm
RUN --mount=type=cache,target=/root/.npm npm ci
# yarn
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn \
yarn install --frozen-lockfile
process.on('SIGTERM', () => {
server.close(() => process.exit(0));
});
Before delivering, verify:
.env, .git, secrets| File | Purpose |
|------|---------|
| Dockerfile | Multi-stage, multi-target build |
| .dockerignore | Exclude sensitive/unnecessary files |
| compose.yaml | Local development stack |
| health.py / health endpoint | Framework-specific health checks |
| File | Purpose |
|------|---------|
| references/env-analysis.md | CRITICAL: Secret detection, .env classification |
| references/production-checklist.md | CRITICAL: Validation before delivery |
| File | When to Read |
|------|--------------|
| references/python/fastapi.md | FastAPI: uvicorn, lifespan |
| references/python/flask.md | Flask: gunicorn, blueprints |
| references/python/django.md | Django: gunicorn, middleware |
| references/python/native-deps.md | Detect psycopg2, cryptography, etc. |
| references/node/nextjs.md | Next.js: standalone, ISR |
| references/node/package-managers.md | npm/yarn/pnpm caching |
| File | When to Read |
|------|--------------|
| references/docker-hardened-images.md | If user needs enterprise security (DHI) |
| references/multi-stage-builds.md | Complex build patterns |
Templates in templates/ are reference patterns, not copy-paste files.
Agent must:
src.app.main:app)Example customization:
# Template says:
CMD ["uvicorn", "app.main:app", ...]
# Agent detects app at src/api/main.py, generates:
CMD ["uvicorn", "src.api.main:app", ...]
安全测试
人工智能特工的安全第一技能审查。 在安装来自 ClawdHub, GitHub 或其他来源的任何技能之前使用 。 检查红旗,许可范围,可疑图案.
安全测试
MoltGuard——由OpenGuardrails担任OpenClaw保安. 安装 MoltGuard 以保护你和你的人类免受迅速注射、数据过滤和恶意命令的影响。 资料来源:https://github.com/openguardrails/openguardrails/tre…
安全测试
用于审查安全漏洞代码,实施认证流,审计OWASP Top 10,配置CORS/CSP头,处理秘密,输入验证,SQL注射预防,XSS保护,或任何与安全相关的代码审查.
安全测试
安装任何AI代理技能前的安全审查协议. 红旗侦取入证盗取,疏通密码,放出. 风险分类:低/中/高/高。 编制结构化审查报告。 不先运行此功能, 绝不安装不信任的技能 .