Stage 5: Prompt and context engineering
Reliable behaviour from what you put in the model's window.
Summary, rules and context: AI Engineering Guide, Stage 5.
Learn
Curriculum lessons, in reading order.
Apply
Field-manual scenarios: implementation steps, an example, trade-offs, production notes, a checklist and metrics.
1-prompt-engineering/
- Prompt engineering → Prompt structure (stable-first, ordered sections)
- Prompt engineering → Delimiters: instructions vs data
- Prompt engineering → Zero-shot and few-shot prompting
- Prompt engineering → Chain-of-thought (when it pays, when it doesn't)
- Prompt engineering → Self-consistency (sample n, majority vote)
- Prompt engineering → Decomposition, negative examples, and prefilling
- Prompt engineering → Dynamic few-shot selection (retrieve the k most similar solved cases)
- Prompt engineering → Structured outputs & tool use (schema, validate, retry)
- Prompt engineering → Prompt versioning & evaluation (prompts are code)
2-context-engineering/
- Context engineering → What it is (managing everything in the window)
- Context engineering → Compaction / summarisation of long history
- Context engineering → "Lost in the middle" (position matters)
- Context engineering → Per-source truncation budgets
- Context engineering → Prompt caching of static prefixes
- Context engineering → Context isolation (subagents get their own window)
- Context engineering → Failure modes: poisoning, distraction, confusion, clash
Previous: Stage 4: Foundation models and LLMs · Next: Stage 6: Retrieval-augmented generation