agentskills.codes

Creates or optimizes a Dockerfile for the current project

Install

mkdir -p .claude/skills/docker-build && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/16237" && unzip -o skill.zip -d .claude/skills/docker-build && rm skill.zip

Installs to .claude/skills/docker-build

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Creates or optimizes a Dockerfile for the current project
57 charsno explicit “when” trigger

About this skill

Docker Setup

  1. Detect project type:
cat package.json 2>/dev/null | grep '"main"\|"start"\|"scripts"' -A 5
ls -la | grep -E "Dockerfile|docker-compose|\.dockerignore"
  1. If Dockerfile exists, review it for:

    • Multi-stage build (build stage vs runtime stage)
    • Layer caching order (dependencies before source)
    • Running as non-root user
    • .dockerignore completeness
    • Image size optimization
  2. If no Dockerfile, generate one following best practices:

# Multi-stage: build → runtime
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production

FROM node:20-alpine AS runtime
RUN addgroup -S app && adduser -S app -G app
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY . .
USER app
EXPOSE 3000
CMD ["node", "dist/index.js"]
  1. Also create/update .dockerignore:
node_modules
dist
.env*
.git
coverage
*.test.*
  1. Show docker build and docker run commands to test.

Search skills

Search the agent skills registry