Docker setup
Skill viknesh20-20/claude-code-tool-kit/.claude/skills/docker-setup
Generates Dockerfile, docker-compose.yml, and .dockerignore for the project. Auto-detects the stack and creates optimized multi-stage builds with caching, health checks, and dev/prod configurations.From its SKILL.md
npx -y skills add viknesh20-20/claude-code-tool-kit --skill docker-setupAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 7 stars7 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
- runs commandsInstructs the agent to run 3 commands, including `ls package.json requirements.txt pyproject.toml go.mod Cargo.toml *.csproj Gemfile composer.json mix.exs 2>/dev/null` and 2 more.
SKILL.md
2.7 KB, 631 tokens by cl100k_base, as published. Nobody here has run it
Docker Setup Generator
Detect Stack
!ls package.json requirements.txt pyproject.toml go.mod Cargo.toml *.csproj Gemfile composer.json mix.exs 2>/dev/null
!ls Dockerfile docker-compose* .dockerignore 2>/dev/null
!cat package.json 2>/dev/null | grep -E '"(main|scripts)"' -A 5 | head -10
Generation Process
Step 1: Analyze Requirements
From project files, determine:
- Base image (node:20-alpine, python:3.12-slim, golang:1.22, rust:1.75, etc.)
- Build steps (install deps, compile, bundle)
- Runtime dependencies (only what's needed to run, not to build)
- Port(s) the application listens on
- Required services (database, cache, message queue)
- Environment variables needed
Step 2: Generate Dockerfile
Multi-stage build pattern:
# Stage 1: Dependencies
FROM base AS deps
COPY lock-file .
RUN install-command
# Stage 2: Build
FROM deps AS build
COPY source .
RUN build-command
# Stage 3: Production
FROM base-slim AS production
COPY --from=build /app/dist ./dist
CMD ["start-command"]
Best practices to include:
- Use specific image tags, not
latest - Use
.dockerignoreto minimize context - Copy lock files before source (layer caching)
- Run as non-root user
- Set HEALTHCHECK
- Use multi-stage builds to minimize final image size
- Set appropriate EXPOSE port
- Use ENTRYPOINT + CMD pattern
Step 3: Generate docker-compose.yml
services:
app:
build: .
ports: ["3000:3000"]
environment: ...
depends_on: ...
volumes: ... # for dev: mount source code
healthcheck: ...
# Add required services
db: # if database detected
redis: # if cache detected
Include:
- Development overrides (volume mounts, hot reload)
- Named volumes for persistent data
- Network configuration
- Health checks for all services
- Environment variable references (not hardcoded values)
Step 4: Generate .dockerignore
node_modules/
.git/
dist/
build/
*.log
.env
.env.*
Step 5: Document
Add comments explaining:
- Why each stage exists
- How to build:
docker build -t app . - How to run:
docker compose up - How to access:
http://localhost:PORT - How to run tests in Docker
Rules
- Never hardcode secrets in Dockerfile or docker-compose
- Always use non-root user in production images
- Always include health checks
- Minimize image size (alpine/slim base, multi-stage)
- Include .dockerignore to speed up builds
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.