Prompt Engineering with Claude
XML tags, few-shot, chain-of-thought, prompt caching, and the Console Prompt Improver — the techniques that turn a Claude prompt into a production one.
View badge details
About This Course
You have called Claude from Python now learn to shape its output on purpose. This course teaches the prompt-engineering techniques Anthropic itself recommends: XML tag conventions for structured input and output, few-shot examples that transfer patterns, chain-of-thought scaffolding for reasoning tasks, and prompt caching for real cost and throughput wins. By the end you will be able to write, iterate, and cost-optimize a Claude prompt ready for production.
Course Curriculum
10 Lessons
XML tag conventions for Claude prompts
By the end of this lesson you will know why Anthropic trained Claude to respond well to XML-tagged prompts and the three uses that matter in production code: separating input chunks with <document> / <ticket> tags, shaping Claude's output inside tags like <category> for parse-safe replies, and scaffolding reasoning with <thinking> sections. This is the first technique the Claude AI Engineer path teaches for turning "kinda works" prompts into production-shape ones.
Structure a triage prompt with XML tags - Lab Exercises
By the end of this hands-on lab you will have rewritten Orion Analytics' brittle L5-era support-triage prompt using XML tags (wrapping the ticket in input tags and asking Claude to reply inside category / next-step tags for parse-safe output), measured the parse-failure-rate drop across 10 real-shape tickets (targeting ~60% to ~99%), and seen the security payoff of input tags with your own eyes on a specifically crafted instruction-injection ticket.
Few-shot prompting for reliable Claude classifiers
By the end of this lesson you will know when to escalate a Claude prompt from zero-shot instructions to few-shot examples, which specific tickets to pick as your examples (edge cases beat typical cases), and how to structure the example block with XML tags so Claude reliably matches the pattern. Building on the XML-tag work from L1-L2, you'll see how few-shot examples raise Orion Analytics' triage-bot accuracy from ~85% to ~97% on the same 10 tickets.
Building a few-shot ticket classifier - Lab Exercises
By the end of this hands-on lab you will have layered 3 hand-picked few-shot examples on top of your L2 XML-tagged triage prompt, measured the accuracy delta across 20 tickets (10 typical + 10 edge cases), and seen with your own eyes that BAD few-shot examples DROP accuracy below zero-shot — the critical production intuition that example SELECTION matters more than example COUNT. Uses the same PythonAI container + Claude API proxy setup as CLD-AI-101.
Chain-of-thought and adaptive thinking on Claude 5.x
By the end of this lesson you will know when to add an explicit <thinking>...</thinking> reasoning surface to a Claude prompt (chain-of-thought), how the 5.x-series adaptive-thinking output_config.effort parameter does the same job automatically on Opus 5.5 (and sometimes Fable 5.1), and which one to reach for based on whether you need to log/audit the reasoning or just want higher accuracy on hard multi-step questions. Building on the XML tags from L1 and few-shot from L3, chain-of-thought is the third technique for turning "kinda works" into production-shape.
Apply chain-of-thought vs adaptive thinking - Lab Exercises
By the end of this hands-on lab you will have run Orion Analytics' escalation-decision prompt three ways (no reasoning surface, explicit <thinking> CoT on Sonnet 5, adaptive thinking on Opus 5.5), measured accuracy + output tokens + thinking tokens + latency across 15 escalation-shape tickets, and recommended a production configuration based on your own numbers. Uses the same PythonAI container + Claude API proxy as CLD-AI-101; the safe-extraction pattern from L1 (filtering for type == "text") is doing its third round of duty here — adaptive thinking always emits a ThinkingBlock on Opus 5.5.
Prompt caching — pay for context tokens once
By the end of this lesson you will know how Claude's prompt caching feature works (cache_control markers + 5-minute TTL), which parts of a prompt are worth caching (system prompt, few-shot examples, reference documents — anything > 1024 tokens that repeats across ≥ 2-3 calls), how to structure a prompt so the cache actually hits, and how to read the cache_read_input_tokens / cache_creation_input_tokens metrics in the response to confirm you got the savings. Combined with the XML tags (L1), few-shot (L3), and CoT (L5) techniques you already know, caching is what turns Orion Analytics' ~200,000-tickets-per-month workload from a $900/month Claude bill into a ~$100/month one.
Measure prompt cache cost + throughput - Lab Exercises
By the end of this hands-on lab you will have layered cache_control markers on L4's few-shot classifier, fired 20 tickets in a burst to trigger cache hits, read the cache_read_input_tokens and cache_creation_input_tokens metrics from the response usage to confirm you got the ~90% cost savings L7 predicted, and deliberately broken the cache with an upstream timestamp to see the failure mode with your own eyes. Uses the same PythonAI container + Claude API proxy stack as the earlier CLD-AI-102 labs.
The Anthropic Prompt Improver
By the end of this lesson you will know what the Anthropic Prompt Improver is (an in-Playground / API-callable tool at platform.claude.com that takes a prompt + a test set and automatically iterates the prompt against a rubric), when to reach for it (mid-cycle when you've squeezed the manual techniques from L1-L8 but still have a specific accuracy tail), and how to build a good test set (8-20 rows covering typical + edge + adversarial cases). Skipping this step is the single most common reason production Claude prompts leave 3-5 accuracy points on the table.
Iterate a real Orion triage prompt through the Prompt Improver - Lab Exercises
Capstone hands-on for CLD-AI-102. By the end you will have taken a deliberately-broken Orion triage classifier at ~75% accuracy, stacked L1 XML tags + L4 few-shot examples + L6 explicit chain-of-thought to reach ~92%, built a 15-row edge-covering test set for the Anthropic Prompt Improver, run it through the Playground at platform.claude.com/prompt-improver, and pasted the auto-refined prompt back into working Python — closing the full CLD-AI-102 accuracy ladder from ~75% → ~97% on the same 25 tickets. This is the deliverable your team lead reviews.