Module 03 — Prompt Engineering¶
Level: Beginner → Intermediate · Time: ~6 hours (pages) + ~2 hours (labs) · Exam relevance: CCAO-F D1, D7 · CCAR-P D2, D4
Prompt engineering is the craft of writing the instructions, context and examples that steer Claude toward a useful, reliable answer. This module turns the basics from Module 02 — Prompt fundamentals into a repeatable method you can use in the Claude apps and in production code.
All guidance here follows Anthropic's living reference,
Prompting best practices
(checked 2026-10-24). Where an API detail matters (thinking, effort, structured outputs), the examples follow the
current rules in docs/STYLE.md section 1.5.
Learning objectives¶
By the end of this module you can:
- Write clear, direct instructions that a capable newcomer could follow without guessing.
- Separate instructions, context, examples and inputs with XML tags.
- Choose between zero-shot and few-shot prompting, and build a small, diverse example set.
- Decide when Claude should reason before answering, and tune that with adaptive thinking and
effort. - Break a complex request into sub-tasks and chain them, with checks between steps.
- Get machine-readable output with JSON Schema structured outputs,
messages.parse()and strict tools, and explain why assistant prefill is no longer used. - Design system prompts, roles, reusable templates and guardrails.
- Improve a prompt systematically with test cases and small, measured changes.
- Adapt your strategy to the task type: analysis, research, drafting or brainstorming.
Page order¶
| # | Page | What you learn |
|---|---|---|
| 1 | Clear and direct instructions | The "new colleague" test, context and motivation, task-type strategies |
| 2 | Structure with XML tags | Separating instructions from data, nesting documents, tagged output |
| 3 | Examples and few-shot prompting | Zero-shot vs few-shot, choosing and formatting examples |
| 4 | Reasoning and thinking | Prompted chain of thought, adaptive thinking, the effort parameter |
| 5 | Task decomposition and chaining | Splitting work, sequential and parallel chains, self-correction |
| 6 | Structured output | JSON Schema outputs, Pydantic parsing, strict tools, life after prefill |
| 7 | System prompts and roles | Roles, templates, variables, guardrails, prompt injection basics |
| 8 | Iterating on prompts | Test sets, failure analysis, versioning, knowing when to stop |
Prerequisites¶
- Module 01 — AI and LLM fundamentals, especially tokens and hallucinations.
- Module 02 — Claude fundamentals.
- For the code examples: Python 3.10+, the
anthropicSDK and an API key in an environment variable (see environment setup). Every concept can also be practised in the Claude apps without code.
Exam relevance¶
Objective IDs come from 16-certification-tracks/registry.yaml.
| Certification | Objectives covered | Where |
|---|---|---|
| CCAO-F | CCAO-F-1.1 Write effective prompts | Pages 1, 2, 3, 7 |
| CCAO-F | CCAO-F-1.2 Decompose complex requests | Page 5 |
| CCAO-F | CCAO-F-1.3 Iterate on prompts | Page 8 |
| CCAO-F | CCAO-F-1.4 Adapt strategy to task type | Pages 1, 4, 5 |
| CCAO-F | CCAO-F-2.6 Choose output formats | Page 6 |
| CCAO-F | CCAO-F-5.3 Write system-level instructions | Page 7 |
| CCAO-F | CCAO-F-7.1, 7.2 Diagnose and fix poor outputs | Page 8 |
| CCAR-P | CCAR-P-2.2 System prompts, templates, guardrails | Page 7 |
| CCAR-P | CCAR-P-2.3 Zero-shot, few-shot, chain of thought | Pages 3, 4 |
| CCAR-P | CCAR-P-1.5 Decomposition techniques | Page 5 |
| CCAR-P | CCAR-P-4.4 Diagnose prompt failure | Page 8 |
| CCAR-P | CCAR-P-5.1 Guardrails and safety controls | Page 7 |
Foundations candidates should be able to apply every technique in the Claude apps. Professional candidates should also be able to justify the technique in an architecture review and know the API mechanics (structured outputs, effort, strict tools).
Hands-on labs¶
- Lab 02 — Prompt improvement: take a weak prompt through several measured revisions.
- Lab 03 — Structured outputs: extract validated JSON with
output_config.formatand Pydantic. - Lab 16 — Evaluation framework: build the test harness that page 8 describes.
Cost: requires API credits (live mode). All labs run offline in mock mode by default.
Quick reference¶
Next module¶
Continue to Module 04 — Context Engineering, which widens the lens from the words in one prompt to everything that fills Claude's context window: documents, memory, caching and Skills.