Skip to content
Skillpedia
Deploy & cloud (DevOps)29k Β· #9555

docker-development

What it does

This skill guides the agent in writing, optimizing and reviewing Docker container setups. It is for developers who want containers that are quick to build, small in size and safe to run.

When to use it

  • βœ“When your Docker build is slow or your image is too large.
  • βœ“When you want to set up a docker-compose file for a project.
  • βœ“When you want to check a Dockerfile for security problems before shipping it.

Skill link

https://github.com/alirezarezvani/claude-skills/blob/main/engineering/docker-development/skills/docker-development/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/alirezarezvani/claude-skills/blob/main/engineering/docker-development/skills/docker-development/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œMy Docker image is too large and the build is slow. Optimize the Dockerfile for size and caching.”

5 new skills a week. 1 minute to read.

How it works

The agent analyzes the Dockerfile's layers, caching and size, then suggests changes such as multi-stage builds. It also validates compose files and audits security issues in a Dockerfile or a running container.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Docker Development

Smaller images. Faster builds. Secure containers. No guesswork.

Opinionated Docker workflow that turns bloated Dockerfiles into production-grade containers. Covers optimization, multi-stage builds, compose orchestration, and security hardening.

Not a Docker tutorial β€” a set of concrete decisions about how to build containers that don't waste time, space, or attack surface.


Slash Commands

Command What it does
/docker-development optimize Analyze and optimize a Dockerfile for size, speed, and layer caching
/docker-development compose Generate or improve docker-compose.yml with best practices
/docker-development security Audit a Dockerfile or running container for security issues

When This Skill Activates

Recognize these patterns from the user:

  • "Optimize this Dockerfile"
  • "My Docker build is slow"
  • "Create a docker-compose for this project"
  • "Is this Dockerfile secure?"
  • "Reduce my Docker image size"
  • "Set up multi-stage builds"
  • "Docker best practices for [language/framework]"
  • Any request involving: Dockerfile, docker-compose, container, image size, build cache, Docker security

If the user has a Dockerfile or wants to containerize something β†’ this skill applies.


Workflow

/docker-development optimize β€” Dockerfile Optimization

  1. Analyze current state

    • Read the Dockerfile
    • Identify base image and its size
    • Count layers (each RUN/COPY/ADD = 1 layer)
    • Check for common anti-patterns
  2. Apply optimization checklist

    BASE IMAGE
    β”œβ”€β”€ Use specific tags, never :latest in production
    β”œβ”€β”€ Prefer slim/alpine variants (debian-slim > ubuntu > debian)
    β”œβ”€β”€ Pin digest for reproducibility in CI: image@sha256:...
    └── Match base to runtime needs (don't use python:3.12 for a compiled binary)
    
    LAYER OPTIMIZATION
    β”œβ”€β”€ Combine related RUN commands with && \
    β”œβ”€β”€ Order layers: least-changing first (deps before source code)
    β”œβ”€β”€ Clean package manager cache in the same RUN layer
    β”œβ”€β”€ Use .dockerignore to exclude unnecessary files
    └── Separate build deps from runtime deps
    
    BUILD CACHE
    β”œβ”€β”€ COPY dependency files before source code (package.json, requirements.txt, go.mod)
    β”œβ”€β”€ Install deps in a separate layer from code copy
    β”œβ”€β”€ Use BuildKit cache mounts: --mount=type=cache,target=/root/.cache
    └── Avoid COPY . . before dependency installation
    
    MULTI-STAGE BUILDS
    β”œβ”€β”€ Stage 1: build (full SDK, build tools, dev deps)
    β”œβ”€β”€ Stage 2: runtime (minimal base, only production artifacts)
    β”œβ”€β”€ COPY --from=builder only what's needed
    └── Final image should have NO build tools, NO source code, NO dev deps
    
  3. Generate optimized Dockerfile

    • Apply all relevant optimizations
    • Add inline comments explaining each decision
    • Report estimated size reduction
  4. Validate

    python3 scripts/dockerfile_analyzer.py Dockerfile
    

/docker-development compose β€” Docker Compose Configuration

  1. Identify services

    • Application (web, API, worker)
    • Database (postgres, mysql, redis, mongo)
    • Cache (redis, memcached)
    • Queue (rabbitmq, kafka)
    • Reverse proxy (nginx, traefik, caddy)
  2. Apply compose best practices

    SERVICES
    β”œβ”€β”€ Use depends_on with condition: service_healthy
    β”œβ”€β”€ Add healthchecks for every service
    β”œβ”€β”€ Set resource limits (mem_limit, cpus)
    β”œβ”€β”€ Use named volumes for persistent data
    └── Pin image versions
    
    NETWORKING
    β”œβ”€β”€ Create explicit networks (don't rely on default)
    β”œβ”€β”€ Separate frontend and backend networks
    β”œβ”€β”€ Only expose ports that need external access
    └── Use internal: true for backend-only networks
    
    ENVIRONMENT
    β”œβ”€β”€ Use env_file for secrets, not inline environment
    β”œβ”€β”€ Never commit .env files (add to .gitignore)
    β”œβ”€β”€ Use variable substitution: ${VAR:-default}
    └── Document all required env vars
    
    DEVELOPMENT vs PRODUCTION
    β”œβ”€β”€ Use compose profiles or override files
    β”œβ”€β”€ Dev: bind mounts for hot reload, debug ports exposed
    β”œβ”€β”€ Prod: named volumes, no debug ports, restart: unless-stopped
    └── docker-compose.override.yml for dev-only config
    
  3. Generate compose file

    • Output docker-compose.yml with healthchecks, networks, volumes
    • Generate .env.example with all required variables documented
    • Add dev/prod profile annotations

/docker-development security β€” Container Security Audit

  1. **Dockerfile
FAQ

What is a multi-stage build?

It is a Dockerfile that uses one stage to build the app and a smaller stage to run it, so the final image is leaner.

Can it check a running container?

Yes. The security command can audit a Dockerfile or a running container.

Does it help with docker-compose?

Yes. It can generate or improve a docker-compose file using best practices.

Details

Original description by the author

Use for any Dockerfile or docker-compose file to write, optimize or review, before editing it. Checks layers, caching, size and security with dockerfile_analyzer.py and validates compose files with compose_validator.py.

repo: alirezarezvani/claude-skills

Popularity

GitHub stars
29k
Ranking position
#9555
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills