How to Use DevOps Engineer Skill in Claude Code for Beginners
Purpose
When I started using Claude Code for DevOps tasks, I often wondered how to use the DevOps Engineer skill effectively. This post demonstrates how to invoke and use this skill for common infrastructure and deployment scenarios.
Environment
- Claude Code with claude-skills plugin
- Docker and Kubernetes (for examples)
- CI/CD pipelines (GitHub Actions, GitLab CI)
- Cloud platforms (AWS, GCP, Azure)
What is DevOps Engineer Skill?
The DevOps Engineer skill in Claude Code provides specialized knowledge for infrastructure automation, CI/CD pipelines, containerization, and cloud deployment. It focuses on practical patterns rather than theoretical concepts.
There are 4 main goals:
Infrastructure as Code: Automate provisioning with Terraform, CloudFormationContainer Orchestration: Docker and Kubernetes best practicesCI/CD Pipelines: Build, test, and deployment automationMonitoring & Logging: Observability patterns and tools
We will use DevOps Engineer to solve real infrastructure problems.
When to Use This Skill
I use the DevOps Engineer skill when:
- Designing CI/CD pipelines
"I need to set up a GitHub Actions workflow for my Node.js app"- Containerizing applications
"Create a Dockerfile for this Flask application"- Infrastructure provisioning
"Write Terraform configuration for AWS ECS deployment"- Kubernetes deployments
"Create Kubernetes manifests for a microservice"- Monitoring setup
"Set up Prometheus and Grafana monitoring"Installation and Setup
First, install the claude-skills plugin:
npm install -g @jeffallan/claude-skillsOr using homebrew:
brew install claude-skillsVerify the installation:
# Show promptuser@host:~$ claude-skills --version
# Show outputclaude-skills v2.1.0
# Show next promptuser@host:~$The DevOps Engineer skill is now available in Claude Code.
Core Usage Patterns
Basic Invocation
Direct skill invocation:
"Use devops-engineer to create a Dockerfile for my Python API"Context-based invocation:
"I'm deploying this Rails app to Kubernetes. What manifests do I need?"Common Trigger Phrases
I found these phrases trigger the DevOps Engineer skill:
- “Set up CI/CD pipeline for…”
- “Create infrastructure as code for…”
- “Containerize this application…”
- “Deploy to Kubernetes…”
- “Configure monitoring for…”
Typical Use Cases
Here are scenarios where DevOps Engineer helps:
┌──────────────────┐ ┌──────────────────┐│ Application │ │ Application ││ Code Changes │ │ Deployment │└────────┬─────────┘ └────────┬─────────┘ │ │ └───────────┬───────────┘ ▼ ┌───────────────────────┐ │ DevOps Engineer │ │ - Dockerfile │ │ - K8s manifests │ │ - CI/CD workflow │ │ - Monitoring config │ └───────────────────────┘Practical Examples
Example 1: Dockerizing a Node.js Application
When I needed to containerize my Express.js app, I invoked DevOps Engineer:
"Use devops-engineer to create an optimized Dockerfile for my Node.js 18 app"The skill generated this Dockerfile:
# Build stageFROM node:18-alpine AS builderWORKDIR /app
# Copy package filesCOPY package*.json ./RUN npm ci --only=production
# Copy source codeCOPY . .
# Production stageFROM node:18-alpineWORKDIR /app
# Copy node_modules from builderCOPY --from=builder /app/node_modules ./node_modulesCOPY --from=builder /app . .
# Non-root userRUN addgroup -g 1001 -S nodejsRUN adduser -S nodejs -u 1001USER nodejs
EXPOSE 3000CMD ["node", "src/index.js"]I think the key point is the multi-stage build. This reduces the final image size by excluding development dependencies.
When I built the image:
# Show promptuser@host:~$ docker build -t myapp:1.0 .
# Show outputStep 1/10 : FROM node:18-alpine AS builder...Successfully built abc123def456Successfully tagged myapp:1.0
# Show next promptuser@host:~$You can see that I succeeded in creating a production-ready Docker image.
Example 2: GitHub Actions CI/CD Pipeline
I needed to automate testing and deployment for my project. I asked:
"Use devops-engineer to create a GitHub Actions workflow for testing and deploying to AWS ECS"The skill created this workflow:
name: CI/CD Pipeline
on: push: branches: [main] pull_request: branches: [main]
jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3
- name: Setup Node.js uses: actions/setup-node@v3 with: node-version: '18' cache: 'npm'
- name: Install dependencies run: npm ci
- name: Run tests run: npm test
- name: Upload coverage uses: codecov/codecov-action@v3
deploy: needs: test runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v3
- name: Configure AWS uses: aws-actions/configure-aws-credentials@v2 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1
- name: Deploy to ECS run: | aws ecs update-service --cluster my-cluster \ --service my-service --force-new-deploymentThe workflow runs tests on every push and only deploys to ECS when code merges to main branch.
Example 3: Kubernetes Deployment Manifests
When I needed to deploy my app to Kubernetes:
"Use devops-engineer to create Kubernetes manifests for a stateless web application"DevOps Engineer generated these manifests:
apiVersion: apps/v1kind: Deploymentmetadata: name: webapp labels: app: webappspec: replicas: 3 selector: matchLabels: app: webapp template: metadata: labels: app: webapp spec: containers: - name: webapp image: myapp:1.0 ports: - containerPort: 3000 resources: requests: memory: "128Mi" cpu: "100m" limits: memory: "256Mi" cpu: "200m" livenessProbe: httpGet: path: /health port: 3000 initialDelaySeconds: 30 periodSeconds: 10 readinessProbe: httpGet: path: /ready port: 3000 initialDelaySeconds: 5 periodSeconds: 5apiVersion: v1kind: Servicemetadata: name: webapp-servicespec: type: LoadBalancer selector: app: webapp ports: - port: 80 targetPort: 3000I can explain the key parts:
replicas: 3: Three pods for high availabilityresources: CPU and memory limits prevent resource exhaustionlivenessProbe: Kubernetes restarts unhealthy containersreadinessProbe: Traffic only routes to ready pods
When I applied these manifests:
# Show promptuser@host:~$ kubectl apply -f deployment.yaml -f service.yaml
# Show outputdeployment.apps/webapp createdservice/webapp-service created
# Show next promptuser@host:~$It works!
Best Practices
DO ✓
1. Use infrastructure as code
# Terraform exampleresource "aws_ecs_task_definition" "app" { family = "my-app" container_definitions = templatefile("${path.module}/task-def.json", { image = var.app_image })}2. Implement health checks
livenessProbe: httpGet: path: /health port: 3000 initialDelaySeconds: 303. Use specific image tags
FROM node:18.2.0-alpine # Pin exact version4. Set resource limits
resources: limits: memory: "512Mi" cpu: "500m"5. Separate configs from code
# Use ConfigMaps and SecretsapiVersion: v1kind: ConfigMapmetadata: name: app-configdata: DATABASE_URL: "postgresql://..."DON’T ✗
1. Don’t use latest tags
# WRONG: Unpredictable buildsFROM node:latest
# CORRECT: Reproducible buildsFROM node:18.2.0-alpine2. Don’t run as root
# WRONG: Security riskUSER root
# CORRECT: Non-root userRUN adduser -D appuserUSER appuser3. Don’t hardcode secrets
# WRONG: Secrets in repoenv: - name: API_KEY value: "sk-xxxxx"
# CORRECT: Use Kubernetes Secretsenv: - name: API_KEY valueFrom: secretKeyRef: name: app-secrets key: api-key4. Don’t skip resource limits
# WRONG: No limitsresources: {}
# CORRECT: Explicit limitsresources: limits: memory: "256Mi"Tips for Maximum Effectiveness
1. Describe your stack completely
Instead of:
"Create deployment manifests"Use:
"Create Kubernetes manifests for a Node.js app using PostgreSQL database, Redis cache, and Nginx ingress"2. Specify constraints clearly
"Create a GitHub Actions workflow that tests on Node 16, 18, and 20, then deploys to AWS ECS only from main branch"3. Ask for optimization
"Review this Dockerfile and suggest size optimizations"4. Request monitoring setup
"Add Prometheus metrics endpoint to this Flask application"Common Patterns
CI/CD Pipeline Structure
Push Code → Build → Test → Security Scan → Deploy Staging → Integration Test → Deploy ProductionContainer Build Process
Source Code → Dockerfile → Build Image → Push to Registry → Pull to K8s → Run PodInfrastructure Deployment
Terraform Config → Plan → Apply → Resources Created → App Deployed → Health CheckRelated Skills
The DevOps Engineer skill works well with:
- frontend-patterns: For containerizing React/Vue apps
- backend-patterns: For API deployment strategies
- security-review: For infrastructure security checks
Summary
In this post, I showed how to use the DevOps Engineer skill in Claude Code for infrastructure and deployment tasks. The key point is to describe your technology stack and requirements clearly when invoking the skill. This helps generate appropriate Dockerfiles, Kubernetes manifests, CI/CD pipelines, and infrastructure as code configurations.
The DevOps Engineer skill excels at practical infrastructure automation, but you need to provide context about your application, cloud platform, and deployment constraints for best results.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments