Use when optimizing Docker builds: layers, cache.
Scanned 9/10/2026
Install to Claude Code
npx -y skills add LoopyLuci/Skills --skill dockerfile-optimization --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Dockerfile Optimization?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/loopyluci-dockerfile-optimization)More formats (shields.io, HTML) on the badges page.
---
name: dockerfile-optimization
description: "Use when optimizing Docker builds: layers, cache."
category: docker
tags: [docker, dockerfile, build, optimization, multistage]
---
# Dockerfile Optimization
Optimizing Docker builds for speed, size, and security.
## Multi-stage Build
```dockerfile
FROM golang:1.21 AS builder
WORKDIR /app; COPY go.mod .; RUN go mod download
COPY . .; RUN CGO_ENABLED=0 go build -o server
FROM alpine:3.18
COPY --from=builder /app/server /server
CMD ["/server"]
```
## Layer Caching
```dockerfile
FROM node:20-alpine
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
```
## Combine RUN
```dockerfile
RUN apt-get update && apt-get install -y curl \\
&& rm -rf /var/lib/apt/lists/*
```
## BuildKit
```powershell
$env:DOCKER_BUILDKIT=1
docker build --no-cache --progress=plain -t myapp .
```
## Pitfalls
- **COPY .** before deps invalidates caches
- **apt install** without cleanup bloats image
- **Distroless** has no shell -- use docker debug
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!
Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.