Guide
Generative AI & LLMs
Prompt engineering basics
Practical prompting techniques that reliably improve LLM output — with realistic expectations.
Overview
Prompt engineering is the practice of writing inputs that reliably get useful outputs from an LLM. It’s less about clever phrasing and more about clarity, structure and testing.
Techniques that consistently help
- Be explicit about the task and format. State what you want and the exact output shape (e.g. “Return JSON with fields
titleandsummary”). - Give context, not just instructions. Relevant background reduces guessing.
- Show examples (few-shot). One or two worked examples often beat a paragraph of description.
- Constrain the output. Ask for a specific length, schema or list.
- Ask it to reason before answering for complex tasks, then extract the final answer — but note this costs more tokens.
- Handle “I don’t know”. Explicitly permit the model to say it lacks enough information; this reduces confident fabrication.
Techniques with limits
- Politeness and “you are an expert” role prompts have modest, inconsistent effects.
- Very long prompts can dilute the important instructions.
- The same prompt won’t behave identically across different models or versions.
Treat prompts like code
- Keep prompts in version control.
- Build a small evaluation set of inputs with expected outcomes.
- When you change a prompt, re-run the evaluations rather than eyeballing one example.
Structure that works
Role/context: what the assistant is doing and for whom.
Task: the specific instruction.
Input: the data to operate on (clearly delimited).
Output format: exact schema or constraints.
Related
Last verified: August 2026. Technology and pricing change — always confirm current details with the vendor.