write-dockerfile
Skill4 starsChanged 48 days agoMITView on GitHub
Writes or updates Dockerfiles and their build contexts. Use when asked to create or update container image builds or runtime packaging.
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- domain-modelingSkill
- fix-github-workflowSkill
- fix-gitlab-pipelineSkill
- fix-uds-core-k3d-deploymentSkill
- fix-uds-core-k8s-workloadSkill
- read-gitlab-work-itemsSkill
- write-agent-skillSkill
- write-changelogSkill
- write-docker-composeSkill
- write-github-actions-workflowSkill
- write-go-bubble-teaSkill
- write-go-codeSkill
- write-makefileSkill
- write-markdown-textSkill
- write-python-codeSkill
- write-python-djangoSkill
- write-rustSkill
- write-textSkill
- write-vex-statementSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Read and apply write-text from the active skill catalog or sibling skill when drafting comments or explanations.
- Distinctive: line 16
Use named multi-stage builds when build tools or intermediate artifacts are unnecessary at runtime.
- Distinctive: line 18
Put dependency manifests and their installation before frequently changing source files when that preserves correct cache invalidation.
- Distinctive: line 22
Prefer a nonroot runtime user when compatible with application permissions and mounted files.
- Very specific: line 24
Never put secrets in ARG, ENV, copied files, or image layers.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
How to Write a Dockerfile
Inspect the existing Dockerfile, build context, dependency manifests, image consumers, and runtime requirements before editing. Preserve required entrypoints, ports, architecture support, and artifact paths. Apply changes to the requested image rather than imposing a new deployment workflow.
Read and apply write-text from the active skill catalog or sibling skill when drafting comments or explanations. Reuse it if already loaded.
Image Design
Choose a maintained base image compatible with the application's runtime and native dependencies. Preserve the project's tag or digest policy. A smaller image is useful only when it still supplies required libraries, certificates, and runtime files.
Use named multi-stage builds when build tools or intermediate artifacts are unnecessary at runtime. Copy only required outputs into the final stage. Inspect linking requirements before choosing a minimal runtime image.
Put dependency manifests and their installation before frequently changing source files when that preserves correct cache invalidation. Use build cache mounts when useful and supported. Keep .dockerignore aligned with the actual context, excluding secrets, local environments, and unnecessary artifacts without excluding required inputs.
Runtime and Secrets
Prefer a nonroot runtime user when compatible with application permissions and mounted files. Set ownership for required writable paths instead of granting broad permissions. Use exec-form entrypoints and commands when the application should receive process signals directly.
Never put secrets in ARG, ENV, copied files, or image layers. Use BuildKit secret or SSH mounts for build credentials and the deployment's existing mechanism for runtime secrets. Removing a file in a later layer does not remove it from earlier layers.
Verification
Build the actual Dockerfile with its intended context, target, and platform. Run a disposable container with representative required configuration and check startup, the relevant command or endpoint, permissions, and shutdown. Keep credentials out of logs. A successful build alone does not verify runtime behavior.
Report the image changes and checks actually completed. If Docker or required dependencies are unavailable, identify the missing runtime checks. Do not push images or change a deployment unless the task authorizes it.
Official References
- Docker build best practices for image design, caching, and context exclusions.
- Multi-stage builds for stage selection and artifact copying.
- Build secrets for credential mounts.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

