Prompt Engineering Cheat Sheet
The prompting patterns worth reaching for — zero-shot, few-shot, chain-of-thought, and when each one earns its tokens.
- Zero-shot
- Few-shot
- Chain-of-thought
- System prompts
Pick a pattern
- Zero-shot — just ask. Best when the task is common and unambiguous.
- Few-shot — show 2–5 worked examples. Best when you need a specific format or style.
- Chain-of-thought — ask the model to reason step by step. Best for multi-step arithmetic, logic, and planning.
- Self-consistency — sample several chains and vote. Trades tokens for accuracy on hard reasoning.
Structure that holds up
- Role / system — who the model is and the rules it must follow.
- Context — the grounding material (retrieved docs, schema, examples).
- Task — the single, concrete instruction.
- Format — the exact output shape you want back.
Quick rules
- Put the instruction last for long contexts; models weight the tail heavily.
- Prefer explicit output contracts ("return JSON with keys x, y") over hoping.
- More examples help until they don't — measure, don't guess.
- Temperature near 0 for extraction; higher for ideation.