20 of the best prompts for ChatGPT for DevOps, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.
20 of the best prompts for ChatGPT for DevOps, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.
Published July 4, 2026
Automate deployments, write clean infrastructure code, debug pipelines, and build reliable systems faster. Built across 4 distinct stages covering CI/CD Pipelines, Infrastructure as Code, Scripting and Automation and more, this guide gives you one expert prompt per step so you never have to write from scratch or guess what the AI needs. The prompts work in ChatGPT, Claude, and Gemini and are designed to get usable output on the first try.
Design and write automated build, test, and deploy pipelines.
Set up
I need to set up a CI/CD pipeline for a [DESCRIBE STACK, E.G. "NEXT.JS APP DEPLOYED TO VERCEL"] using [GITHUB ACTIONS/GITLAB CI/OTHER]. Write the workflow file that runs lint, type check, tests, and deploys on merge to main.
Pipeline takes minutes
My pipeline takes [N] minutes. Here is the current workflow: [PASTE WORKFLOW]. Identify bottlenecks, add caching for dependencies and build artifacts, and parallelize jobs where possible.
Write GitHub Actions workflow
Write a GitHub Actions workflow that runs tests against a matrix of [NODE VERSIONS / OS / OTHER]. Handle failures properly and report results in the PR.
Deployment pipeline
I need a deployment pipeline that deploys to staging on every PR merge and to production only on manual approval. Write the workflow with environment protection rules and Slack notifications.
Docker build pipeline
Set up a Docker build pipeline that builds a multi-stage image for [DESCRIBE APP], pushes to [ECR/DOCKER HUB/GHCR], and uses layer caching to minimize build time.
Write clean, maintainable infrastructure definitions.
Write Terraform configuration
Write a Terraform configuration to provision [DESCRIBE INFRASTRUCTURE, E.G. "AN ECS CLUSTER WITH ALB, RDS, AND ELASTICACHE"]. Use modules, separate variables for environment-specific values, and add outputs for key resource IDs.
Write Docker Compose setup
I need to write a Docker Compose setup for local development of [DESCRIBE APP WITH ITS DEPENDENCIES]. Include services for the app, database, cache, and any other dependencies, with volume mounts and environment variables.
Convert manual AWS setup
Convert this manual AWS setup to CloudFormation or Terraform: [DESCRIBE RESOURCES]. Define all resources, use parameters for configurable values, and add proper IAM roles with least-privilege permissions.
Write Kubernetes manifest
Write a Kubernetes manifest for [DESCRIBE SERVICE]. Include Deployment, Service, ConfigMap, and HorizontalPodAutoscaler. Set resource requests and limits based on [DESCRIBE EXPECTED LOAD].
Set up monitoring
I need to set up monitoring for this infrastructure: [DESCRIBE STACK]. Write the CloudWatch alarms or Prometheus alert rules for CPU, memory, error rate, and latency, with runbook links in the annotations.
Automate repetitive operations and incident response.
Write bash script
Write a bash script that [DESCRIBE AUTOMATION TASK, E.G. "ROTATES DATABASE PASSWORDS, UPDATES SECRETS MANAGER, AND RESTARTS AFFECTED SERVICES"]. Include error handling, logging, and a dry-run mode.
Automate database migrations
I need to automate database migrations in my deploy pipeline. Write the script that runs migrations with a timeout, rolls back on failure, and sends a notification with the migration log.
Write script
Write a script to clean up [DESCRIBE CLOUD RESOURCES, E.G. "STALE ECR IMAGES OLDER THAN 30 DAYS OR UNTAGGED"]. It should preview what will be deleted before asking for confirmation.
Create on-call runbook
Create an on-call runbook as a shell script for [DESCRIBE INCIDENT, E.G. "HIGH DATABASE CPU"]. It should check key metrics, collect diagnostics, and output a summary to help the on-call engineer triage quickly.
Manage environment variables
I need to manage environment variables across [N] environments. Write a script that reads from a central store ([SECRETS MANAGER/VAULT/OTHER]), validates required keys exist, and syncs them to the deployment platform.
Diagnose failures and reduce mean time to resolution.
Deployment failed
My deployment failed with this error: [PASTE ERROR LOG]. Walk me through diagnosing this step by step, what each error message means, and the most likely root causes in order of probability.
Service has high
My service has high latency spikes every [N] hours. Here are the relevant metrics: [DESCRIBE METRICS]. Suggest the most likely causes, what additional data to collect, and how to isolate the root cause.
Write post-incident review template
Write a post-incident review template for [DESCRIBE INCIDENT]. Include timeline, root cause analysis, contributing factors, impact, immediate fixes, 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 the rollback succeeded, and communicate status to stakeholders.
Set up distributed
Help me set up distributed tracing for [DESCRIBE MICROSERVICES ARCHITECTURE]. Recommend the tooling, show how to instrument the services, and explain how to trace a slow request across service boundaries.
Yes. Describe your stack, trigger conditions, and deployment targets and ChatGPT will write a complete workflow file with caching, parallel jobs, and environment-specific deploy steps.
Very helpful for standard patterns. Describe the infrastructure you need and ChatGPT will write working Terraform modules or Kubernetes manifests with proper resource limits and IAM policies.
Yes. Paste the error log and workflow file and ChatGPT will walk through the failure, explain what each error means, and suggest fixes in order of likelihood.
AWS, GCP, and Azure are all well covered. Specify the provider and service and ChatGPT will use correct resource names, IAM patterns, and CLI commands for that ecosystem.
Yes. Describe the incident timeline and impact and ChatGPT will write a structured blameless post-incident review with root cause analysis, contributing factors, and prevention tasks.
AI Prompts for ChatGPT for API Development
Design clean APIs, write reliable endpoints, handle auth and errors properly, and document your API professionally..
See promptsAI Prompts for ChatGPT for Documentation
Write clear technical documentation, engaging READMEs, accurate API docs, and user guides that developers actually read..
See promptsAI Prompts for ChatGPT for TypeScript
Write strongly typed TypeScript, design clean interfaces, debug type errors, and ship reliable code faster..
See prompts