dockerfile-optimizer

dockerfile-optimizer is a skill for Claude Code from armanzeroeight/fastagent-plugins. It costs 41 tokens per session (1,340 once invoked), scanned B, original, MIT.

A guide for reviewing Dockerfiles, the instruction files used to build Docker container images, and suggesting changes to them.

In plain words
What is it for?
For choosing smaller base images, ordering layers for better caching, using multi-stage builds, and pinning image versions.
Why use it?
It helps identify avoidable image size, slow builds, poor layer caching, and security issues in the build instructions.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the docker-toolkit plugin — 2 skills shipped together

Good fit For choosing smaller base images, ordering layers for better caching, using multi-stage builds, and pinning image versions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/armanzeroeight/fastagent-plugins/dockerfile-optimizer
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 armanzeroeight/fastagent-plugins --skill dockerfile-optimizer
Clone the repo
git clone --depth 1 https://github.com/armanzeroeight/fastagent-plugins

Made for: Claude Code.

Or install docker-toolkit, the plugin that ships this one along with the rest of its 2 skills.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/armanzeroeight/fastagent-plugins/dockerfile-optimizer/github.svg)](https://agentmods.dev/skills/armanzeroeight/fastagent-plugins/dockerfile-optimizer)
Your own site
<a href="https://agentmods.dev/skills/armanzeroeight/fastagent-plugins/dockerfile-optimizer"><img src="https://agentmods.dev/badge/skills/armanzeroeight/fastagent-plugins/dockerfile-optimizer/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 dockerfile-optimizer

Your own site · 80×15
<a href="https://agentmods.dev/skills/armanzeroeight/fastagent-plugins/dockerfile-optimizer"><img src="https://agentmods.dev/badge/skills/armanzeroeight/fastagent-plugins/dockerfile-optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,340 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. 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.00041 $0.01340
Opus 5.5 $0.00016 $0.00536
Sonnet 5.5 $0.00008 $0.00268
Haiku 4.5 $0.00004 $0.00134

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

Security

Grade B, and why

dockerfile-optimizer scanned grade B with 2 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 2mo 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 deletemediumDestructive command

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

rm -rf /var/lib/apt/lists/*

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

RUN apt-get install -y curl
plugins/docker-toolkit/skills/dockerfile-optimizer/SKILL.md · 261 lines

How it starts

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

Dockerfile Optimizer

Optimize Docker images for size, speed, and security.

Quick Start

Analyze current Dockerfile:

docker build -t myapp .
docker images myapp
# Note the size, then optimize

Instructions

Step 1: Analyze Current Dockerfile

Review for optimization opportunities:

  • Base image choice
  • Layer structure
  • Build dependencies
  • Caching strategy
  • Security practices

Step 2: Optimize Base Image

Choose minimal base:

# Before: Large base
FROM ubuntu:22.04  # ~77MB

# After: Minimal base
FROM alpine:3.18   # ~7MB
# or
FROM node:18-alpine  # ~170MB vs node:18 ~990MB

Use specific tags:

# Bad: Unpredictable
FROM node:latest

# Good: Specific version
FROM node:18.17-alpine3.18

Step 3: Implement Multi-Stage Builds

For compiled languages:

# Before: Single stage
FROM golang:1.21
WORKDIR /app
COPY . .
RUN go build -o app
CMD ["./app"]
# Result: ~800MB

# After: Multi-stage
FROM golang:1.21-alpine AS builder
WORKDIR /app
COPY . .
RUN go build -o app

FROM alpine:3.18
COPY --from=builder /app/app /app
CMD ["/app"]
# Result: ~15MB

Step 4: Optimize Layer Caching

Order by change frequency:

# Bad: Code changes invalidate all layers
FROM node:18-alpine
COPY . .
RUN npm install
CMD ["node", "server.js"]

# Good: Dependencies cached separately
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
CMD ["node", "server.js"]

Step 5: Combine and Minimize Layers

Reduce layer count:

# Before: Multiple layers
RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y git
RUN apt-get clean

# After: Single layer
RUN apt-get update && \
    apt-get install -y curl git && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

Step 6: Use .dockerignore

Create .dockerignore:

node_modules
npm-debug.log
.git
.gitignore
README.md
.env
.DS_Store
*.md
.vscode
.idea
dist
build
coverage

Read the full file on GitHub · 261 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2mo ago First seen · 261 lines · 41 tokens per session scan B 9cedd959b964

Subscribe to this mod's changes

dockerfile-optimizer is a skill published in the GitHub repository armanzeroeight/fastagent-plugins (29 stars, last pushed 3mo ago), licensed MIT. It adds 41 tokens to every session and 1,340 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it B with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

docker-management

Manage and debug Docker containers, images, volumes, networks, Compose stacks, and Dockerfile performance/safety.

metaspartan/cybara · 25 tokens

guizang-ppt-skill

A skill for creating presentation decks as single HTML files that users can move through horizontally in a browser. It provides templates with WebGL backgrounds, chapter title screens, large data displays, and image grids, in either an editorial or Swiss-style visual direction.

proma-ai/Proma · 161 tokens

proma-coach

A Chinese-language coach for improving how people use Proma, Agent, Skill, Chat, and project tools.

proma-ai/Proma · 386 tokens

skill-creator

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

proma-ai/Proma · 64 tokens

automation

A built-in workflow for creating and managing automatic or scheduled tasks. It covers one-time delays, repeated runs, monitoring, reminders, run history, and changing or stopping existing tasks.

proma-ai/Proma · 390 tokens

docx

Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when…

proma-ai/Proma · 168 tokens