Anthropic / Claude Code8 minLesson 8 of 60
Claude Prompting Techniques
Anthropic's free prompt engineering course covers a handful of techniques that consistently improve results with Claude. None are tricks, they are ways of being clearer about what you want.
Use structure to separate parts
When a prompt has distinct parts, like instructions, a document, and a question, marking them clearly helps the model keep them apart. Many people use simple XML-style tags for this with Claude.
structured prompt
<task>Summarize the changes for the changelog.</task>
<diff>
... the git diff ...
</diff>
<format>One bullet per user-facing change, present tense.</format>Let it think before it answers
For harder problems, asking the model to reason step by step before giving the final answer improves accuracy. With reasoning-capable models you can also raise the thinking effort for tough tasks and lower it for simple ones.
Prefill the shape
If you need output in an exact shape, starting the answer for the model (the first line of JSON, the opening tag) nudges it to follow that shape for the rest.