Skip to content

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, CloudFormation
  • Container Orchestration: Docker and Kubernetes best practices
  • CI/CD Pipelines: Build, test, and deployment automation
  • Monitoring & 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:

  1. Designing CI/CD pipelines
Terminal window
"I need to set up a GitHub Actions workflow for my Node.js app"
  1. Containerizing applications
Terminal window
"Create a Dockerfile for this Flask application"
  1. Infrastructure provisioning
Terminal window
"Write Terraform configuration for AWS ECS deployment"
  1. Kubernetes deployments
Terminal window
"Create Kubernetes manifests for a microservice"
  1. Monitoring setup
Terminal window
"Set up Prometheus and Grafana monitoring"

Installation and Setup

First, install the claude-skills plugin:

Terminal window
npm install -g @jeffallan/claude-skills

Or using homebrew:

Terminal window
brew install claude-skills

Verify the installation:

Terminal window
# Show prompt
user@host:~$ claude-skills --version
# Show output
claude-skills v2.1.0
# Show next prompt
user@host:~$

The DevOps Engineer skill is now available in Claude Code.

Core Usage Patterns

Basic Invocation

Direct skill invocation:

Terminal window
"Use devops-engineer to create a Dockerfile for my Python API"

Context-based invocation:

Terminal window
"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:

Terminal window
"Use devops-engineer to create an optimized Dockerfile for my Node.js 18 app"

The skill generated this Dockerfile:

Dockerfile
# Build stage
FROM node:18-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
RUN npm ci --only=production
# Copy source code
COPY . .
# Production stage
FROM node:18-alpine
WORKDIR /app
# Copy node_modules from builder
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app . .
# Non-root user
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nodejs -u 1001
USER nodejs
EXPOSE 3000
CMD ["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:

Terminal window
# Show prompt
user@host:~$ docker build -t myapp:1.0 .
# Show output
Step 1/10 : FROM node:18-alpine AS builder
...
Successfully built abc123def456
Successfully tagged myapp:1.0
# Show next prompt
user@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:

Terminal window
"Use devops-engineer to create a GitHub Actions workflow for testing and deploying to AWS ECS"

The skill created this workflow:

.github/workflows/deploy.yml
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-deployment

The 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:

Terminal window
"Use devops-engineer to create Kubernetes manifests for a stateless web application"

DevOps Engineer generated these manifests:

deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: webapp
labels:
app: webapp
spec:
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: 5
service.yaml
apiVersion: v1
kind: Service
metadata:
name: webapp-service
spec:
type: LoadBalancer
selector:
app: webapp
ports:
- port: 80
targetPort: 3000

I can explain the key parts:

  • replicas: 3: Three pods for high availability
  • resources: CPU and memory limits prevent resource exhaustion
  • livenessProbe: Kubernetes restarts unhealthy containers
  • readinessProbe: Traffic only routes to ready pods

When I applied these manifests:

Terminal window
# Show prompt
user@host:~$ kubectl apply -f deployment.yaml -f service.yaml
# Show output
deployment.apps/webapp created
service/webapp-service created
# Show next prompt
user@host:~$

It works!

Best Practices

DO ✓

1. Use infrastructure as code

# Terraform example
resource "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: 30

3. Use specific image tags

FROM node:18.2.0-alpine # Pin exact version

4. Set resource limits

resources:
limits:
memory: "512Mi"
cpu: "500m"

5. Separate configs from code

# Use ConfigMaps and Secrets
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
data:
DATABASE_URL: "postgresql://..."

DON’T ✗

1. Don’t use latest tags

# WRONG: Unpredictable builds
FROM node:latest
# CORRECT: Reproducible builds
FROM node:18.2.0-alpine

2. Don’t run as root

# WRONG: Security risk
USER root
# CORRECT: Non-root user
RUN adduser -D appuser
USER appuser

3. Don’t hardcode secrets

# WRONG: Secrets in repo
env:
- name: API_KEY
value: "sk-xxxxx"
# CORRECT: Use Kubernetes Secrets
env:
- name: API_KEY
valueFrom:
secretKeyRef:
name: app-secrets
key: api-key

4. Don’t skip resource limits

# WRONG: No limits
resources: {}
# CORRECT: Explicit limits
resources:
limits:
memory: "256Mi"

Tips for Maximum Effectiveness

1. Describe your stack completely

Instead of:

Terminal window
"Create deployment manifests"

Use:

Terminal window
"Create Kubernetes manifests for a Node.js app using PostgreSQL database, Redis cache, and Nginx ingress"

2. Specify constraints clearly

Terminal window
"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

Terminal window
"Review this Dockerfile and suggest size optimizations"

4. Request monitoring setup

Terminal window
"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 Production

Container Build Process

Source Code → Dockerfile → Build Image → Push to Registry → Pull to K8s → Run Pod

Infrastructure Deployment

Terraform Config → Plan → Apply → Resources Created → App Deployed → Health Check

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