LEARN · PRACTISE · DISCOVER
Advanced Prompting: Structure, Examples and Chains
In the beginner course you learned the five building blocks of a good prompt. That is enough for most single requests, but complex work, such as turning a messy brief into a polished report, needs more structure. In this lesson you will learn three techniques Anthropic itself recommends for advanced prompting: separating content with XML-style tags, guiding Claude with carefully chosen examples, and breaking big jobs into a chain of smaller prompts.
Structure prompts with tags
Why tags help
When a prompt mixes instructions, background, source material and examples, Claude has to work out which part is which. Wrapping each part in descriptive tags removes that ambiguity. The tag names are not special keywords: any clear name works, as long as you use it consistently and refer to it in your instructions.
A reusable template
<task>
Rewrite the customer feedback below into a one-page summary for
our product team.
</task>
<context>
We sell a budgeting app. The team meets on Monday to decide what
to fix next quarter. They want problems, not praise.
</context>
<feedback>
[paste 30-50 customer comments here]
</feedback>
<format>
1. Top 5 problems, ranked by how often they appear
2. For each: a one-line description and 2 short quotes from <feedback>
3. A final "Unclear or contradictory" section
</format>Notice how the format section refers back to the feedback tag by name. This makes it clear that the quotes must come from the pasted material, which reduces the risk of invented quotes.
Guide Claude with examples
Few-shot prompting
Giving two to four examples of the input and the output you want is called few-shot prompting. It is the most reliable way to get a consistent tone, length and structure, especially for repeated tasks such as product descriptions, social posts or ticket replies.
Choosing good examples
- Make them varied. If all your examples are about shoes, Claude may assume every output should mention shoes.
- Make them realistic. Use real past work rather than invented, perfect examples.
- Label them. Wrap each one in example tags so Claude knows they are samples, not content to rewrite.
- Say what matters. Add a sentence such as “Match the length and tone of the examples, not their topics.”
Break big jobs into prompt chains
A single giant prompt that asks Claude to research, outline, draft, edit and format all at once often produces a mediocre result at every step. Prompt chaining means splitting the work into stages, checking each output and passing it into the next prompt.
Worked example: a long blog article
- Brief: “Ask me questions until you understand the audience, goal and key message of this article.” Then ask Claude to write a one-paragraph brief and check it.
- Outline: “Using the brief, propose three different outlines.” Pick one and edit it.
- Draft: “Write section 1 only, following the outline.” Continue section by section.
- Critique: “Act as a demanding editor. List the ten weakest sentences and explain why.” Then ask for revisions.
- Finish: “Write a title, meta description and three social posts based on the final text.”
Each step is small enough to check quickly, and a problem caught at the outline stage costs far less to fix than one discovered in a finished draft. For very long chains, start a fresh chat for later stages and paste in only what is needed, which also protects your usage allowance.
Ask Claude to think first
For tricky decisions inside a chain, you can ask Claude to reason before answering, for example: “First list the options and their trade-offs inside thinking tags, then give your recommendation.” Alternatively, switch on extended thinking for that step. Use this only where reasoning genuinely matters, as it makes responses longer.
Key takeaways
- XML-style tags separate instructions, context, source material and format, and let you refer to each part by name.
- Two to four varied, realistic, labelled examples are the most reliable way to control style and structure.
- Prompt chains split complex work into checkable stages and produce better final results.
- Ask for visible reasoning or extended thinking only on the steps that need it.
Practice
Take a task you do at least twice a month. Write a tagged prompt for it that includes a task, context, source material and format section plus two labelled examples. Run it on two different inputs and note whether the outputs are consistent. Then split one part of the task into a two-step chain and compare the quality.