write-dockerfile

write-dockerfile is a skill for Claude Code, Codex from soulcodex/agentic. It costs 61 tokens per session (712 once invoked), scanned A, original, MIT.

A guide for creating or improving a Dockerfile, the recipe used to build an application's container image. It covers the build process, runtime setup, caching, image size, and safer execution.

In plain words
What is it for?
Use it when creating a production Docker image, improving an existing image build, or preparing an application to run in a container.
Why use it?
It helps avoid unnecessarily large images, slow rebuilds, unsafe permissions, and accidentally including secrets in the image.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Codex; mentions OpenCode.

Good fit Use it when creating a production Docker image, improving an existing image build, or preparing an application to run in a container.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/soulcodex/agentic/write-dockerfile
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add soulcodex/agentic --skill write-dockerfile
Clone the repo
git clone --depth 1 https://github.com/soulcodex/agentic

Made for: Claude Code, Codex.

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 write-dockerfile

README.md
[![agentmods](https://agentmods.dev/badge/skills/soulcodex/agentic/write-dockerfile/github.svg)](https://agentmods.dev/skills/soulcodex/agentic/write-dockerfile)
Your own site
<a href="https://agentmods.dev/skills/soulcodex/agentic/write-dockerfile"><img src="https://agentmods.dev/badge/skills/soulcodex/agentic/write-dockerfile/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for write-dockerfile

Your own site · 80×15
<a href="https://agentmods.dev/skills/soulcodex/agentic/write-dockerfile"><img src="https://agentmods.dev/badge/skills/soulcodex/agentic/write-dockerfile.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 712 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00061 $0.00712
Opus 5.5 $0.00024 $0.00285
Sonnet 5.5 $0.00012 $0.00142
Haiku 4.5 $0.00006 $0.00071

Measured 1mo ago against content hash 02743cc4d1f3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

write-dockerfile scanned grade A with 0 findings 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 1mo 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/devops/write-dockerfile/SKILL.md · 97 lines

How it starts

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

Write Dockerfile Skill

Create a production-ready Dockerfile for the current project. Scope boundary: Dockerfile and image concerns only. For local multi-service orchestration (compose.yaml, service dependencies/readiness, env files, volumes, migrations/seeds), use docker-compose-local-setup.

Step 1 — Detect Language and Framework

Read: package.json, go.mod, pyproject.toml, composer.json, or other manifest files. Identify:

  • Runtime and version (Node 22, Go 1.26, Python 3.12, PHP 8.3)
  • Build process (compile, bundle, install dependencies)
  • Entry point / start command

Step 2 — Apply Dockerfile Build and Runtime Best Practices

Multi-stage build: separate build stage from runtime stage to keep the final image small.

Layer caching: copy dependency manifests first, install, then copy source. This caches the dependency install layer and only invalidates it when dependencies change.

Non-root user: run the application as a non-root user in the final stage.

Minimal base image: use official slim/alpine variants for the runtime stage.

Health check: include a HEALTHCHECK instruction when the runtime supports it.

No secrets in the image: all secrets come from environment variables at runtime.

Step 3 — Write the Dockerfile

Structure:

# syntax=docker/dockerfile:1
# Stage 1: Build
FROM {build-image} AS builder
WORKDIR /app
# Copy manifests first (cache layer)
COPY {manifest-files} ./
RUN {install-dependencies}
# Copy source and build
COPY . .
RUN {build-command}

# Stage 2: Runtime
FROM {runtime-image}
WORKDIR /app
RUN addgroup --system app && adduser --system --ingroup app app
# Copy only what is needed to run
COPY --from=builder /app/{output} .
USER app
EXPOSE {port}
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
  CMD {health-check-command}
CMD ["{start-command}"]

Step 4 — Write .dockerignore

Also create or update .dockerignore to exclude:

  • .git/
  • node_modules/ (for Node projects)
  • test files, coverage reports
  • .env files
  • *.md documentation files

Read the full file on GitHub · 97 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. 1mo ago First seen · 97 lines · 61 tokens per session scan A 02743cc4d1f3

Subscribe to this mod's changes

write-dockerfile is a skill published in the GitHub repository soulcodex/agentic (10 stars, last pushed 28d ago), licensed MIT. It adds 61 tokens to every session and 712 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

harbor

CLI toolkit for managing containerized LLM services. Use when the user wants to start, stop, configure, or manage AI/LLM services like Ollama, Open WebUI, llama.cpp, vLLM, LiteLLM, ComfyUI, and 250+ others. Triggers on requests to "run a model", "start ollama", "set up an LLM", "configure harbor", "manage services"…

av/harbor · 114 tokens

agentbox-info

Spin up isolated sandboxes ("boxes") for coding agents, run them in parallel, queue background runs with -i, and push commits safely through the host relay. Use when the user wants to run Claude Code / Codex / OpenCode in a sandbox, start more boxes, attach to a running box, or otherwise operate the agentbox CLI on…

madarco/agentbox · 79 tokens

04-security

A security and operations guide for deploying Dify, an open-source platform for building AI applications, in production.

skillmds/skillmd · 36 tokens

run-app

Build and start the Mendix app in Docker, and restart it after changes. Use when asked to run, launch or restart the app in a container. For the fast inner loop prefer run-local.

mendixlabs/mxcli · 43 tokens

agentbox

Fork the current agent session into a new VM or local Docker container with all the project files, agent settings and session teleported into.

madarco/agentbox · 30 tokens

deployment

Use when taking an app from source to live: choosing the deploy target from requirements (Hetzner+Coolify vs Vercel vs a third), then wiring container → CI → registry → host with build secrets, healthchecks and rollback. NOT one platform's mechanics (that is coolify, vercel, railway, render), NOT the Dockerfile alone…

ericrisco/rsc-harness · 86 tokens