skills/infra/docker-specialist/SKILL.md
Docker expertise — Dockerfiles, docker-compose configurations, multi-stage builds, image security, layer caching, and container optimization patterns.
npx skillsauth add devjarus/coding-agent docker-specialistInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Deep expertise in writing production-grade Dockerfiles, docker-compose configurations, and container optimization strategies. Apply this skill when building lean, secure, and cache-efficient container images.
COPY for predictable behavior; use ADD only for auto-extracting archives from URLsENTRYPOINT for the main executable, CMD for default arguments; enable signal forwarding with exec form ["executable", "arg"]CMD/ENTRYPOINT--read-only; mount tmpfs for writable scratch spacenode:20.14-alpine3.19) — never use :latest in productiondepends_on and condition: service_healthyprofiles to separate dev-only services (adminer, mail catchers) from core services.env files and environment variable substitution; document required variablesmem_limit, cpus, and restart policies for production compose stacksdocker-compose.override.yml for local dev overrides on top of a base compose file.dockerignore: Always include a comprehensive .dockerignore to exclude node_modules, .git, test files, and secrets from build contextDOCKER_BUILDKIT=1 and --mount=type=cache for package manager caches in CIRUN commands with && to reduce layer count; but keep cache-busting commands separatelatest to registriesEach container should run exactly one foreground process. Use a process supervisor (s6, tini, dumb-init) as PID 1 only when absolutely required for signal forwarding — prefer simple exec-form entrypoints.
Images are build artifacts, not runtime configuration targets. Everything environment-specific (config, secrets, feature flags) is injected at runtime. The same image artifact is promoted from dev -> staging -> prod.
Structure Dockerfiles so the most frequently changing content comes last:
package.json, requirements.txt, go.mod)The final image stage should contain only what is needed to run the application. Build tools, compilers, test dependencies, and documentation have no place in production images.
docker build and docker run commands to verify the image builds and starts correctlydocker images after building; aim for the smallest possible final image for the use caseApply these skills during your work:
.dockerignore are non-negotiable# syntax=docker/dockerfile:1
# -- Build stage --
FROM node:20.14-alpine3.19 AS builder
WORKDIR /app
COPY package*.json ./
RUN --mount=type=cache,target=/root/.npm \
npm ci --ignore-scripts
COPY . .
RUN npm run build
# -- Runtime stage --
FROM node:20.14-alpine3.19 AS runtime
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
WORKDIR /app
COPY --from=builder --chown=appuser:appgroup /app/dist ./dist
COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules
USER appuser
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget -qO- http://localhost:3000/health || exit 1
ENTRYPOINT ["node", "dist/server.js"]
.dockerignore EssentialsAlways exclude: .git, node_modules, *.log, .env*, coverage/, dist/ (if built inside container), *.md, test/, .DS_Store, CI config files.
version (Compose spec) and named networkshealthcheck on services that others depend on.env.example filetesting
Multi-source research method — decompose a question, fan out parallel investigators, interleaved-think each result, verify claims adversarially, synthesize a cited answer. Use for breadth-heavy research, stack comparisons, "which approach wins" questions.
testing
Decide when to use unit vs integration vs e2e tests, and when to mock vs use the real thing per dependency. Dependency injection is the enabler — without it you end up monkey-patching imports. Apply when writing tests of any kind.
development
Test-driven development process — write failing test, implement to pass, refactor. Use when implementing any feature or fixing bugs.
development
Patterns for sharing types, API contracts, and validation schemas between frontend and backend. Use when multiple domains consume the same data shapes to prevent contract drift.