Prompt engineering is the practice of writing instructions for an AI model so the output is usable the first time and the same on the tenth. A prompt that works gives the model a role, context, a task, a format, examples and constraints. This page covers that structure and seven of the 25 principles I use; the full set is in the free guide.
The free guide has all 25 principles, the tool selection chapter and the mini-course. Leave your email and I send it over.
Why prompts fail
Five reasons, and each one has a fix further down the page.
- The model had to guess the audience. "Write a product description" for a CFO and for a teenager are different jobs. If the audience is missing, the model picks one, and it is rarely yours.
- The task was two tasks. "Summarize this and suggest improvements" gets a thin summary and thin suggestions. Split them, or order them.
- The format was left to the model. Ask for nothing and you get the default: an introduction, bullet points, and a closing paragraph you delete.
- There was no example of good. Models copy what they see more reliably than what they are told. One example beats a paragraph of adjectives.
- The prompt was written once and never tested. It worked on Tuesday's input and broke on Wednesday's. A prompt that has run once has been demonstrated, and that is all.
The structure of a prompt that works
Six parts, in this order. Some prompts skip one or two of them, but I write all six first and delete later.
| Part |
What it does |
One line to steal |
| Role |
Sets the standard the model works to |
"You are a senior editor at a trade publication." |
| Context |
Gives the facts it cannot guess |
"The reader is a CFO who has ten minutes." |
| Task |
Says the one thing to do |
"Rewrite the draft below for that reader." |
| Format |
Fixes the shape of the output |
"Two short paragraphs, no bullet points, under 150 words." |
| Examples |
Shows what good looks like |
"Here is a paragraph in the tone I want: ..." |
| Constraints |
Says what to leave out |
"Add no claims that are missing from the draft." |
The mega-prompt template is this structure written out as a fill-in document, and it is free.
Seven of the 25 principles
The guide lists 25. These seven are the ones I use on every prompt and the ones I would teach first.
- Say the standard, then the task. "Write as a contract lawyer would" placed before "write the clause" changes every line that follows.
- Put long material before the instruction. Paste the document, then say what to do with it. When the instruction sits at the end, I get fewer misses on long inputs.
- One task per prompt. If you need two outputs, run two prompts, or number the steps and ask for the second only after the first is done.
- Show, then tell. One example of the output you want, then the description. If you only have the description, write a rough example yourself.
- Name the format precisely. "A table with these four columns" beats "a table". "Under 150 words" beats "short".
- Say what to leave out. Banned words, claims it cannot make, questions it should ask instead of assuming. Constraints do more work than the length of the section suggests.
- Ask it to ask. End with "Before you answer, ask me anything that would change your answer." The questions that come back tell you what your prompt left out.
How the main models differ
The structure above works on every model I have tested. What changes is where the pieces go and how much the model needs to be told. Cautious notes, because every model updates and the details move.
| Model |
What I adjust |
Ready prompts |
| ChatGPT |
Custom instructions hold the role and constraints across chats, so the prompt itself can be shorter |
ChatGPT prompts |
| Claude |
Long material goes first, wrapped in labeled tags, and the instruction goes after it |
Claude prompts |
| Gemini |
Format instructions get repeated at the end of a long prompt, and the task is stated up front |
Gemini prompts |
| Grok |
Real-time X data changes what context means: say whether live posts are in or out |
Grok prompts |
| Perplexity |
It searches before it answers, so the prompt says which sources count and how to cite them |
Perplexity prompts |
If you only learn one model, learn it on the one you already pay for. The principles carry over. The tags and settings do not.
How to test a prompt
A prompt that has run once has been demonstrated, and demonstrated is a long way from tested. The loop I use has five steps.
- Run it on five different inputs, including one ugly one: a messy transcript, a half-finished draft, an input with something missing.
- Write down what a pass looks like before you look at the outputs. Otherwise you grade on mood.
- Change one line at a time. Two changes at once and you learn nothing about either.
- Keep the failed versions. A folder of prompts that did not work is the fastest way to stop repeating them.
- Run the final version on a fresh input you have never seen, and read it as the person who will receive it.
The scoring rubric I use for the prompt library is on the documentation page, and it doubles as a grading sheet for your own prompts. If you would rather start from a draft than a blank page, the prompt generator writes the role, context, steps and format from a one-line description, and you test from there. For a structured course on the same material, the free AI courses page has a prompt engineering path.
What is inside the free guide
- 25 Key Prompt Engineering Principles. The seven above and the other eighteen.
- Essential AI Tool Selection. Which model and which tool for the job in front of you.
- Prompt Engineering Mini-Course. The principles as lessons, in order, so you can work through them rather than read them once.
- Lifetime access and updates. When a model changes and a principle stops holding, the guide changes with it.