Learn AI · Foundations
Prompt Engineering Basics
The actual techniques that move the needle — role priming, structured output, few-shot examples, and why specificity always wins.
Key takeaways
- 1Specificity is the single biggest lever — vague prompts get vague outputs.
- 2Few-shot examples beat lengthy instructions for format and style.
- 3Always specify the output format (JSON schema, markdown structure, etc.).
- 4Negative instructions ('do not invent statistics') are surprisingly effective.
- 5Prompt engineering is empirical — keep an eval set, iterate against it.
Mental model
A prompt is a contract. You're telling the model:
- Who you want it to act as.
- What you want it to do.
- With what input.
- In what shape the output should come back.
- Avoiding what failure modes.
The clearer the contract, the better the output.
Technique 1 — Be specific
Bad: "Write a marketing email."
Better: "Write a 120-word marketing email to existing customers announcing our new annual plan (20% discount, locked-in pricing for 2 years). Tone: friendly but direct. CTA: 'Switch to Annual'. End with one PS line about cancellation policy."
Specificity isn't a stylistic choice. It's the single biggest lever you have.
Technique 2 — Show, don't tell (few-shot)
When you want a specific format or style, give 2–3 examples:
Convert these support tickets into bug reports.
Example 1:
Ticket: "App crashes when I tap settings"
Bug:
Title: Crash on Settings tap
Steps: 1. Open app 2. Tap Settings
Expected: Settings screen loads
Actual: App crashes
Example 2: ...
Now convert:
Ticket: "{user_input}"
This is more reliable than any amount of instruction.
Technique 3 — Structured output
If you need JSON, ask for JSON and describe the schema:
Return your answer as JSON matching this schema:
{
"summary": string (max 80 chars),
"sentiment": "positive" | "neutral" | "negative",
"action_items": string[]
}
Do not include any text outside the JSON object.
Even better: use the model's native structured output mode (OpenAI response_format, Anthropic tool use, Gemini schema parameter) when available.
Technique 4 — Chain of thought (when it helps)
Asking the model to think step by step before answering improves performance on reasoning tasks. But:
- Modern reasoning models (o3, Claude with extended thinking) do this internally.
- For simple tasks, CoT is wasted tokens.
- Use it when answers are wrong, not as a default.
Technique 5 — Negative examples
Tell the model what not to do:
Do not include speculation. Do not invent statistics. If you don't know, say "Unknown."
These instructions are surprisingly effective at preventing common failure modes.
Technique 6 — Position matters
Models pay strongest attention to the beginning and end of the prompt. Put the most important instructions there. For long context, restate the question at the end:
{long context}
---
Question (repeated for clarity): {actual question}
What doesn't matter as much as you think
- "You are an expert..." preambles — minor effect at best.
- All caps EMPHASIS — sometimes helps, often noise.
- Long elaborate persona descriptions — they pad the context for little gain.
The iteration loop
- Write the simplest prompt that should work.
- Run it on 5–10 real inputs.
- Find the failure mode that bites you most.
- Add one specific instruction or example targeting it.
- Repeat.
Prompt engineering is empirical. Trust your eval set over your intuition.
Common misconceptions
The wrong-but-common takes worth correcting.
Myth
There are magic phrases that unlock the model.
Reality
'You are an expert' adds maybe 1–3% on average. Specific instructions and good examples move quality far more.
Myth
Longer prompts are better prompts.
Reality
Every extra sentence is more tokens for the model to weigh. Trim ruthlessly — concise instructions are usually clearer.
Myth
Reasoning models don't need prompt engineering.
Reality
They need *less* prompt engineering for reasoning steps, but format specs, output schemas, and examples still matter.
Real-world use cases
Daily AI workflows
Better prompts means less back-and-forth, less re-prompting, and outputs you can actually use.
Open
Production LLM features
The difference between a 70% and 95% reliable feature is usually prompt quality + structured output.
Voice / style work
Show 3 examples of your voice; the model matches it more reliably than any 'persona' description.
Cost reduction
A smaller model with a great prompt often beats a bigger model with a lazy prompt. Saves real money at scale.
Frequently asked questions
Watch
Hand-picked videos from official + trusted channels. Opens in a new tab.
Related on AIKnowHub
Concept
AI Agents Explained
Agents are LLMs that can take actions in a loop. Here's what that actually means, where they shine, and where they fall over.
Concept
What is an LLM?
Large Language Models, explained from first principles — what they are, how they predict tokens, and where the magic and limits come from.
Comparison
Best AI Model for Writing
Which model writes prose that doesn't read like AI? A look at voice, restraint, and which models you can actually trust with words.
Learning Path
AI Creator Roadmap
For writers, YouTubers, podcasters, and indie creators. Use AI to do more, better, faster — without becoming AI slop.
Prompt
Fix a Prompt That Hallucinates
Reduce fabricated facts, citations, and details in model outputs.
Prompt
Fix a Prompt That Ignores Instructions
Diagnose why a model skips constraints and rebuild the prompt for compliance.