Skip to content

The DevOps recipes are five pages of copy-paste prompts for Claude Code, Codex, and Cursor: Dockerfiles, Kubernetes manifests, CI/CD pipelines, infrastructure as code, and monitoring. Every recipe follows one rule: the agent writes the configuration, and a machine check proves it before a human approves the change.

This page is for developers who let an agent write delivery configuration, and for tech leads who own the pipeline it runs through. You know the failure: a 1.2 GB image, a rollout stuck in CrashLoopBackOff, or a pipeline that went green because the agent weakened a failing scan.

The last column is the evidence the agent attaches instead of you reading the YAML.

Your taskRecipeThe gate that proves it
Write or shrink a Dockerfile, a Compose file, or image CIDocker and container patternshadolint, a Trivy scan, and a smoke test of the built image
Deployments, Helm charts, autoscaling, GitOpsKubernetes orchestration patternshelm lint, then kubectl diff against the real cluster in CI
GitHub Actions, GitLab CI, or Jenkins pipelinesCI/CD pipeline patternsactionlint, zizmor, and a throwaway pull request that must go red
Terraform, CloudFormation, or Pulumi changesInfrastructure as code patternsterraform plan with zero unexpected replaces or destroys
Instrumentation, alert rules, dashboards, log pipelinesMonitoring and logging patternspromtool test rules and a query that returns real data

For the end-to-end delivery workflow, read review and ship; for running production afterwards, read DevOps with AI.

Give the agent your delivery rules before any recipe

Section titled “Give the agent your delivery rules before any recipe”

Without rules, an agent writes what an average tutorial would: :latest tags, a root user, unpinned actions. Write the rules once, where each tool loads them automatically.

## Delivery rules
- Never read, print, or write secrets. Use the secret store; no credentials in ENV, ARG, YAML, or HCL.
- Pin every base image, action, chart, and provider to an explicit version.
- Never delete, skip, or soften a failing check (scanner severity, .trivyignore, `continue-on-error`,
`|| true`, `-target`). Report the finding and stop.
- You do not run `terraform apply`, `kubectl apply`, `helm upgrade`, or any deploy. CI does that after approval.
- After any change, run the gates in scripts/verify-delivery.sh and paste the full output in your summary.

Keep the canonical block in AGENTS.md and make CLAUDE.md at the repository root the single line @AGENTS.md, which imports it. Claude Code loads it in every session, headless claude -p runs included.

The deploy rule matters most: without production credentials, a bad recipe costs a failed pull request, not an incident. Permissions and sandboxing shows how to enforce it.

How do you verify agent-written DevOps changes without reading every line?

Section titled “How do you verify agent-written DevOps changes without reading every line?”

A recipe is done when its gate passes and the agent attaches the output, not when the YAML looks right.

  • Static gates run in the agent’s session. They need no credentials.
  • Reality gates run in CI. terraform plan and kubectl diff need cloud and cluster access, so a read-only CI job posts their output on the pull request for the agent to read.
  • Prove a gate can fail. The CI/CD recipe opens a throwaway pull request that must go red.
  • A human signs off on blast radius. The reviewer reads the plan summary (resources added, changed, destroyed) and the rollback command, not every line. Both go in the pull request’s evidence bundle, and production approval stays a human boundary.

Put the static gates in one script that every tool and every human runs. Delete the lines your repository does not need:

#!/usr/bin/env bash
# scripts/verify-delivery.sh: static gates only; no cloud or cluster credentials.
set -euo pipefail
for f in $(git ls-files '*Dockerfile*'); do docker run --rm -i hadolint/hadolint < "$f"; done
actionlint
uvx zizmor .github/workflows/
for c in charts/*/; do helm lint "$c"; done
terraform -chdir=infra init -backend=false -input=false >/dev/null
terraform -chdir=infra validate
promtool check rules monitoring/rules/*.yml
echo "PASS all static delivery gates"

Save it as prompts/devops-gates.txt and run it the same way in each tool:

Terminal window
# Terminal, on a trusted branch. Edits allowed; shell limited to the gate script.
claude -p "$(cat prompts/devops-gates.txt)" \
--permission-mode dontAsk \
--allowedTools "Read,Grep,Glob,Edit,Bash(scripts/verify-delivery.sh)" \
--output-format json > gates.json

Bash(scripts/verify-delivery.sh) matches only that exact spelling, which is why the prompt says “Run exactly”. If the agent calls ./scripts/verify-delivery.sh or bash scripts/verify-delivery.sh, the call is denied (--permission-mode dontAsk denies whatever would prompt, and nobody could answer a prompt in -p mode anyway), so the summary may arrive without gate output. Reject any summary that lacks the final PASS line.

What breaks when agents write DevOps configuration?

Section titled “What breaks when agents write DevOps configuration?”

Did this guide help you?

One tap, no sign-in.

not at all a lot