Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/stefan-jansen/claude-code-toolkitnpx agentmods add skills/stefan-jansen/claude-code-toolkit/docker-optimizationWrote 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.
[](https://agentmods.dev/skills/stefan-jansen/claude-code-toolkit/docker-optimization)<a href="https://agentmods.dev/skills/stefan-jansen/claude-code-toolkit/docker-optimization"><img src="https://agentmods.dev/badge/skills/stefan-jansen/claude-code-toolkit/docker-optimization/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.
<a href="https://agentmods.dev/skills/stefan-jansen/claude-code-toolkit/docker-optimization"><img src="https://agentmods.dev/badge/skills/stefan-jansen/claude-code-toolkit/docker-optimization.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00065 | $0.04051 |
| Opus 5.5 | $0.00026 | $0.01620 |
| Sonnet 5.5 | $0.00013 | $0.00810 |
| Haiku 4.5 | $0.00006 | $0.00405 |
Grade B, and why
docker-optimization scanned grade B with 3 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 3mo 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.
Asks for rootlowPrivilege escalation
A mod that escalates privileges can change anything on the machine, not only the project.
### Don't Run as Root Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.
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 update && apt-get install -y curl How it starts
The opening of the file, as written. The whole thing — 671 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Docker Optimization Patterns
Comprehensive guide to optimizing Docker images for size, build speed, and security. Covers multi-stage builds, layer caching strategies, security hardening, and production deployment patterns.
Quick Reference
When to use this skill:
- Building production Docker images
- Optimizing image size (reducing from 500MB+ to <100MB)
- Improving Docker build times
- Implementing Docker security best practices
- Debugging slow builds or large images
- Setting up Docker for microservices
Common triggers:
- "My Docker image is too large"
- "Docker builds take forever"
- "How do I optimize this Dockerfile"
- "Docker security best practices"
- "Multi-stage build pattern"
Part 1: Multi-Stage Builds
The Problem: Bloated Images
Typical single-stage Dockerfile (800MB+ image):
FROM python:3.11
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
CMD ["python", "app.py"]
Problems:
- Includes build tools (gcc, make, etc.) - 300MB+
- Includes pip cache - 100MB+
- Includes source .git directory - 50MB+
- Includes test files and dev dependencies - 50MB+
- Total: 800MB+ for simple Python app
The Solution: Multi-Stage Pattern
Optimized multi-stage Dockerfile (120MB image):
# Stage 1: Builder
FROM python:3.11-slim AS builder
WORKDIR /app
# Install build dependencies in separate layer
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy only requirements first (cache optimization)
COPY requirements.txt .
RUN pip install --user --no-cache-dir -r requirements.txt
# Stage 2: Runtime
FROM python:3.11-slim
WORKDIR /app
# Copy only Python packages from builder
COPY --from=builder /root/.local /root/.local
# Copy only application code
COPY app.py .
COPY src/ ./src/
# Make sure scripts in .local are usable
ENV PATH=/root/.local/bin:$PATH
# Run as non-root user
RUN useradd -m appuser && chown -R appuser:appuser /app
USER appuser
CMD ["python", "app.py"]
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.
- 3mo ago First seen · 671 lines · 65 tokens per session scan B 7a7c19073f7c
docker-optimization is a skill published in the GitHub repository stefan-jansen/claude-code-toolkit (101 stars, last pushed 5mo ago), licensed MIT. It adds 65 tokens to every session and 4,051 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it B with 3 findings (asks for root, 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.
docker-optimization compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| docker-optimizationstefan-jansen/claude-code-toolkit | Skill | 101 | 5mo ago | MIT | B | 65 | Claude Code, Codex |
| agent-cloud-architecttravisjneuman/.claude | Skill | 116 | today | MIT | A | 75 | Claude Code |
| agent-devops-engineertravisjneuman/.claude | Skill | 116 | today | MIT | A | 12 | Claude Code |
| docker-image-hardeningFluxonLab/Skillry | Skill | 13 | 6d ago | none | A | 54 | Claude Code |
| multi-stage-dockerfileFluxonLab/Skillry | Skill | 13 | 6d ago | none | A | 17 | Claude Code, Codex |
| sbom-syftAgentSecOps/SecOpsAgentKit | Skill | 239 | 7mo ago | none | A | 133 | Claude Code, Codex |
| container-grypeAgentSecOps/SecOpsAgentKit | Skill | 239 | 7mo ago | none | A | 134 | Claude Code, Codex |