Last updated
GPT Prompting Guide
A practical guide to getting the most out of ChatGPT and the OpenAI API: picking the right model, custom instructions, and prompt templates. Focused on IT ops and sysadmin workflows.
▶ Watch the demo: Prompt Lab: the 4-part prompt formula (25 sec)Watch on YouTubeSubscribe
Model Selection
| Model tier | Best For | Notes |
|---|---|---|
| Flagship (default) | Code, analysis, writing configs | Start here for most sysadmin work |
| Reasoning / thinking | Hard debugging, multi-step root cause analysis | Slower; thinks before answering. Use when the flagship gets it wrong |
| Mini / fast | Quick lookups, one-liners, bulk API jobs | Cheapest; fine for simple, well-specified tasks |
Model names change every few months. Check the model picker in ChatGPT or OpenAI’s model list for the current names in each tier; the prompting advice below works the same across them.
Custom Instructions (ChatGPT)
Set persistent context in Settings → Personalization → Custom Instructions. Effective sysadmin setup:
What would you like ChatGPT to know about you?
I am a senior Linux sysadmin managing Ubuntu 22.04, RHEL 9, Docker,
Kubernetes, and AWS infrastructure. I prefer CLI-first solutions,
minimal dependencies, and well-commented scripts.
How would you like ChatGPT to respond?
Provide working code I can run immediately. Skip preamble.
Use code blocks for all commands. Flag any destructive operations
with a WARNING comment. Prefer bash over Python for simple automation.
System Prompt (API)
You are a senior DevOps engineer. When asked for scripts or configs:
1. Always include error handling (set -euo pipefail for bash).
2. Add inline comments for non-obvious lines.
3. State any required packages at the top.
4. Flag commands that require sudo or root with # REQUIRES ROOT.
Return ONLY code unless the user asks for explanation.
Sysadmin Prompt Templates
| Task | Prompt |
|---|---|
| Docker Compose | Create a docker-compose.yml for [service] with: health checks, restart:unless-stopped, named volumes, and a .env file for secrets. |
| Regex | Write a POSIX-ERE regex that matches [pattern]. Test it with: grep -E ‘[regex]’ and show 3 matching and 2 non-matching examples. |
| Firewall rules | Generate iptables/ufw rules to: allow [ports] from [source], deny all else. Include rules to persist across reboots on Ubuntu 22.04. |
| Explain error | Explain this error in plain English and give the most likely fix: [paste error]. OS: Ubuntu 22.04. Context: [what you were doing]. |
| AWS CLI | Write AWS CLI commands to [task]. Use –output json and pipe through jq to extract [fields]. Include the IAM permissions required. |
Best Practices
- Paste error messages verbatim: GPT-4o is excellent at interpreting stack traces.
- Use the o1/o3 model for architecture planning and complex multi-step debugging.
- For code reviews, ask: “Review for security issues, logic bugs, and edge cases only.”
- Iterate: “The script works but fails when [edge case]: fix only that part.”
- Use the file-upload feature to analyze configs, logs, or CSVs directly.
- Enable memory/Projects for persistent context across sessions (ChatGPT Plus).
Last updated October 2026.
FAQ
How do I get better answers from ChatGPT?
Give context, say who the answer is for, ask for a format, and set Custom Instructions once so you do not repeat yourself.
Should I trust ChatGPT's commands?
Check them first, especially anything destructive or run with sudo.