Prompt Engineering Techniques
Detail on criteria and examples: explicit criteria and few shot prompting. This note is the architect's catalogue.
Techniques (verified, from Anthropic's prompting guide)
| Technique | Guidance |
|---|---|
| Clear and direct | Explicit instructions; request "above and beyond" behaviour explicitly |
| Context and motivation | State why, so Claude generalises |
| Examples | 3 to 5, relevant, diverse, in <example> tags |
| XML structure | Separate instructions, context, examples and inputs with consistent tags |
| Role | Useful in the system prompt; specifics matter more |
| Long context | Documents at the top, query at the end (up to 30% better on complex multi-document input) |
| Thinking and effort | Adaptive thinking; effort levels low, medium, high, xhigh, max; default effort varies by model |
| Output control | Say what to do, not only what not to do; specify format; structured outputs for schemas |
| Chaining | Explicit chains when you need intermediate outputs or a fixed pipeline; self-correction chain: draft, review, refine |
| Tool use | Clear tool descriptions; parallel tool calling guidance; investigate before answering |
| Hallucination control | Allow "I don't know", extract quotes first for long documents, verify claims with citations |
Obsolete or changed
- Prefilled assistant responses are not supported on newer models (400 error); migrate to direct instructions, structured outputs or tool calling.
- Techniques from older model generations may overtrigger or underperform; check the model-specific guidance and migration notes.
Thinking, effort and cost
Thinking tokens are billed as output tokens and count toward the context window. Effort is a primary cost and latency lever: Anthropic's tests found running at low effort and re-running failures at high gave about 40% lower cost than everything at high at the same pass rate when outputs can be checked (verified, directional) (D3.3).
Agentic prompting cautions
- Newer models may over-delegate to subagents and may be overeager; add explicit guidance on scope and when to delegate.
- Tell the model it is allowed to investigate before answering; do not claim things about code you have not opened.
- Do not focus on passing tests by hard-coding; verify behaviour.
Choosing techniques (design guidance)
Start with clear, explicit instructions and a few good examples; add structure (XML) when prompts mix content types; add chaining or subagents only when one call is not enough; add schema-constrained output when a program consumes the result; measure each change against an evaluation set (D4.1).
Exam traps
- Relying on prefill for format control.
- Stuffing contradictory instructions.
- More examples that are all alike.
- Maximum effort everywhere with no measurement.
- Ignoring model-specific guidance after an upgrade.
References
- Prompting best practices — checked Oct 16, 2026
- Reduce hallucinations — checked Oct 16, 2026
- Optimizing for cost and intelligence — checked Oct 16, 2026
Check your understanding
Prefill used to force JSON on a new model returns 400. Replacement?Show answerHide answer
Answer
Structured outputs (or tool calling).Where do long documents go relative to the question?Show answerHide answer
Answer
Documents first, question last.A cheap way to cut cost while keeping pass rate when outputs are checkable?Show answerHide answer
Answer
Run at lower effort and re-run failures at higher effort.