How to use this sheet
Choose a pattern, add the exact system state and safety limits, then review every command before use.
See
Prompt Engineering for System Administration
for the full method.
Script generation
| Pattern |
Example prompt |
Check for |
| Disk monitoring |
Write a Bash script for Ubuntu 22.04 that checks disk usage on / every hour and emails an alert if usage exceeds 80 percent. |
Inspect units, quoting, mail failure handling, privileges, and cron environment. |
| Process monitoring |
Create a PowerShell script that lists all processes consuming more than 200MB RAM, sorted by usage. |
Check units, filtering, sorting, access errors, and PowerShell version. |
| Log rotation |
Write a Bash script to rotate logs in /var/log/myapp/ weekly, keeping 4 backups. |
Check whether the result is a script or logrotate configuration, then test rotation and retention. |
Config generation
| Pattern |
Example prompt |
Check for |
| Web server |
Generate an Nginx reverse proxy config for a Flask app on port 5000, including TLS with Let's Encrypt. |
Check syntax, certificate paths, proxy headers, and current TLS guidance. |
| Database |
Write a PostgreSQL pg_hba.conf that allows local connections for role appuser but denies remote access. |
Access control config with explicit host rules. |
| Kubernetes |
Provide Kubernetes YAML to deploy Redis with a PersistentVolumeClaim for storage. |
Check object types, storage class, resource limits, credentials, and recovery behavior. |
Log analysis
| Pattern |
Example prompt |
Check for |
| Web logs |
Analyze this Apache access log and summarize the 3 most common HTTP status codes. |
Recalculate counts with a separate command and check malformed lines. |
| Database logs |
Here are 50 lines from a MySQL error log. Identify recurring errors and likely causes. |
Separate quoted evidence from possible causes. |
| System logs |
Review this syslog snippet and explain which service is failing and why. |
Require a service name, quoted evidence, and unresolved assumptions. |
Security audits
| Pattern |
Example prompt |
Check for |
| SSH |
Audit this sshd_config and list insecure settings. Suggest safer alternatives. |
Verify each finding against the installed sshd_config manual page. |
| Nginx |
Review this nginx.conf for security hardening. Assess CSP and HSTS for this deployment. |
Check context, version support, syntax, and deployment-specific effects. |
| Containers |
Given this Dockerfile, point out potential security issues and propose fixes. |
Separate confirmed defects from policy choices and test the resulting image. |
Documentation and runbooks
| Pattern |
Example prompt |
Check for |
| Service restart |
Write a runbook for restarting PostgreSQL on Ubuntu 22.04 safely. |
Step-by-step checklist with commands and verification steps. |
| Incident response |
Draft incident response steps for diagnosing an Nginx 502 Bad Gateway error. |
Check read-only evidence collection, stop conditions, and escalation. |
| Deployment |
Document the steps to roll out a new version of a containerized app using Kubernetes rolling updates. |
Check prerequisites, observation, rollback, and application-level verification. |
Best practices
- Provide operating system, tool, and service versions.
- Request explanations, not only commands or configuration.
- Request non-destructive checks before state changes.
- Treat generated output as a draft and validate it before use.
Further reading