GPT Prompt Hacks

Advanced prompting techniques to get better, more reliable results from AI tools for sysadmin work.

Category: AI / GPT

1. Role + Context + Constraints

You are a senior Linux sysadmin. I'm running Ubuntu 22.04 on AWS EC2
with nginx as a reverse proxy and Node.js on port 3000.

[Your question here]

Constraints: solution must not require a server reboot,
must work without root access, and must be reversible.

2. Chain of Thought for Debugging

Think step by step. Before giving a solution:
1. List the 3 most likely causes
2. For each cause, describe a test to confirm or rule it out
3. Then provide the fix for the most probable cause

3. Ask for Multiple Approaches

Give me 3 different approaches to [problem].
For each: list the tradeoffs, complexity, and best use case.
Then recommend the best approach for a production environment
with 3 web servers and a shared NFS mount.

4. “Production-Safe” Qualifier

Rewrite this script to be production-safe:
- No hardcoded credentials (use env vars or secrets manager)
- Input validation for all user-supplied values
- Atomic operations where possible
- Idempotent (safe to run multiple times)
- Dry-run mode by default

[paste script]

5. Self-Critique Pattern

Write a bash script to [task].
Then review your own output and identify:
- Any security issues
- Edge cases not handled
- Any assumptions that might not hold in production
Then provide an improved version.