.claude/skills/ts-docker-helper/SKILL.md
Build, debug, and optimize Docker configurations. Use when a user asks to create a Dockerfile, fix Docker build errors, optimize image size, write docker-compose files, debug container issues, set up multi-stage builds, or troubleshoot networking between containers. Covers Dockerfile best practices and compose orchestration.
npx skillsauth add eliferjunior/Claude docker-helperInstall 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.
Create, debug, and optimize Docker configurations including Dockerfiles, docker-compose setups, and container troubleshooting. Follows Docker best practices for security, image size, and build speed.
When a user asks for help with Docker, determine which task they need:
-slim or -alpine variants)# Stage 1: Build
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
# Stage 2: Runtime
FROM node:20-alpine
WORKDIR /app
RUN addgroup -g 1001 appgroup && adduser -u 1001 -G appgroup -D appuser
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
USER appuser
EXPOSE 3000
CMD ["node", "dist/index.js"]
Key rules:
.dockerignore to exclude node_modules, .git, .envnode:20.11-alpine, not node:latest)version: "3.8"
services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- "3000:3000"
environment:
- DATABASE_URL=postgres://user:pass@db:5432/myapp
depends_on:
db:
condition: service_healthy
restart: unless-stopped
db:
image: postgres:16-alpine
volumes:
- pgdata:/var/lib/postgresql/data
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: pass
POSTGRES_DB: myapp
healthcheck:
test: ["CMD-SHELL", "pg_isready -U user -d myapp"]
interval: 5s
timeout: 5s
retries: 5
volumes:
pgdata:
Key rules:
depends_on with health checks, not just service namesFollow this diagnostic sequence:
# 1. Check container status
docker ps -a
# 2. Read container logs
docker logs <container> --tail 50
# 3. Inspect container details
docker inspect <container> | jq '.[0].State'
# 4. Check resource usage
docker stats --no-stream
# 5. Get a shell inside the container
docker exec -it <container> /bin/sh
# 6. Check networking
docker network ls
docker network inspect <network>
Common issues and fixes:
lsof -i :PORT to find the conflictdocker system prune -a to clean up unused images and containers.dockerignore and verify paths are relative to build context# Check current image size
docker images | grep myapp
# Analyze layers
docker history myapp:latest
Optimization checklist:
&&rm -rf /var/cache/apk/*.dockerignore to exclude test files, docs, .gitUser request: "Create a Dockerfile for my FastAPI project"
Output Dockerfile:
FROM python:3.12-slim AS builder
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
FROM python:3.12-slim
WORKDIR /app
RUN useradd -r -s /bin/false appuser
COPY --from=builder /install /usr/local
COPY . .
USER appuser
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
Output .dockerignore:
__pycache__
*.pyc
.git
.env
.venv
tests/
*.md
Result: Image size ~180MB instead of ~1.2GB with the full Python image.
User request: "My web container keeps restarting, can you help?"
Diagnostic steps:
$ docker ps -a
CONTAINER ID IMAGE STATUS NAMES
a1b2c3d4e5f6 web:1.0 Restarting (1) 5 sec ago web
$ docker logs web --tail 20
Error: ECONNREFUSED 127.0.0.1:5432
at TCPConnectWrap.afterConnect
Root cause: The app is trying to connect to PostgreSQL at 127.0.0.1,
but in Docker the database is a separate container.
Fix: Change DATABASE_URL from localhost to the service name:
DATABASE_URL=postgres://user:pass@db:5432/myapp
^^ service name, not localhost
.dockerignore alongside any Dockerfile.latest.docker images.development
Expert guidance for Fireworks AI, the platform for running open-source LLMs (Llama, Mixtral, Qwen, etc.) with enterprise-grade speed and reliability. Helps developers integrate Fireworks' inference API, fine-tune models, and deploy custom model endpoints with function calling and structured output support.
development
Convert any website into clean, structured data with Firecrawl — API-first web scraping service. Use when someone asks to "turn a website into markdown", "scrape website for LLM", "Firecrawl", "extract website content as clean text", "crawl and convert to structured data", or "scrape website for RAG". Covers single-page scraping, full-site crawling, structured extraction, and LLM-ready output.
tools
Expert guidance for Firebase, Google's platform for building and scaling web and mobile applications. Helps developers set up authentication, Firestore/Realtime Database, Cloud Functions, hosting, storage, and analytics using Firebase's SDK and CLI.
development
When the user needs to build file upload functionality for a web application. Use when the user mentions "file upload," "image upload," "upload endpoint," "multipart upload," "presigned URL," "S3 upload," "file validation," "upload to cloud storage," or "accept user files." Handles upload endpoints, file validation (type, size, magic bytes), cloud storage integration, and upload status tracking. For image/video processing after upload, see media-transcoder.