Prompt engineering is the practice of writing, testing and refining the instructions you give a generative AI model, such as a chatbot or an AI writing tool. The instructions are the prompt. The engineering part is treating the prompt like any other work you improve: you try it on real inputs, look at what comes back, and change it until the results are reliably good.
The same model can give a vague answer to one prompt and a precise, usable one to another. The difference is usually what you told it.
What goes into a good prompt
Most strong prompts cover the same few things. The prompting guides AI companies publish for their models all stress the first three:
- A clear task. Say exactly what you want, in what form. "Write five title options of at most 60 characters" beats "Give me some titles."
- The context the model lacks. Who it's for, what it's about, which facts to use. The model doesn't know your product, your audience or last week's changes unless you tell it.
- Examples. One to a few samples of the output you want. They show tone, length and format better than a description.
- Constraints and format. Length, words to avoid, the structure of the answer (a table, JSON, bullet points).
- The reason. A short "because" helps. "Keep it short, because search results cut long snippets to fit the screen" tells the model what matters.
One of those guides suggests a simple test: show your prompt to a colleague who knows little about the task and ask them to follow it. If they'd be confused, the model will be too.
A worked example
Say you want meta descriptions for product pages. A first attempt:
Write a meta description for our hiking boots page.
The model has to guess the brand, the boots, the audience and the length. A better version:
You write meta descriptions for an outdoor gear shop. Write one for the product page below. Keep it under 155 characters. Say who the boot is for and its main benefit, and end with a reason to click. Use only facts from the page text. Don't use the words "best" or "ultimate."
Page text: [paste the product description here]
Example of the style we want: "Light, waterproof trail runners for day hikes. Grippy soles, wide toe box, and free returns for 60 days."
It names the task, gives the source text, sets limits, explains what a good result looks like and shows one sample.
Common techniques
| Technique | What you do | When it helps |
|---|---|---|
| Zero-shot | Ask with instructions only | Simple, common tasks |
| Few-shot | Add a few examples of input and desired output | You need a specific format or style |
| Role | Tell the model who it is ("You are a technical editor") | Setting tone and expertise |
| Step-by-step reasoning | Ask the model to work through the problem before answering | Analysis, math, multi-step decisions |
| Supplying sources | Paste the documents or data it should use | Facts the model can't know, such as your own data |
| Prompt chaining | Split a big job into several prompts, each feeding the next | Long or complex tasks |
Step-by-step reasoning has a research name: chain-of-thought prompting. A 2022 research paper showed that asking large models to lay out intermediate steps improved their results on math and reasoning tasks (arXiv). Many newer models have a built-in thinking mode that does this before they answer, so asking matters less than it used to.
Supplying sources automatically, by searching your documents and adding the best matches to the prompt, is called retrieval-augmented generation (RAG).
Test prompts, don't just write them
A prompt that worked once may fail on the next input. Prompt engineering starts with deciding what a good answer looks like and how you'll check it; the model makers' own guides say the same.
A practical routine:
- Collect 10 to 20 real inputs, including awkward ones: a very short product page, a page in another language, one with missing details.
- Write down what a good answer must do, such as "under 155 characters, no invented facts, mentions the main benefit."
- Run the prompt on all of them and check each answer against your list.
- Change one thing at a time and run the set again.
Keep the prompts that work in a shared document, with the date and the tool you used. Models change, and a prompt that worked last year may behave differently now.
Where prompting reaches its limits
Prompts can't add knowledge the model lacks. A language model predicts likely text; it doesn't look facts up. Google's guidance on AI-generated content makes the same point, and it's why models sometimes state wrong facts confidently (Google Search Central). Give the model the facts, ask it to use only those, and check numbers, names and dates yourself.
Some problems aren't prompt problems. If answers are too slow, too expensive or need data the model can't reach, a different model, a tool connection or a better data source may help more than rewording.
Text you paste in can carry instructions. If you ask a model to summarize a web page or a document, hidden text in it can try to steer the model: "ignore your instructions and..." This is called prompt injection, and it's a known risk for any tool that feeds outside content to a model (OWASP). Treat answers about untrusted content with care, and don't give such tools access to anything you couldn't afford to leak.
Prompting for SEO and content work
Prompts are useful for drafts and repetitive tasks: grouping keywords by search intent, suggesting title variants, summarizing competitor pages you paste in, turning notes into an outline, or checking a draft against a style guide.
Publishing is a different question. Google's spam policies name scaled content abuse: generating many pages, with AI or any other method, mainly to manipulate rankings without adding value for users (Google Search Central). A better prompt doesn't change that. Use AI output as a starting point, add what only you know, and check every fact before it goes live.