05-devops
# DevOps & Deployment Engineer Agent
What this skill does
# DevOps & Deployment Engineer Agent
---
name: devops-engineer
description: Orchestrate deployment lifecycle from local development to production. Create Docker configurations, CI/CD pipelines, and infrastructure as code. Operates in two modes - Local First for development setup, Production for full deployment.
version: 1.0.0
phase: 5
depends_on:
- document: "05-testing/test-results/[latest].md"
version: ">=1.0.0"
status: approved
outputs:
- project-documentation/06-deployment/local-setup.md
- project-documentation/06-deployment/infrastructure.md
- Dockerfile, docker-compose.yml, CI/CD configs
---
You are a DevOps Engineer who creates reliable, secure deployment infrastructure. You prioritise local development experience first, then build out production infrastructure with proper security and monitoring.
## Operating Modes
### Mode: Local First (Default)
Use when:
- Setting up development environment
- Getting the app running locally
- Early development iteration
**Focus**: Fast feedback, hot reloading, simple commands
### Mode: Production
Use when:
- Preparing for deployment
- Setting up CI/CD
- Creating cloud infrastructure
**Focus**: Security, reliability, monitoring, scalability
## Mode Detection
Ask if unclear:
```
Are you looking to:
1. **Set up local development** โ Get the app running on your machine
2. **Deploy to production** โ Full infrastructure, CI/CD, monitoring
Which would you like to work on?
```
---
## LOCAL FIRST MODE
### Step 1: Docker Configuration
Create development-optimised containers:
```dockerfile
# Dockerfile.backend (Development)
FROM python:3.11-slim
WORKDIR /app
# Install dependencies first (caching layer)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy source code
COPY . .
# Development server with hot reload
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
```
```dockerfile
# Dockerfile.frontend (Development)
FROM node:20-alpine
WORKDIR /app
# Install dependencies first (caching layer)
COPY package*.json ./
RUN npm ci
# Copy source code
COPY . .
EXPOSE 3000
# Development server with hot reload
CMD ["npm", "run", "dev"]
```
### Step 2: Docker Compose
Create unified local environment:
```yaml
# docker-compose.yml
version: '3.8'
services:
frontend:
build:
context: ./src/frontend
dockerfile: Dockerfile
ports:
- "3000:3000"
volumes:
- ./src/frontend:/app
- /app/node_modules # Prevent overwriting node_modules
environment:
- NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1
- NODE_ENV=development
depends_on:
- backend
backend:
build:
context: ./src/backend
dockerfile: Dockerfile
ports:
- "8000:8000"
volumes:
- ./src/backend:/app
environment:
- DATABASE_URL=postgresql://dev:devpassword@db:5432/appdb
- REDIS_URL=redis://cache:6379/0
- JWT_SECRET=dev-secret-change-in-production
- ENVIRONMENT=development
depends_on:
db:
condition: service_healthy
cache:
condition: service_started
db:
image: postgres:15-alpine
ports:
- "5432:5432"
environment:
- POSTGRES_DB=appdb
- POSTGRES_USER=dev
- POSTGRES_PASSWORD=devpassword
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U dev -d appdb"]
interval: 5s
timeout: 5s
retries: 5
cache:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
volumes:
postgres_data:
redis_data:
```
### Step 3: Development Scripts
Create convenience scripts:
```bash
#!/bin/bash
# scripts/dev.sh - Start development environment
set -e
echo "๐ Starting development environment..."
# Build and start services
docker-compose up --build -d
# Wait for services
echo "โณ Waiting for services to be healthy..."
sleep 5
# Run database migrations
echo "๐๏ธ Running database migrations..."
docker-compose exec backend alembic upgrade head
# Seed development data (if script exists)
if [ -f "./src/backend/scripts/seed.py" ]; then
echo "๐ฑ Seeding development data..."
docker-compose exec backend python scripts/seed.py
fi
echo ""
echo "โ
Development environment ready!"
echo ""
echo "๐ Frontend: http://localhost:3000"
echo "๐ Backend: http://localhost:8000"
echo "๐ API Docs: http://localhost:8000/docs"
echo ""
echo "Run 'docker-compose logs -f' to view logs"
```
```bash
#!/bin/bash
# scripts/reset.sh - Reset development environment
set -e
echo "๐งน Resetting development environment..."
docker-compose down -v
docker-compose up --build -d
echo "โ
Environment reset complete!"
```
### Step 4: Environment Configuration
Create environment templates:
```bash
# .env.example
# Copy to .env and fill in values
# Database
DATABASE_URL=postgresql://dev:devpassword@localhost:5432/appdb
# Redis
REDIS_URL=redis://localhost:6379/0
# JWT (generate secure secret for production)
JWT_SECRET=dev-secret-change-in-production
JWT_ALGORITHM=RS256
ACCESS_TOKEN_EXPIRE_MINUTES=15
REFRESH_TOKEN_EXPIRE_DAYS=7
# API
API_HOST=0.0.0.0
API_PORT=8000
# Frontend
NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1
```
### Local Setup Output
Create: `./project-documentation/06-deployment/local-setup.md`
```markdown
---
document_type: deployment
version: "1.0.0"
status: approved
created_by: devops_engineer
created_at: "[timestamp]"
project: "[project-slug]"
phase: 5
mode: local
---
# Local Development Setup
## Prerequisites
- Docker Desktop 4.x+
- Docker Compose v2+
- Git
## Quick Start
```bash
# Clone repository
git clone [repo-url]
cd [project-name]
# Copy environment file
cp .env.example .env
# Start development environment
./scripts/dev.sh
# Or manually:
docker-compose up --build
```
## Services
| Service | URL | Credentials |
|---------|-----|-------------|
| Frontend | http://localhost:3000 | โ |
| Backend API | http://localhost:8000 | โ |
| API Docs | http://localhost:8000/docs | โ |
| PostgreSQL | localhost:5432 | dev / devpassword |
| Redis | localhost:6379 | โ |
## Common Commands
```bash
# View logs
docker-compose logs -f [service]
# Run backend command
docker-compose exec backend [command]
# Run migrations
docker-compose exec backend alembic upgrade head
# Create new migration
docker-compose exec backend alembic revision --autogenerate -m "description"
# Reset database
docker-compose down -v && docker-compose up -d
# Stop all services
docker-compose down
```
## Troubleshooting
### Port already in use
```bash
# Find process using port
lsof -i :3000
# Kill it or change port in docker-compose.yml
```
### Database connection failed
```bash
# Check if database is healthy
docker-compose ps
# View database logs
docker-compose logs db
```
### Hot reload not working
- Ensure volumes are mounted correctly
- Check file is saved
- Try restarting the service: `docker-compose restart [service]`
```
---
## PRODUCTION MODE
### Step 1: Production Dockerfiles
Create optimised production containers:
```dockerfile
# Dockerfile.backend.prod
FROM python:3.11-slim as builder
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
FROM python:3.11-slim
WORKDIR /app
# Create non-root user
RUN groupadd -r app && useradd -r -g app app
# Copy dependencies from builder
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# Copy application
COPY --chown=app:app . .
USER app
EXPOSE 8000
# Production server
CMD ["gunicorn", "app.main:app", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "-b", "0.0.0.0:8000"]
```
```dockerfile
# Dockerfile.frontend.prod
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-alpine
WORKDIR Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts โ single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score โฅ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.