20 of the best prompts for Gemini for DevOps, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.
20 of the best prompts for Gemini for DevOps, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.
Published July 5, 2026
Automate deployments, write reliable infrastructure code, debug pipelines faster, and build systems that just work. 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.
Write and optimise automated build, test, and deploy pipelines.
Write GitHub Actions workflow
Write a GitHub Actions workflow for [DESCRIBE STACK] that runs lint, tests, and deploys to [TARGET] on merge to main. Add dependency and build caching.
CI takes minutes:
My CI takes [N] minutes: [DESCRIBE WORKFLOW]. Add parallelisation and caching to bring it under [N] minutes.
Write deployment pipeline
Write a deployment pipeline that auto-deploys to staging and requires manual approval before production, with Slack notifications at each stage.
Write Docker multi-stage build
Write a Docker multi-stage build for [DESCRIBE APP] that caches layers efficiently and pushes to [DESCRIBE REGISTRY].
CI has
My CI has a flaky step: [DESCRIBE]. Diagnose the most likely causes and show how to fix or add a retry correctly.
Write maintainable infrastructure definitions.
Write Terraform configuration
Write a Terraform configuration for [DESCRIBE INFRASTRUCTURE]. Use modules, 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 DEPENDENCIES]. Include correct port mappings, environment variables, and volume mounts.
Write Kubernetes manifest
Write a Kubernetes manifest for [DESCRIBE SERVICE] with Deployment, Service, and HPA. Set resource requests and limits for [DESCRIBE LOAD].
Show Show the resource
Provision [DESCRIBE CLOUD RESOURCE] with Terraform. Show the resource, the required IAM permissions, and the variables to make it reusable across environments.
Terraform state is
My Terraform state is disorganised. How do I refactor into modules without losing existing resources, including moving resources between state files safely?
Automate operations reliably.
Write bash script
Write a bash script that [DESCRIBE TASK]. Include set -e and set -o pipefail, helpful error messages, and a --dry-run flag.
Automate Include a timeout
Automate [DESCRIBE DEPLOYMENT TASK, E.G. "DATABASE MIGRATIONS IN THE DEPLOY PIPELINE"]. Include a timeout, rollback on failure, and a completion notification.
Write cleanup script
Write a cleanup script for [DESCRIBE STALE RESOURCES]. Preview what will be deleted before taking any destructive action.
Manage secrets securely
How do I manage secrets securely in [DESCRIBE ENVIRONMENT] using [SECRETS MANAGER/VAULT/GITHUB SECRETS]? Show how to inject them into the application.
Write monitoring script
Write a monitoring script that checks [DESCRIBE HEALTH CHECKS] on a schedule and alerts [SLACK/PAGERDUTY] if any check fails.
Diagnose failures and reduce time to recovery.
Deployment failed:
My deployment failed: [PASTE ERROR]. Walk me through diagnosing the root cause and suggest the most likely fixes in order of probability.
Service shows
My service shows [DESCRIBE SYMPTOM]. Metrics: [DESCRIBE]. What are the most likely causes and how do I narrow it down quickly?
Write post-incident review template
Write the post-incident review template for [DESCRIBE INCIDENT]: timeline, root cause, contributing factors, impact, immediate fix, long-term prevention.
Roll back this
I need to roll back this deployment quickly: [DESCRIBE]. Write the exact commands, how to verify the rollback succeeded, and how to communicate status.
Distributed tracing
Set up distributed tracing for [DESCRIBE ARCHITECTURE]. Recommend the tooling, show how to instrument services, and explain how to trace a slow request end-to-end.
Yes. Describe your stack and targets and Gemini will write a complete workflow with caching, parallelised jobs, and environment-specific deploy steps.
Describe the infrastructure and Gemini will write working Terraform modules or Kubernetes manifests with proper resource limits, IAM policies, and reusable variables.
Yes. Paste the error log and workflow and Gemini will walk through the failure, explain each error, and suggest fixes in order of likelihood.
CI/CD configuration, Docker and Kubernetes, Terraform, bash scripting, incident response, and deployment rollbacks are all areas where Gemini gives accurate, immediately usable guidance.
Yes. Describe the failure and paste relevant logs and Gemini will diagnose the root cause, suggest the fastest fix, and write rollback commands.
AI Prompts for Gemini for Testing
Write tests that catch real bugs, build a reliable test suite, and ship code you can actually trust..
See promptsAI Prompts for Gemini for Documentation
Write clear, complete technical documentation that people actually use, integrated directly into your Google Workspace workflow..
See promptsAI Prompts for Gemini for Python
Write cleaner Python faster, fix errors with clear explanations, and build better software with Gemini as your Python coding partner..
See prompts