部署与云服务
docker-compose-helper
Use when the user asks to create, debug, or modify Docker Compose files, compose.yaml, docker-compose.yml, service dependencies, healthchecks, ports, volumes, networks, environment variables, or local multi-container development stacks. Use this skill even if the user says "compose file" or "local stack" instead of "Docker Compose".
antongulin · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add antongulin/opencode-skill-creator --skill docker-compose-helper技能说明
name: docker-compose-helper description: Use when the user asks to create, debug, or modify Docker Compose files, compose.yaml, docker-compose.yml, service dependencies, healthchecks, ports, volumes, networks, environment variables, or local multi-container development stacks. Use this skill even if the user says "compose file" or "local stack" instead of "Docker Compose".
Docker Compose Helper
Help users create, review, and repair Docker Compose setups with the smallest working change that fits their local development workflow.
Workflow
- Identify the user's goal:
- creating a new compose file
- adding or changing a service
- debugging startup, networking, volume, or environment issues
- translating a
docker runcommand into compose
- Inspect existing files before editing:
compose.yamlcompose.ymldocker-compose.yamldocker-compose.yml.env- Dockerfiles referenced by
build
- Prefer Docker Compose v2 syntax:
- omit the obsolete top-level
version - use
compose.yamlif creating a new file - keep service names lowercase and stable
- omit the obsolete top-level
- Make the smallest useful change. Do not add orchestration, custom networks, or named volumes unless the service needs them.
Compose Defaults
- Use explicit image tags instead of
latestwhen a stable tag is obvious. - Use named volumes for database state.
- Use bind mounts for application source during local development.
- Put secrets and machine-specific values in
.env, not directly in YAML. - Add
depends_ononly for startup ordering; addhealthcheckwhen readiness actually matters. - Expose only the host ports the user needs.
Debugging Checklist
When debugging, check these in order:
- YAML validity and indentation.
- Whether the service name, image, build context, and Dockerfile path exist.
- Port conflicts between host ports and already-running services.
- Volume paths and whether a bind mount hides files built into the image.
- Environment variable names,
.envloading, and missing required values. - Container-to-container networking: services should use service names as DNS
hosts, not
localhost. - Readiness problems: add a healthcheck and condition only when the dependent service truly must wait.
Output
When editing files, show the changed compose snippet or file path and explain the reason for each non-obvious setting in one short sentence.