Docker Multi-stage Builder skill for Claude and Codex
Scaffolds a production multi-stage Dockerfile for your language and package manager, with cached dependency installs, a slim runtime stage, a non-root user…
Install it once and Claude or Codex runs it for you. When your request matches, your AI loads the skill, asks for anything it is missing, and works through the template itself. Prefer to fill it in by hand? See the full prompt template.
Download the skill (.zip) · View SKILL.md
When it is used
Use when a new application needs a production multi-stage Dockerfile for its language and package manager with cached installs, a slim runtime, and a non-root user. Do not use for trimming an existing image to a size budget, debugging a running container, or writing Kubernetes or Compose files. Related topics: coding, devops, docker.
What it will ask you for
- Language or platform (choose one: Node.js, Go, Python, Java, Rust, Flutter Web, .NET, Ruby, PHP)
- Package manager (choose one: npm, yarn, pnpm, go mod, pip, poetry, uv, maven, gradle, cargo, bundler, composer)
- Port to expose (free text, e.g. "8080")
- Start command (free text, e.g. "node dist/server.js")
- Use alpine or slim base images (choose one: Yes, No)
- Run as a non-root user (choose one: Yes, No)
- Environment (choose one: Production, Development, Testing)
- Native dependencies (longer free text)
How it works
- Define the dependency stage that copies only manifest and lock files and installs, so the layer caches until dependencies change.
- Define the build stage that copies the source and produces the artefact, and choose the smallest runtime base that can run it.
- Copy only artefacts and production dependencies into the runtime stage, pin every base image, and add the non-root user when requested.
- Add EXPOSE, a HEALTHCHECK on the port, the exec-form start command, and the Development or Testing target when that environment is chosen.
- Comment each stage with what it adds and what it leaves out, and give the docker build command with the target.
What you get
A single fenced Dockerfile block with commented stages (dependencies, build, runtime, plus a dev or test target when chosen), followed by the docker build command to use.
What it watches out for
- Copying the whole source before installing dependencies, which rebuilds the install layer on every code change.
- Running npm install or pip install in the runtime stage, which drags the toolchain and dev dependencies back into the final image.
- Using the shell form of CMD, so signals never reach the process and graceful shutdown breaks.
How to install
Claude.ai and the Claude desktop app
- Download the skill .zip.
- Open Settings, then Capabilities, and find Skills.
- Choose Upload skill and select the .zip.
- Ask Claude for help with the task. It loads the skill when your request matches.
Claude Code
- Download the skill .zip.
- Unzip it into ~/.claude/skills/ (or .claude/skills/ inside a project).
- Start a new session. Claude Code loads the skill when your request matches.
Codex
- Download the skill .zip.
- Unzip it into ~/.agents/skills/ (or .agents/skills/ inside a project).
- Codex picks it up on its own. Type $ and the skill name to use it, or just ask for the task.
Cursor
- Download the Cursor rule (.mdc).
- Save it in .cursor/rules/ inside your project.
- Cursor's agent applies the rule when your request matches its description.
AGENTS.md (Codex, Cursor, and other coding agents)
- Copy the AGENTS.md section.
- Paste it into AGENTS.md at the root of your repository, creating the file if needed.
- Coding agents that read AGENTS.md follow it when your request fits.