No matter which AI Assisted development tool (ChatGPT Codex, Cursor, etc.) you use, writing effective prompts will yield better outcomes.
I learnt that a prompt must structure information across six parts.
- Goal
- Constraints
- Coverage
- Output format
- Unknowns & choices
- Action boundary (Guardrail)
I previously wrote about moving to Amazon Lightsail from Utho, my existing Cloud service provider. Let us use that scenario as an example to build the prompt.
Imagine asking Codex to list the steps involved to setup production website on Amazon Lightsail using LEMP. Here is how the prompt looks:
List the steps needed to set up a production WordPress website on an Amazon Lightsail instance using LEMP: Linux, Nginx, MySQL, and PHP.
Use a plain Ubuntu instance rather than a preconfigured WordPress image. Check current official documentation for supported versions and instructions.
Cover:
- Setting up SSH access, a non-root sudo user, and firewalls.
- Installing and configuring Nginx, MySQL, PHP-FPM, and the PHP extensions WordPress needs.
- Creating a dedicated WordPress database and database user.
- Installing WordPress with WP-CLI and setting appropriate file ownership and permissions.
- Configuring Nginx for WordPress, including permalinks and PHP handling.
- Enabling HTTPS with automatic certificate renewal.
- Configuring backups, security updates, and basic monitoring.
- Verifying the setup and troubleshooting common errors.
Present the steps in execution order. For each step, explain its purpose, provide the commands or Lightsail console actions, and describe how to verify success. Clearly mark placeholders such as the domain name and IP address. Explain any choices that depend on budget or expected traffic.
Only provide the instructions; do not create resources or make changes.
Now, let us look how the prompt is structured across the six parts listed above.
Goal
List the steps needed to set up a production WordPress website on an Amazon Lightsail instance using LEMP: Linux, Nginx, MySQL, and PHP.
Constraints
Use a plain Ubuntu instance rather than a preconfigured WordPress image. Check current official documentation for supported versions and instructions.
Coverage
Lists the topics the answer must include, from setting up SSH access through backups and monitoring.
Output Format
Requesting steps in execution order, with purpose, commands or console actions, and verification.
Unknowns
Clearly mark placeholders such as the domain name and IP address. Explain any choices that depend on budget or expected traffic.
Action Boundary
Only provide the instructions; do not create resources or make changes.
You don’t need to provide all parts in a prompt each time. However, having them all yields better results. Give it a try!
Leave a Reply