/devops:docker-first-developmentfrom devops
Enforces a Docker-first development workflow: all commands (npm, pip, pytest, etc.) must run inside containers. Automatically scaffolds Dockerfiles and docker-compose files, blocks local execution, and provides standards for Python and Node.js projects.
Ships in devops. 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.
STATUS: Can be enabled/disabled via
.claude/config.json→features.docker_first_development
ALL development MUST happen inside Docker containers:
# ❌ FORBIDDEN - Local execution
npm install
npm test
python app.py
pytest
# ✅ REQUIRED - Docker execution
docker compose run app npm install
docker compose run app npm test
docker compose run app python app.py
docker compose run test pytest
Every project MUST have:
project/
├── Dockerfile # Production image
├── Dockerfile.dev # Development image with dev tools
├── docker compose.yml # Production-like setup
├── docker compose.dev.yml # Development overrides
├── docker compose.test.yml # Test environment
└── .dockerignore # Exclude unnecessary files
# 1. Check if Docker files exist
if [ ! -f "Dockerfile" ]; then
Use devops:docker-containerization-expert agent to create Dockerfile
fi
# 2. Build development image
docker compose -f docker compose.yml -f docker compose.dev.yml build
# 3. Start development environment
docker compose -f docker compose.yml -f docker compose.dev.yml up
# docker compose.dev.yml
services:
app:
volumes:
- .:/app # Mount source code
- /app/node_modules # Preserve container node_modules
- /app/.venv # Preserve Python venv
command: npm run dev # Hot reload
# Always in container
docker compose run --rm test pytest
docker compose run --rm test npm test
# CI/CD uses same image
docker build -t app:test .
docker run app:test pytest
When docker_first_development is enabled:
1. Hook intercepts local commands (npm, pip, python, etc.)
2. Checks if Docker alternative exists
3. Blocks execution with Docker alternative suggestion
4. Auto-creates Docker files if missing
# Dockerfile.dev
FROM python:3.11-slim AS development
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "-m", "flask", "run", "--host=0.0.0.0", "--reload"]
# Dockerfile (production)
FROM python:3.11-slim AS production
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["gunicorn", "app:app"]
# Dockerfile.dev
FROM node:20-alpine AS development
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
CMD ["npm", "run", "dev"]
# Dockerfile (production)
FROM node:20-alpine AS production
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
CMD ["node", "server.js"]
version: '3.9'
services:
app:
build: .
ports:
- "3000:3000"
environment:
- NODE_ENV=production
networks:
- app-network
networks:
app-network:
driver: bridge
version: '3.9'
services:
app:
build:
context: .
dockerfile: Dockerfile.dev
volumes:
- .:/app
- /app/node_modules # Preserve dependencies
environment:
- NODE_ENV=development
- DEBUG=true
ports:
- "3000:3000"
- "9229:9229" # Debug port
version: '3.9'
services:
test:
build:
context: .
dockerfile: Dockerfile.dev
command: npm test
environment:
- NODE_ENV=test
- CI=true
# .github/workflows/test.yml
name: Test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Test Image
run: docker build -f Dockerfile.dev -t app:test .
- name: Run Tests in Container
run: docker run --rm app:test npm test
- name: Run Linting in Container
run: docker run --rm app:test npm run lint
# Development volumes for hot reload
volumes:
# Source code - always mounted
- ./src:/app/src
- ./tests:/app/tests
# Config files - mounted read-only
- ./package.json:/app/package.json:ro
- ./tsconfig.json:/app/tsconfig.json:ro
# Dependencies - NOT mounted (use container's)
# - ./node_modules:/app/node_modules ❌
# - ./.venv:/app/.venv ❌
# docker compose.dev.yml
services:
app:
depends_on:
- db
- redis
db:
image: postgres:15-alpine
environment:
POSTGRES_DB: appdb
POSTGRES_USER: appuser
POSTGRES_PASSWORD: devpassword
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
postgres_data:
Create a Makefile for common operations:
# Makefile
.PHONY: dev test build clean
# Development
dev:
docker compose -f docker compose.yml -f docker compose.dev.yml up
dev-build:
docker compose -f docker compose.yml -f docker compose.dev.yml build
# Testing
test:
docker compose -f docker compose.yml -f docker compose.test.yml run --rm test
test-watch:
docker compose -f docker compose.yml -f docker compose.test.yml run --rm test npm run test:watch
# Production
build:
docker build -t app:latest .
run:
docker run -p 3000:3000 app:latest
# Utilities
shell:
docker compose -f docker compose.yml -f docker compose.dev.yml exec app sh
logs:
docker compose logs -f app
clean:
docker compose down -v
docker system prune -f
When docker_first_development: false in config:
When docker_first_development is enabled, ALL PRs MUST:
# Manual validation before creating PR
./.claude/scripts/pr-validation.sh
# Install Git hooks for automatic validation
./.claude/scripts/install-hooks.sh
PR will automatically run:
Dockerfile - Production imageDockerfile.dev - Development imagedocker compose.yml - Base configurationdocker compose.test.yml - Test configuration.dockerignore - Build optimizationPre-push hook blocks push if:
GitHub Actions blocks PR if:
# Full validation (recommended)
./.claude/scripts/pr-validation.sh
# Quick validation (skip some tests)
./.claude/scripts/pr-validation.sh --force
# Skip tests entirely (not recommended)
./.claude/scripts/pr-validation.sh --skip-tests
GitHub Actions workflow (.github/workflows/docker-tests.yml) runs:
# Bypass git hooks temporarily
git push --no-verify
# Disable Docker-first for urgent fixes
./.claude/scripts/docker-toggle.sh disable
# Don't forget to re-enable after fix!
# Check Docker-first status with detailed info
./.claude/scripts/docker-toggle.sh status
# Quick check
cat .claude/config.json | jq '.features.docker_first_development'
# Manual toggle
./.claude/scripts/docker-toggle.sh enable # or disable
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub lagowski/claudeautopm --plugin devops4 skills in this plugin
/ci-cd-kubernetes-strategyHow CI jobs on Kubernetes runners start service dependencies (databases etc.) as pods instead of docker-compose. Use when writing or changing CI/CD workflows that run on Kubernetes runners./devops-troubleshooting-playbookStep-by-step playbook for diagnosing CI/CD, container, Kubernetes and deployment failures. Use when a build, pipeline, container or deployment is failing./github-operationsSafe GitHub CLI usage: repository checks before writes, issue and PR operations, labels. Use when creating or editing GitHub issues, PRs or repositories with gh.Other plugins' skills for the same job