ワンクリックで
docker-init
Generate Dockerfiles and docker-compose.yml with auto-detected services, health checks, security hardening, and resource limits.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Generate Dockerfiles and docker-compose.yml with auto-detected services, health checks, security hardening, and resource limits.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Headless browser automation CLI optimized for AI agents. Uses snapshot + refs system for 93% less context overhead vs Playwright. Purpose-built for web testing, form automation, screenshots, and data extraction.
Manage a gitflow branching workflow — starting and finishing feature, release, and hotfix branches; cutting versioned releases with changelog generation; coordinating emergency hotfixes directly to production; and keeping long-lived branches in sync. Activates when users mention gitflow, feature/release/hotfix branches, cutting a release, branching strategy, promoting an integration branch to production, tagging a version, or rolling back a live release. Also reaches for it when the user says "ship it", "promote dev to main", or "we need to hotfix prod" without naming gitflow. Skip for general git mechanics (commit messages, merge conflicts, interactive rebase, git education) or CI-failure debugging unrelated to a release.
Fixes a bug through test-driven debugging — reproduces it with a failing test, locates the root cause with evidence (file:line), then applies the smallest fix that resolves it without refactoring unrelated code. Use when the user wants to fix a bug, debug an issue, resolve an error, or investigate a failing test. Not for building new functionality (use implement-feature) or restructuring working code with no bug involved (use refactor).
Implements a new feature end-to-end as a senior staff engineer would — discovers project conventions, researches current best practices, drafts a plan for approval, then builds it with parallel subagents that reuse existing code, skip speculative abstractions, and verify with tests before completion. Use when the user wants to implement, build, add, or ship new functionality (a feature, endpoint, component, module, or integration) — not for fixing an existing bug (use fix-bug) or restructuring code that already works (use refactor).
Restructures existing code without changing its behavior — maps callers and test coverage, adds characterization tests where coverage is thin, then applies the change in small steps verified against the full test suite after each one. Use when the user wants to refactor, extract a method or class, simplify logic, reduce duplication, improve naming, restructure modules, or pay down technical debt in code that already works. Not for adding new functionality (use implement-feature) or fixing broken behavior (use fix-bug).
Runs a comprehensive multi-agent code review of a PR, commit, or the whole codebase across six dimensions (correctness, performance, code style, test coverage, error handling, and simplicity/over-engineering) and returns a severity-ranked report with file:line findings and fix suggestions. Use when the user wants a thorough code review, asks to review a PR or diff, or wants over-engineered code flagged for simplification. Analysis only, identifying issues without modifying code, committing, or running tests. Not for a security-focused audit (use review-security) or a visual/UX design critique (use review-design).
| name | docker-init |
| description | Generate Dockerfiles and docker-compose.yml with auto-detected services, health checks, security hardening, and resource limits. |
| metadata | {"author":"mgiovani","version":"1.0.0","source":"https://github.com/mgiovani/skills"} |
| disable-model-invocation | true |
| argument-hint | [--services postgres,redis] [--prod] [--with-dockerfile] |
| allowed-tools | ["Read","Write","Edit","Grep","Glob","Bash(docker *)","AskUserQuestion"] |
Cross-Platform AI Agent Skill This skill works with any AI agent platform that supports the skills.sh standard.
Generate production-ready docker-compose.yml and Dockerfile with auto-detected services, health checks, resource limits, and security hardening.
CRITICAL: Only generate compose configs based on what the codebase actually uses:
package.json, pyproject.toml, requirements.txt, etc. before proposing servicesdocker-compose.yml or Dockerfile before overwritingenv_fileDetect the tech stack and dependencies from manifest files:
# Node.js
cat package.json 2>/dev/null | grep -E '"(pg|mysql|redis|mongodb|rabbitmq|kafka|meilisearch|elasticsearch|celery)"'
# Python
cat requirements.txt pyproject.toml 2>/dev/null | grep -iE "psycopg|pymysql|redis|pymongo|pika|kafka|celery"
# Ruby
cat Gemfile 2>/dev/null | grep -E "pg|mysql|redis|mongo|sidekiq"
# Go
cat go.mod 2>/dev/null | grep -E "postgres|mysql|redis|mongo"
# Rust
cat Cargo.toml 2>/dev/null | grep -E "postgres|mysql|redis|mongo"
Also scan:
DATABASE_URL, REDIS_URL, MONGODB_URI, RABBITMQ_URL patterns.env.example for service URLsREADME.md for setup instructions mentioning servicesCheck for existing Docker files:
ls docker-compose.yml docker-compose.yaml Dockerfile .dockerignore 2>/dev/null
If files exist, read them before proposing changes and ask user whether to update or create fresh.
Map detected dependencies to Docker services. Show the proposal and let user confirm/modify:
Dependency-to-service mapping:
| Detected | Proposed Service | Default Image |
|---|---|---|
pg, psycopg, postgres | PostgreSQL | postgres:16-alpine |
mysql, pymysql | MySQL | mysql:8.0 |
redis, ioredis | Redis / Valkey | redis:7-alpine |
mongodb, pymongo | MongoDB | mongo:7 |
rabbitmq, pika, amqp | RabbitMQ | rabbitmq:3-management-alpine |
kafka, confluent | Kafka + Zookeeper | confluentinc/cp-kafka:latest |
meilisearch | Meilisearch | getmeili/meilisearch:latest |
elasticsearch | Elasticsearch | elasticsearch:8.12.0 |
celery, sidekiq | Redis (queue backend) | redis:7-alpine |
mailhog, smtp, mailer | Mailhog | mailhog/mailhog:latest |
minio, s3 | MinIO | minio/minio:latest |
Always ask:
Generate docker-compose.yml (no version: field — modern standard) with:
Every service must include:
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER:-app}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?required}
POSTGRES_DB: ${POSTGRES_DB:-app_development}
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-app}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: unless-stopped
networks:
- db
deploy:
resources:
limits:
cpus: '1'
memory: 512M
Security defaults (applied to every service):
security_opt:
- no-new-privileges:true
Network segmentation (create as needed):
networks:
frontend: # App <-> reverse proxy
backend: # App <-> services
db: # Services <-> databases only
Volumes at the bottom:
volumes:
postgres_data:
redis_data:
Health check patterns per service:
| Service | Health Check |
|---|---|
| Postgres | pg_isready -U ${USER} |
| MySQL | mysqladmin ping -h localhost |
| Redis | redis-cli ping |
| MongoDB | mongosh --eval "db.adminCommand('ping')" |
| RabbitMQ | rabbitmq-diagnostics -q ping |
| MinIO | mc ready local |
--with-dockerfile)Generate a multi-stage Dockerfile for the detected stack:
Node.js example:
# Build stage
FROM node:22-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
# Runtime stage
FROM node:22-alpine AS runtime
RUN addgroup -g 1001 -S appgroup && adduser -S appuser -u 1001 -G appgroup
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY --chown=appuser:appgroup . .
USER appuser
EXPOSE 3000
CMD ["node", "src/index.js"]
Python example:
FROM python:3.12-slim AS builder
WORKDIR /app
RUN pip install uv
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev
FROM python:3.12-slim AS runtime
RUN useradd -m -u 1001 appuser
WORKDIR /app
COPY --from=builder /app/.venv ./.venv
COPY --chown=appuser . .
USER appuser
ENV PATH="/app/.venv/bin:$PATH"
CMD ["python", "-m", "app"]
Also generate .dockerignore:
.git
.env
.env.*
node_modules
__pycache__
*.pyc
.pytest_cache
.coverage
dist/
build/
--prod)Create docker-compose.prod.yml with production hardening:
services:
postgres:
ports: [] # No direct port exposure
restart: always
deploy:
resources:
limits:
cpus: '2'
memory: 1G
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
Run validation after generating:
docker compose config --quiet 2>&1 && echo "Valid" || echo "Errors found"
Check that .dockerignore exists (create minimal one if missing).
Remind user to add real secrets to .env (and verify .env is in .gitignore).
--services <list>: Comma-separated list of additional services (e.g., --services postgres,redis,meilisearch)--prod: Also generate docker-compose.prod.yml with production settings--with-dockerfile: Also generate Dockerfile and .dockerignoreversion: field in compose files — deprecated in modern Docker Compose${VAR} references pointing to .envUSER in Dockerfiledeploy.resources.limits to prevent runaway containers# Auto-detect and generate docker-compose.yml
/docker-init
# Generate with specific services
/docker-init --services postgres,redis,meilisearch
# Generate compose + Dockerfile
/docker-init --with-dockerfile
# Full production setup
/docker-init --with-dockerfile --prod