8.4 Prompt engineering that survives users
You can write a system prompt that behaves under adversarial input.
Before:07. Natural Language ProcessingUnlocks:09. Agentic AI12. Frontier Topics
A system prompt that survives real users is contract design: explicit roles, examples, output specifications, versioned templates, and regression tests over a failure taxonomy. Few-shot examples remain the highest-leverage trick per token spent. It sits at the heart of applied LLM work. The testing gap is the trap — a prompt tested only on polite inputs meets adversarial, malformed and off-topic input in production, and the demo behaviour does not survive the meeting.
Work through these
Roles, instructions, examples, output contracts
The parts of a well-built prompt: who the model is acting as, what it must do, examples of good output, and the exact shape the answer should take. The output contract is the part most often omitted.
Zero-shot, few-shot, chain-of-thought, self-consistency
Asking with no examples, with a few, with the reasoning made explicit, or by sampling several answers and taking the consensus. Each buys accuracy at a different cost.
Prompt templates and versioning
Prompts are code and belong under version control with the rest of it. Treating them as text pasted into a box is why prompt changes cause unexplained regressions.
Failure taxonomies and prompt regression tests
Cataloguing how a prompt fails, and testing against those cases whenever it changes. This is the difference between prompt engineering and prompt fiddling.
Sign in to keep your progress.
Free resources
We haven't checked most of these for screen reader use yet.
Links last checked 29 Aug 2026.
Stuck here?
Ask a mentor. A real person answers, and they can see exactly which topic you're on. Usually within a couple of working days.
Checking your session…
Topics shown in module order.