Implement GitOps workflows with ArgoCD and Flux for automated, declarative Kubernetes...
npx skills add dannypenrose/agent-skills --skill "deployment-and-infrastructure"
Install specific skill from multi-skill repository
# Description
Enforce deployment, CI/CD, containerization, and infrastructure standards when working on deployment configurations, Dockerfiles, docker-compose files, GitHub Actions workflows, deployment scripts, environment files, reverse proxy configs, or server setup. Use this skill whenever the user creates or modifies Dockerfiles, CI pipelines, .env files, nginx/caddy configs, or discusses deployment strategy, blue-green deployments, container orchestration, rollback procedures, or self-hosting — even if they don't explicitly mention 'deployment standards'.
# SKILL.md
name: deployment-and-infrastructure
description: "Enforce deployment, CI/CD, containerization, and infrastructure standards when working on deployment configurations, Dockerfiles, docker-compose files, GitHub Actions workflows, deployment scripts, environment files, reverse proxy configs, or server setup. Use this skill whenever the user creates or modifies Dockerfiles, CI pipelines, .env files, nginx/caddy configs, or discusses deployment strategy, blue-green deployments, container orchestration, rollback procedures, or self-hosting — even if they don't explicitly mention 'deployment standards'."
Deployment & Infrastructure Standards
You are enforcing authoritative deployment, CI/CD, containerization, environment management, and self-hosting standards. When this skill activates, follow the context detection rules below to load only the relevant standards, then apply them to the work at hand.
Context Detection & Standard Loading
Detect the type of file being edited and read ONLY the 1-2 relevant standards documents. Never read all six at once.
| Files Being Edited | Standards to Read |
|---|---|
Dockerfile, docker-compose*.yml, .dockerignore |
https://raw.githubusercontent.com/dannypenrose/engineering-standards/main/development/containerization.md |
.github/workflows/*.yml, CI pipeline configs |
https://raw.githubusercontent.com/dannypenrose/engineering-standards/main/development/ci-cd-pipelines.md |
.env* files, environment configs, secret management |
https://raw.githubusercontent.com/dannypenrose/engineering-standards/main/development/environment-management.md |
| Deploy scripts, systemd units, rsync configs, release workflows | https://raw.githubusercontent.com/dannypenrose/engineering-standards/main/development/deployment-standards.md |
| Caddy/Nginx configs, server setup, DNS, SSL, systemd services | https://raw.githubusercontent.com/dannypenrose/engineering-standards/main/governance/self-hosting-standards.md |
| Public repo setup, LICENSE, open-source CI | https://raw.githubusercontent.com/dannypenrose/engineering-standards/main/governance/open-source.md |
Procedure:
1. Identify which files are being created or modified.
2. Map them to the table above.
3. Use the WebFetch tool to load the 1-2 matching standards documents.
4. Apply the rules from those documents to the current task.
5. Use the quick-reference rules below as an immediate checklist without needing to re-read the full documents.
Quick-Reference Rules
These are the most commonly needed checks, extracted from the full standards. Apply them immediately; consult the full standard document for edge cases.
Dockerfile Checks
- [ ] Multi-stage build (separate build and runtime stages)
- [ ] Base image version pinned (
node:22-alpine, nevernode:latestornode:alpine) - [ ] Non-root user created and set via
USERbeforeENTRYPOINT/CMD - [ ]
HEALTHCHECKinstruction defined - [ ]
.dockerignoreexists and excludes.env,.env.*,.git,node_modules,dist - [ ] No secrets baked into image (no
ENVwith credentials, noCOPY .env) - [ ] Layers ordered by change frequency (system packages -> lockfile+install -> app code)
- [ ] JSON notation for
ENTRYPOINT/CMD(exec form, not shell form) - [ ]
--frozen-lockfileused for package installs - [ ] Combined
RUNcommands to reduce layers; clean up caches in same layer
Docker Compose Checks
- [ ] Production:
read_only: true,security_opt: [no-new-privileges:true] - [ ] Resource limits defined (
deploy.resources.limits) - [ ] Health checks on every service
- [ ]
restart: unless-stoppedfor production services - [ ] Logging configured with size limits (
max-size,max-file) - [ ] Ports bound to
127.0.0.1unless public access required - [ ] Image tags pinned to version (never
latestin production)
CI/CD Pipeline Checks (GitHub Actions)
- [ ] OneRunner pattern: Single job for build + deploy (no artifact upload/download between jobs)
- [ ]
paths:trigger scoped to relevant directories - [ ]
workflow_dispatch:present for manual deploys - [ ]
concurrency:group withcancel-in-progress: true - [ ] Runtime version as workflow-level
env:variable (not hardcoded) - [ ] Dependency caching configured (
setup-nodecache oractions/cache) - [ ] rsync uses standard flags:
-rz --delete --no-times --no-perms --no-owner --no-group --omit-dir-times - [ ] SSH keepalive:
-o ServerAliveInterval=30on long-running SSH commands - [ ]
SERVER_USERis app-specific deploy user (notopsorroot) - [ ] No lint/test/type-check steps in deploy workflows (these belong in pre-push hooks)
- [ ] Monorepo backends using
pnpm deploy: add-Lflag to rsync for symlink dereferencing - [ ]
environment:set if secrets are scoped to a GitHub environment
Environment File Checks
- [ ]
.envand.env*.localare gitignored - [ ]
.env.productionis committed (contains only publicNEXT_PUBLIC_*vars, no secrets) - [ ] No secrets in committed files or build args
- [ ] Variable naming:
UPPER_SNAKE_CASE, descriptive (e.g.,DATABASE_URLnotDB_URL) - [ ] Server env files at
/etc/{app_name}.envwith permissionschmod 600 - [ ] Startup validation with Zod or equivalent (app fails fast on missing/invalid config)
- [ ]
NEXT_PUBLIC_*vars go infrontend/.env.production, not injected via CIenv:blocks - [ ] Backend feature flags use
ENABLE_*format - [ ] Frontend feature flags use
NEXT_PUBLIC_FEATURE_FLAG_*format
Deployment Strategy Checks
- [ ] Zero-downtime deployment pattern selected (rolling, blue-green, or canary)
- [ ] Rollback procedure documented and tested (< 5 min target)
- [ ] Health check endpoints (
/healthfor liveness,/readyfor readiness) - [ ] Graceful shutdown handles
SIGTERM(drain connections, close DB, close cache) - [ ] Smoke tests run post-deployment
- [ ] Feature flags configured for new features (toggle without redeploy)
- [ ] Immutable image tags for production (semver or SHA-based, never
latest)
Self-Hosting / Server Checks
- [ ] Caddy/Nginx configured with security headers (HSTS, X-Content-Type-Options, X-Frame-Options)
- [ ] SSL/TLS via Let's Encrypt with automatic renewal
- [ ] systemd service:
Restart=always,RestartSec=10,NoNewPrivileges=true,ProtectSystem=strict - [ ]
EnvironmentFile=/etc/{app_name}.envfor secrets (not inlineEnvironment=) - [ ] Firewall rules configured (only expose necessary ports)
- [ ] Automated security updates enabled (
unattended-upgrades) - [ ] Backup script with offsite storage; tested restore procedure
- [ ] Log rotation configured
Applying Standards
When reviewing or creating deployment-related files:
- Read the relevant standard(s) using the context detection table above.
- Check against the quick-reference rules for the file type being edited.
- Flag violations clearly, citing the specific rule.
- Provide the corrected code following the patterns from the standard.
- Do not over-engineer -- apply only what is relevant to the current scope. A simple single-server deploy does not need Kubernetes patterns.
Common Patterns to Enforce
The Forge Monorepo Specifics
When working on The Forge monorepo deployment:
- Frontend apps use Next.js standalone output
- Backend apps use NestJS
pnpm deploy --prodfor backend bundles; rsync with-Lflag to follow workspace symlinks- Shared packages need
"files": ["dist"]inpackage.jsonto include built output in deploy bundles - After removing large packages from deploy bundle, run
find . -xtype l -deleteto prune dangling symlinks - Environment file convention follows the three-file pattern:
.env.local(dev),.env.production(public, committed),.env(production secrets, gitignored) - Port assignments are fixed per app (see project CLAUDE.md)
Image Tagging for Production
ghcr.io/{org}/{app}:{semver} # e.g., 1.2.3
ghcr.io/{org}/{app}:{semver}-{sha} # e.g., 1.2.3-abc1234
ghcr.io/{org}/{app}:sha-{sha} # e.g., sha-abc1234
Never deploy latest or branch tags to production.
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.