20 of the best prompts for Claude for DevOps, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.
20 of the best prompts for Claude for DevOps, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.
Getting Claude for DevOps right takes more than a single prompt. This 4-stage guide covers CI/CD Pipelines, Infrastructure as Code, Scripting and Automation, and more, breaking the whole process into focused steps where each prompt builds on the last. Automate deployments, write clean infrastructure code, debug pipelines faster, and build reliable systems. Every prompt is optimized and runs in ChatGPT, Claude, and Gemini.
Design and write automated build, test, and deploy pipelines.
Write GitHub Actions workflow
Write a GitHub Actions workflow for [DESCRIBE STACK] that runs lint, type check, tests, and deploys to [DESCRIBE TARGET] on merge to main. Add caching to make it fast.
Pipeline takes minutes
My pipeline takes [N] minutes and it is too slow: [PASTE OR DESCRIBE WORKFLOW]. Add caching, parallelise independent jobs, and tell me where the biggest time savings are.
Write deployment pipeline
Write a deployment pipeline that deploys to staging automatically and requires manual approval before production. Include Slack notifications for each stage.
Docker build pipeline
I need a Docker build pipeline that uses multi-stage builds for [DESCRIBE APP], caches layers effectively, and pushes to [DESCRIBE REGISTRY].
CI pipeline fails
My CI pipeline fails intermittently: [DESCRIBE FLAKY TEST OR STEP]. Diagnose the most likely causes and show how to fix or retry the flaky step properly.
Write clean, maintainable infrastructure definitions.
Write Terraform configuration
Write a Terraform configuration for [DESCRIBE INFRASTRUCTURE, E.G. "ECS CLUSTER WITH ALB AND RDS"]. Use modules, separate environment-specific variables, and add outputs for key resource IDs.
Write Docker Compose file
Write a Docker Compose file for local development of [DESCRIBE APP WITH ITS DEPENDENCIES]. Include all services with correct port mappings, environment variables, and volume mounts.
Write Kubernetes manifest
Write a Kubernetes manifest for [DESCRIBE SERVICE] with Deployment, Service, and HorizontalPodAutoscaler. Set resource requests and limits appropriate for [DESCRIBE LOAD].
Show Show the resource
I need to provision [DESCRIBE AWS/GCP/AZURE RESOURCE] with Terraform. Show the resource definitions, the IAM permissions needed, and the variables to make it reusable across environments.
Terraform state is
My Terraform state is a mess. Explain how to refactor it into modules without losing existing resources, including how to move resources between state files safely.
Automate repetitive operations with reliable scripts.
Write bash script
Write a bash script that [DESCRIBE TASK]. Include error handling with set -e and set -o pipefail, meaningful error messages, and a --dry-run flag.
Write script
I need to automate [DESCRIBE DEPLOYMENT TASK, E.G. "DATABASE MIGRATIONS IN THE DEPLOY PIPELINE"]. Write the script with a timeout, rollback on failure, and a notification on completion.
Write script
Write a script to clean up [DESCRIBE STALE CLOUD RESOURCES, E.G. "UNUSED ECR IMAGES OLDER THAN 30 DAYS"]. Preview what will be deleted before doing anything destructive.
Securely manage secrets
How do I securely manage secrets in [DESCRIBE ENVIRONMENT]? Show me the approach using [AWS SECRETS MANAGER / VAULT / GITHUB SECRETS] and how to inject them into the application.
Write monitoring script
Write a monitoring script that checks [DESCRIBE HEALTH CHECKS] every [N MINUTES] and pages [SLACK / PAGERDUTY] if any check fails.
Diagnose failures and reduce time to recovery.
Deployment just failed
My deployment just failed with this error: [PASTE ERROR]. Walk me through diagnosing the root cause step by step and suggest the most likely fixes in order.
Service has
My service has [DESCRIBE SYMPTOM: HIGH LATENCY / INCREASED ERROR RATE / MEMORY LEAK]. Here are the relevant metrics: [DESCRIBE]. What are the most likely causes and how do I narrow it down?
Write incident post-mortem template
Write the incident post-mortem template for [DESCRIBE INCIDENT]. Include: timeline, root cause, contributing factors, business impact, immediate fix, and long-term prevention tasks.
Roll back this
I need to roll back this deployment quickly: [DESCRIBE DEPLOYMENT]. Write the exact commands to execute the rollback, verify it, and communicate status to stakeholders.
Distributed tracing
Set up distributed tracing for this [DESCRIBE ARCHITECTURE]. Recommend the tooling, show how to instrument the services, and explain how to trace a slow request end-to-end.
Yes. Describe your stack, triggers, and deployment targets and Claude will write a complete workflow with caching, parallelised jobs, and environment-specific deploy steps.
Describe the infrastructure you need and Claude will write working Terraform modules or Kubernetes manifests with proper resource limits, IAM policies, and reusable variable structures.
Yes. Paste the error log and workflow file and Claude will walk through the failure, explain each error, and suggest fixes in order of likelihood.
CI/CD pipelines, Docker and Kubernetes configs, Terraform, bash scripting, incident response, and deployment rollbacks are all areas where Claude gives accurate, immediately usable guidance.
Yes. Describe the failure symptom and paste relevant logs or configs and Claude will diagnose the root cause, suggest the fastest fix, and write rollback commands if needed.
AI Prompts for Claude for Testing
Write tests that catch real bugs, build a reliable test suite, and ship code you can actually trust..
See promptsAI Prompts for Claude for Documentation
Write clear, complete technical documentation that developers and users actually understand and use..
See promptsAI Prompts for Claude for Python
Write cleaner Python faster, debug stubborn errors, and level up your Python skills with Claude as your coding partner..
See prompts