/devops-skills:image-optimizationfrom devops-skills
Shrinks container image size and build time through base image selection, layer minimization, dependency pruning, .dockerignore, and multi-arch builds. Activated when users report large images, slow builds, or ask about distroless/scratch images.
Ships in devops-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Size and build time are the same problem viewed from two angles: both come from carrying more into the image, and into the build, than the running application needs. A slow build is usually a large one — the layers you push are the layers a runner had to pull, unpack, and cache too.
Optimize by removing, not by compressing after the fact. The fastest layer to pull is the one that was never built.
scratch and distroless bases produce the smallest, lowest-attack-surface images, but they ship
without a shell — a production incident that needs exec-ing in becomes much harder. A
distro-based "slim" variant is usually the right default: small enough to matter, still
debuggable. Reserve scratch for statically-linked binaries (Go, Rust) where you genuinely never
need a shell inside the container, and keep a debug-variant image or an ephemeral debug container
available as a sidecar for when you do.
-slim or distroless for interpreted-language runtimes.scratch only for fully static binaries with no runtime dependency on libc or a shell.Done when: the base is the smallest variant that still supports your actual debugging workflow.
Every RUN, COPY, and ADD is a layer, and layers do not shrink when a later layer deletes
their contents — deleting a file in layer 5 does not reclaim the space it took in layer 3. Chain
related commands with && so temporary files never persist as their own layer, and clean package
manager caches in the same RUN that created them:
RUN apt-get update && apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
Layer order still matters for cache reuse (see containerization), but here the goal is layer
count and content — fewer, tighter layers pull and unpack faster regardless of cache state.
Done when: no layer contains data a later layer only deletes.
Lockfiles routinely pull in test frameworks, linters, and type-checking tools that the running
application never touches. Install with a production flag (npm ci --omit=dev,
pip install --no-deps plus an explicit runtime requirements file) or, better, install
everything in a build stage and copy only node_modules's production subset — or the compiled
artifact — into the runtime stage. This is where multi-stage builds pay off twice: once for
excluding compilers, again for excluding dev-only packages.
Done when: npm ls --omit=dev (or the language equivalent) matches what actually ships in the
runtime image.
A .dockerignore that excludes .git, node_modules, build output, and test fixtures shrinks
both the context sent to the daemon and the chance of a stray COPY . . invalidating cache
unnecessarily. For package managers, use BuildKit cache mounts (RUN --mount=type=cache) so
dependency downloads persist across builds without polluting the final image layers — you get the
speed of a warm cache without paying its size cost in the shipped artifact.
Done when: repeat builds on an unchanged lockfile complete without re-downloading dependencies or bloating the image.
If the fleet runs on both amd64 and arm64 (mixed cloud instance types, Apple Silicon dev
machines), build a single manifest list with docker buildx build --platform linux/amd64,linux/arm64
rather than maintaining parallel Dockerfiles. Watch for base images or dependencies that only
publish one architecture — that gap surfaces as a build failure on one platform, not a warning.
Done when: the pushed manifest resolves correctly on every target architecture without a platform-specific Dockerfile.
docker history and a layer-inspection tool (dive, or docker buildx imagetools inspect) show
exactly what each layer contributed and let you catch an accidental 200MB layer before it ships.
Track image size in CI as a number that can regress, the same way you'd track a performance
benchmark — a size budget that silently creeps up is a slow leak nobody notices until the pull
timeout starts firing.
Done when: you can name the largest layer in the image and justify why it's there.
State the before/after image size, the base image chosen and why, and which stage removed dev dependencies. Name the largest remaining layer and whether it can shrink further — an unexplained large layer is the honest gap, not a size number alone.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
88 skills in this plugin
/alertingCovers designing alerts that page a human only when a human needs to act — symptom-based alerting over cause-based, multi-window burn-rate alerts on error budgets, severity tiers that route between page/ticket/dashboard, requiring every page to link a runbook, and tuning out alert fatigue. Use this whenever the user is writing a new alert rule, asking why on-call is paged too often or missing real incidents, choosing an alert threshold, or designing severity routing. For the SLO the burn-rate math comes from use `slo-definition`, and for what a runbook should contain use `runbooks`./api-gatewayCovers the managed front-door pattern for APIs — request routing, centralized auth, rate limiting and quotas, request/response shaping, and recognizing when a gateway helps versus becomes a bottleneck or single point of failure. Use this whenever the user is designing an API entry point, adding rate limits or quotas, centralizing auth for several backend services, transforming a request between an external and internal contract, or debugging a gateway timeout. For east-west traffic between internal services use `service-connectivity`, and for token issuance details use `iam-access-management`./argocd-operationsCovers running Argo CD day to day — structuring app-of-apps, choosing sync policies and waves, reading health versus sync status correctly, and unsticking a degraded or hung Application. Use this whenever the user mentions Argo CD, an Application stuck "Progressing" or "OutOfSync," app-of-apps or ApplicationSets, sync waves and hooks, or asks why a deploy shows synced but the workload is unhealthy. For the underlying model this tool implements use `gitops`; for automated canary analysis on top of it use `progressive-delivery`; for the workloads it manages use `kubernetes-operations`./artifact-managementVersions, stores, and promotes build outputs — registries, immutability, build-once-promote-many, retention and garbage collection, and provenance metadata. Use this whenever the user sets up an artifact or container registry, asks how to promote a build between environments without rebuilding, needs a retention or cleanup policy, or wants to trace where an artifact came from. For an image's contents and size use `image-optimization`; for vulnerability scanning use `image-scanning`./autoscalingCovers scaling Kubernetes workloads and nodes to demand — HPA on the right metric, VPA, cluster autoscaler, custom/external metrics, avoiding thrash with stabilization windows, and requests as the foundation underneath it all. Use this whenever the user is configuring an HPA, deciding between HPA and VPA, debugging autoscaling that flaps, or sizing a cluster autoscaler. For the requests/limits autoscaling depends on use `kubernetes-operations`; for cost tradeoffs use `cost-optimization`./backup-and-restoreDefines the discipline of building backups you can actually restore under pressure — RPO-driven frequency, restores rehearsed on a schedule, offsite immutable copies, encryption, and treating a backup that has never been restored as equivalent to no backup at all. Use this whenever the user sets up a backup job, chooses a retention policy, argues about RPO or RTO, asks whether current backups are enough, or plans for ransomware or accidental deletion. For the wider recovery plan use `disaster-recovery`, and for stateful platform durability use `stateful-workloads`.npx claudepluginhub arjunprabhulal/devops-skills --plugin devops-skills