create-multistage-dockerfile

create-multistage-dockerfile is a skill for Claude Code from pjt222/agent-almanac. It costs 89 tokens per session (1,952 once invoked), scanned C, original, MIT.

A Dockerfile that builds an application in one environment and runs it in another, smaller environment. It leaves compilers, test tools, and source code out of the production image.

In plain words
What is it for?
Creating production Docker images for compiled or packaged applications, including projects using npm, pip, Go, Rust, or Maven. It also helps prepare images for edge and serverless deployments.
Why use it?
It helps reduce image size and keeps build-only tools out of the deployed application. It can also produce separate development and production images from one file.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /server ./cmd/server.

Part of the agent-almanac plugin — 122 skills, 76 agents shipped together

Good fit Creating production Docker images for compiled or packaged applications, including projects using npm, pip, Go, Rust, or Maven. It also helps prepare images for edge and serverless deployments.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/pjt222/agent-almanac
agentmods
npx agentmods add skills/pjt222/agent-almanac/create-multistage-dockerfile

Made for: Claude Code.

Or install agent-almanac, the plugin that ships this one along with the rest of its 122 skills, 76 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for create-multistage-dockerfile

README.md
[![agentmods](https://agentmods.dev/badge/skills/pjt222/agent-almanac/create-multistage-dockerfile.svg)](https://agentmods.dev/skills/pjt222/agent-almanac/create-multistage-dockerfile)
Your own site
<a href="https://agentmods.dev/skills/pjt222/agent-almanac/create-multistage-dockerfile"><img src="https://agentmods.dev/badge/skills/pjt222/agent-almanac/create-multistage-dockerfile.svg" alt="Measured on agentmods" height="20"></a>
Per session 89 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,952 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00089 $0.01952
Opus 5 $0.00044 $0.00976
Sonnet 5 $0.00018 $0.00390
Haiku 4.5 $0.00009 $0.00195

Measured 4d ago against content hash 44d567b4f055, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade C, and why

create-multistage-dockerfile scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

RUN apt-get update && apt-get install -y musl-tools && rm -rf /var/lib/apt/lists/*
i18n/caveman-lite/skills/create-multistage-dockerfile/SKILL.md · 230 lines

How it starts

The opening of the file, as written. The whole thing — 230 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Create Multi-Stage Dockerfile

Build multi-stage Dockerfiles that produce minimal production images by separating build tooling from runtime.

When to Use

  • Production images are too large (>500MB for compiled languages)
  • Build tools (compilers, dev headers) are included in the final image
  • Need separate images for development and production from one Dockerfile
  • Deploying to constrained environments (edge, serverless)

Inputs

  • Required: Existing Dockerfile or project to containerize
  • Required: Language and build system (npm, pip, go build, cargo, maven)
  • Optional: Target runtime base (slim, alpine, distroless, scratch)
  • Optional: Size budget for final image

Procedure

Step 1: Identify Build vs Runtime Dependencies

Category Build Stage Runtime Stage
Compilers gcc, g++, rustc Not needed
Package managers npm, pip, cargo Sometimes (interpreted langs)
Dev headers -dev packages Not needed
Source code Full source tree Only compiled output
Test frameworks jest, pytest Not needed

Step 2: Structure the Multi-Stage Build

The core pattern: build in a fat image, copy artifacts to a slim image.

# ---- Build Stage ----
FROM <build-image> AS builder
WORKDIR /src
COPY <dependency-manifest> .
RUN <install-dependencies>
COPY . .
RUN <build-command>

# ---- Runtime Stage ----
FROM <runtime-image>
COPY --from=builder /src/<artifact> /<dest>
EXPOSE <port>
CMD [<entrypoint>]

Step 3: Apply Language-Specific Patterns

Node.js (pruned node_modules)
FROM node:22-bookworm AS builder
WORKDIR /src
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build && npm prune --omit=dev

FROM node:22-bookworm-slim
RUN groupadd -r app && useradd -r -g app app
WORKDIR /app
COPY --from=builder /src/dist ./dist
COPY --from=builder /src/node_modules ./node_modules
COPY --from=builder /src/package.json .
USER app
EXPOSE 3000
CMD ["node", "dist/index.js"]

Read the full file on GitHub · 230 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 230 lines · 89 tokens per session scan C 44d567b4f055

Subscribe to this mod's changes

create-multistage-dockerfile is a skill published in the GitHub repository pjt222/agent-almanac (32 stars, last pushed today), licensed MIT. It adds 89 tokens to every session and 1,952 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

wrangler

Run or troubleshoot Wrangler CLI commands and configure Worker projects for local development, deployment, and Cloudflare resource management.

cloudflare/skills · 25 tokens

managing-astro-local-env

Manage local Airflow environment with Astro CLI (Docker and standalone modes). Use when the user wants to start, stop, or restart Airflow, view logs, query the Airflow API, troubleshoot, or fix environment issues. For project setup, see setting-up-astro-project.

astronomer/agents · 63 tokens

analytics

Queries local analytics across OrchestKit projects for agent usage, skill frequency, hook timing, team activity, session replay, cost estimation, and model delegation trends. Privacy-safe with hashed project IDs. Supports time-range filtering and comparative analysis. Use when reviewing performance, estimating costs…

yonatangross/orchestkit · 62 tokens

aws-cloudformation-ecs

Provides AWS CloudFormation patterns for ECS clusters, task definitions, services, container definitions, auto scaling, blue/green deployments, CodeDeploy integration, ALB integration, service discovery, monitoring, logging, template structure, parameters, outputs, and cross-stack references. Use when creating ECS…

giuseppe-trisciuoglio/developer-kit · 101 tokens

aws-cloudformation-task-ecs-deploy-gh

Provides patterns to deploy ECS tasks and services with GitHub Actions CI/CD. Use when building Docker images, pushing to ECR, updating ECS task definitions, deploying ECS services, integrating with CloudFormation stacks, configuring AWS OIDC authentication for GitHub Actions, and implementing production-ready…

giuseppe-trisciuoglio/developer-kit · 106 tokens

loom-kubernetes

Kubernetes deployment, cluster architecture, security, and operations.

cosmix/loom · 16 tokens