Prompt Engineering for DevOps: Consistency and Safety
Use prompts to get reliable, safe outputs from LLMs for runbooks, code, and ops tasks.
On this page
Using LLMs for runbooks, code generation, or ops assistance works best with structured prompts and safety checks.
Structure Your Prompts
- Role: “You are a senior SRE.”
- Context: Relevant config, error message, or metric.
- Task: “Generate a runbook step to …” or “Suggest a Terraform change to …”
- Constraints: “Output only valid YAML,” “No destructive commands,” “Use our naming convention.”
Consistency
- Templates: Store prompt templates in code; version and review like any config.
- Few-shot examples: One or two good examples in the prompt improve format and behavior.
- Output schema: Prefer JSON or markdown with clear sections for parsing and validation.
Safety
- Never let the model run commands or apply changes directly without human or automated review.
- Sandbox: Run generated code in a sandbox first when possible.
- Audit: Log prompts and responses for debugging and compliance.
Best practice: treat prompts as part of your product; test and iterate with real scenarios.
File System Optimization: Improving Disk Performance
Filesystem choice, mount options, IO schedulers — the per-host tweaks that actually moved disk performance for our database and storage workloads.
Shell Scripting Best Practices: Writing Maintainable Scripts
We have a few hundred shell scripts in production. The patterns that make them survive contact with reality, and the ones we've stopped writing.
More from AI
Explore more articles in this category
Meta and Sierra's Personal Agent Protocol, Explained
It is OAuth for letting your AI agent act on your behalf with a business, not another MCP, and it is nowhere near ready to build on.
Mistral Large 4 'Le Chonk': Self-Host or Use the API?
A 1T-parameter MoE model with open weights coming doesn't make self-hosting the right call for most teams.
Claude Haiku 5.5: When to Route Down From the Frontier Tier
Haiku 5.5 is cheap enough to stop rationing subagent calls, but the 75% savings claim only holds if your prompts are short.
You might have missed
Evergreen posts worth revisiting.