Why prompt engineering matters
LLMs are extremely capable but completely literal about what you didn’t say. Ask “summarise this report” and the model must guess the audience, length, focus and format. Each guess is a coin flip. Prompt engineering removes the guesses, which delivers three things businesses care about:
- Accuracy: context and constraints keep the model on the facts you supplied.
- Consistency: the same prompt template produces the same shape of output for thousands of inputs.
- Cost: a well-prompted smaller model often beats a poorly prompted larger one — at a fraction of the token cost.
The anatomy of a good prompt
Role
Who the model should act as — sets vocabulary, depth and point of view.
Task
One clear verb and goal: classify, extract, draft, compare, explain.
Context
The data, audience and background the model can’t know otherwise.
Format
Exact output shape: bullets, table, JSON schema, word limit.
Constraints
Rules and boundaries: tone, what to avoid, what to do when unsure.
Examples
One to five input → output pairs that show rather than tell.
Interactive prompt builder
Want this with saved templates and variations? Use the full Prompt Builder, then stress-test it with the Prompt Optimizer.
8 prompt engineering techniques (with examples)
1. Zero-shot prompting
Instructions only, no examples. Works for common tasks with a clear format.
Classify the sentiment of this review as positive, negative or neutral.
Review: "Setup took five minutes and support answered instantly."
2. Few-shot prompting
Add a few labelled examples so the model copies the pattern — the single most reliable way to fix format and edge cases.
Review: "Arrived broken, refund took weeks." → negative
Review: "Does what it says." → neutral
Review: "Best purchase this year!" → positive
Review: "Battery died after two days but support replaced it." →
3. Role (persona) prompting
“You are a senior data engineer reviewing a junior’s SQL” changes depth, terminology and what the model looks for. Combine with explicit criteria — a role alone is not a spec.
4. Chain-of-thought and reasoning
For multi-step problems, ask the model to work through the steps before the final answer, or to produce a plan first. Many current models reason internally, so focus your instruction on what to check (“verify totals add up before answering”) rather than just “think step by step.”
5. Delimiters and clear sections
Wrap supplied material in tags such as <document>…</document> or triple quotes. This separates instructions from data, improves accuracy and is a first line of defence against prompt injection hidden in that data.
6. Structured output
When the answer feeds code or a sheet, define a JSON schema and use the API’s structured-output mode if your provider offers one. Validate in code. Build schemas fast with the JSON Schema Builder.
7. Prompt chaining
Break big jobs into steps: extract facts → check facts → draft → critique → final. Each prompt is simpler, easier to test and easier to debug than one mega-prompt.
8. Self-critique and verification
Ask the model to review its own draft against your criteria (“list any claims not supported by the document, then fix them”). This catches a surprising share of errors — and pairs well with the techniques in reducing hallucinations.
Before and after: real examples
| Weak prompt | Engineered prompt |
|---|---|
| Summarise this report. | You are briefing a CFO with 2 minutes. Summarise the report in <report> tags as 5 bullets: revenue, costs, risks, decisions needed, next steps. Max 15 words per bullet. Flag any number you couldn’t find. |
| Write SQL for top customers. | Using the schema below (PostgreSQL), write a query returning the top 10 customers by 2025 revenue with name, revenue and order count. Exclude refunded orders. Return only the SQL, then one line explaining the joins. |
| Is this email phishing? | Act as a security analyst. Assess the email in <email> tags. Return JSON {"verdict": "phishing|suspicious|safe", "signals": [..], "confidence": 0-1}. Base signals only on the email content. |
Copy-paste prompt templates
ExtractionYou are a precise data-extraction assistant.
Extract the fields below from the text in <text> tags.
Return valid JSON matching: {"company": string, "date": "YYYY-MM-DD", "amount": number, "currency": string}
If a field is missing, use null. Do not guess.
<text>{{paste text}}</text>
Explain like a teacher
Explain {{concept}} to a {{audience}}.
Use one everyday analogy, one concrete example, and finish with 3 quiz questions (answers at the end).
Keep it under 250 words.
Critique and improve
Here is a draft in <draft> tags and the goal: {{goal}}.
1) List the 3 biggest weaknesses against the goal.
2) Rewrite the draft fixing them. Keep the author's voice.
<draft>{{draft}}</draft>
Common prompt engineering mistakes
- Vague success criteria — “make it better” has no target. Say what better means.
- Burying the task under paragraphs of context. Put the instruction up front, data in delimited blocks.
- Contradictory rules (“be detailed” + “max 50 words”). The model will pick one unpredictably.
- Testing on one input. A prompt that works once may fail on the next ten. Keep a small test set.
- Cranking temperature for creativity on factual tasks — see temperature explained.
Is prompt engineering a career?
“Prompt engineer” as a standalone job title has become rarer, but the skill is now expected across roles — AI engineers, analysts, product managers and support leads all write prompts that ship to production. The most valuable version of the skill combines prompting with evaluation, RAG and tooling. Our Prompt Engineer learning path covers exactly that combination, and the AI Engineer Roadmap shows where it fits.
Discussion