Applied LLMs
Prompt Engineering — Foundations
Prompting is a skill, not a hack. Five techniques that work across models: clear role, structured output, examples, decomposition, and verification.
beginner · 7 min read
The five things that actually work
Product-quality prompts almost always combine these:
1. Give the model a role and a goal
Not: Summarise this.
But: You are a senior product manager. Summarise this transcript into three bullets a busy executive will read in 20 seconds.
2. Specify the output format
Asking for JSON? Show the exact shape. Asking for Markdown? Show the section headings. Ambiguity in the format spec = ambiguity in the output.
3. Provide examples (few-shot)
Two or three (input → output) pairs teach the model your judgement faster than three paragraphs of instructions. This works especially well for classification and structured extraction.
4. Decompose the problem
For multi-step reasoning, ask the model to think through sub-questions first. "Think step by step" is the classic prompt; modern models do this implicitly when the task is hard. For agents, splitting one big prompt into a chain of small ones is more reliable than one giant one.
5. Make the model verify itself
After the main output, ask: Does this answer the original question? List any factual claims you cannot verify. You will catch a surprising fraction of errors.
What doesn't work
- Asking the model to pretend it has a capability it doesn't.
- Threats, bribes, or all-caps shouting.
- Long preambles about how important the task is.
If a prompt isn't producing the output you want, the answer is almost always: be more specific about the output, not more dramatic about the request.