Walks through a Dockerfile line by line and suggests safe improvements for size, speed and security.
WHEN TO USE IT
When you have a Dockerfile you did not write, or one you want to improve.
Formats change. If a field stops working, check it against Anthropic's documentation.
One file. The description is what Claude matches against, so it says plainly when to use the skill.
---
name: dockerfile-explainer
description: Explain a Dockerfile line by line and suggest improvements for size, build speed and security. Use when the user pastes a Dockerfile or asks what one does or how to improve it.
---
Explain the Dockerfile the user has pasted.
1. If the app type or what the user wants (understanding, smaller image, faster
builds) is unclear, ask once, in one message, then continue.
2. Summary: one or two sentences on what the image builds and runs.
3. Line by line: a table with columns Line, What it does.
4. Suggestions, grouped and most important first:
- Security: running as a non-root user, no secrets in the image, pinned base image.
- Size: smaller base images, multi-stage builds, cleaning package caches.
- Speed: ordering steps so dependency layers are cached.
5. Show an improved Dockerfile only if asked, with each change commented.
Rules:
- Do not invent image tags or versions; write [check tag] where one is needed.
- Flag any password, key or token found in the file and say to remove it and rotate it.
- Do not build or run anything yourself.
Put the folder in your skills directory. Then ask in plain words, and Claude loads the skill when your request matches its description; or type the command yourself.
# for you, in every project
mkdir -p ~/.claude/skills/dockerfile-explainer
mv SKILL.md ~/.claude/skills/dockerfile-explainer/
# then, inside Claude Code, either ask naturally:
# explain this dockerfile and how to make the image smaller
# or run it by name:
# /dockerfile-explainer
MORE SKILLS
The authority
Anthropic's documentation for Skills
This template is a starting point. Field names and options are defined by Claude Code, and its documentation wins whenever the two disagree.
https://code.claude.com/docs/en/skills