Docker Image Optimizer Devops

Docker Image Optimizer Devops is a skill for Claude Code, Codex from vivek-viswanat/dev-arsenal. It costs 27 tokens per session (525 once invoked), scanned B, original, MIT.

A guide for reviewing and improving Dockerfiles, which are instructions for building application containers. It focuses on image size, build speed, dependency handling, and reducing security risks.

In plain words
What is it for?
Use it when creating or reviewing Dockerfiles, choosing a smaller base image, splitting build and runtime stages, improving build caching, and cleaning up installed dependencies.
Why use it?
It helps avoid oversized containers, slow rebuilds, unnecessary packages, and extra software that increases the attack surface.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/vivek-viswanat/dev-arsenal/docker-image-optimizer-devops
Any agent
npx skills add vivek-viswanat/dev-arsenal --skill docker-image-optimizer-devops
Clone the repo
git clone --depth 1 https://github.com/vivek-viswanat/dev-arsenal

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 Docker Image Optimizer Devops

README.md
[![agentmods](https://agentmods.dev/badge/skills/vivek-viswanat/dev-arsenal/docker-image-optimizer-devops.svg)](https://agentmods.dev/skills/vivek-viswanat/dev-arsenal/docker-image-optimizer-devops)
Your own site
<a href="https://agentmods.dev/skills/vivek-viswanat/dev-arsenal/docker-image-optimizer-devops"><img src="https://agentmods.dev/badge/skills/vivek-viswanat/dev-arsenal/docker-image-optimizer-devops.svg" alt="Measured on agentmods" height="20"></a>
Per session 27 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 525 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
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 $0.00027 $0.00525
Opus 5 $0.00014 $0.00262
Sonnet 5 $0.00005 $0.00105
Haiku 4.5 $0.00003 $0.00052

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

Security

Grade B, and why

Docker Image Optimizer Devops scanned grade B 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 deletemediumDestructive command

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

*Example:* `RUN apt-get update && apt-get install -y --no-install-recommends pkg && 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.

skills/docker-image-optimizer-devops/SKILL.md · 38 lines

What it actually says

Context

Use this skill when:

  1. Creating a new Dockerfile
  2. A user complains about "slow builds" or "large images"
  3. Reviewing container security (reducing attack surface)

Optimization Pillars

1. Multi-Stage Strategy (The 2026 Standard)

  • Separate Build from Runtime: Use a heavy image (with compilers/SDKs) for building, but copy ONLY the final binary/artifacts into a minimal runtime image (Alpine or Scratch).
  • Named Stages: Use FROM base AS builder for readability.

2. Base Image Selection

  • Prefer Minimal: Default to alpine (≈5MB) or debian-slim (≈30MB) over ubuntu:latest (≈75MB).
  • Distroless: For production, suggest gcr.io/distroless to remove all shells and package managers.

3. Layer Management & Caching

  • Order Matters: Place instructions that change least often (like RUN apt-get update) at the top. Place source code COPY commands at the bottom.
  • Atomic RUNs: Combine related commands using && and \ to prevent intermediate layer bloat. Example: RUN apt-get update && apt-get install -y --no-install-recommends pkg && rm -rf /var/lib/apt/lists/*

4. Dependency Hygiene

  • No-Install-Recommends: Always use --no-install-recommends with apt.
  • Cache Cleaning: Remove package manager caches in the same layer as the installation.
  • Production Only: Ensure devDependencies or build-only headers never reach the final stage.

5. The .dockerignore File

  • Exclusion: Every Docker project MUST have a .dockerignore to prevent .git, node_modules, tests/, and local logs from leaking into the build context.

Instructions for the Agent

  • When a user provides a Dockerfile, perform a Size Audit first.
  • If the image is single-stage, provide a Refactored Multi-Stage Version.
  • Check for "Magic Versions" and suggest pinning specific tags (e.g., node:22.1.0-alpine instead of node:latest).
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 · 38 lines · 27 tokens per session scan B ae04a43aa25f

Subscribe to this mod's changes

Docker Image Optimizer Devops is a skill published in the GitHub repository vivek-viswanat/dev-arsenal (4 stars, last pushed 5mo ago), licensed MIT. It adds 27 tokens to every session and 525 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.