CONCEPT A small, reusable vocabulary of tags
Because no tag names are reserved (4.1), teams converge on a handful of conventional, descriptive tags simply because they read clearly. You don't have to use these exact names — but they're a solid default set, and staying close to convention makes prompts easier for humans to review too.
| Tag | What it holds |
|---|---|
<document> / <documents> | Source material Claude should read — reports, transcripts, pasted text. |
<instructions> | The task itself: what Claude should do, step by step. |
<example> / <examples> | Few-shot demonstrations of the desired input→output behavior. |
<context> | Background the task depends on but that isn't the primary data. |
<formatting> | Rules for how the answer should be shaped/structured. |
<input> / <query> | The specific variable input or question for this call. |
<source_text> would work just as
well as <document> — as long as you use it consistently.CONCEPT Consistency + referencing the tag by name
Two habits turn a pile of tags into a reliable structure:
- Be consistent. Use the same tag name for the same kind of content in every prompt and
every call. Don't switch between
<doc>,<document>, and<text>for the same thing — inconsistency reintroduces the ambiguity tags were meant to remove. - Refer to tags by name in your instructions. Instead of "use the text above," write
"Using the contract in
<document>, answer the question in<query>." Naming the tag ties the instruction to an exact region of the prompt so Claude knows precisely what you mean.
<document>" is unambiguous; "summarize the article" leaves Claude to hunt for it.DIAGRAM A conventional prompt skeleton
background"] P --> D["<document>
source material"] P --> E["<example>
few-shot demo"] P --> F["<formatting>
output shape"] P --> I["<instructions>
the task — refers back to
<document> & <example> by name"] classDef data fill:#e7f0ff,stroke:#4a90d9,color:#123; classDef task fill:#d4edda,stroke:#28a745,color:#155724; class C,D,E,F data; class I task;
CODE A prompt built from conventional tags
Each content type gets its own tag, names stay consistent, and the <instructions> block
refers to the other tags by name.
# System / user prompt content
<context>
You are reviewing support tickets for a SaaS billing product.
</context>
<example>
Ticket: "Charged twice this month." → Category: billing_error; Priority: high
</example>
<document>
Ticket #4821: I was billed for the Pro plan but I'm on the Free tier.
</document>
<formatting>
Reply as JSON with keys: category, priority, one_line_summary.
</formatting>
<instructions>
Using the ticket in <document> and the pattern shown in <example>,
classify the ticket. Follow the shape in <formatting> exactly.
</instructions>
<instructions> names <document>,
<example>, and <formatting> — the instruction is wired to exact regions,
not to "the stuff above."TRADE-OFFS House conventions vs. ad-hoc tags
✅ A shared tag vocabulary
- Prompts across a team look and parse the same way
- Templates and post-processing code can rely on stable names
- Easier to review, diff, and hand off
⚠️ A new tag name every time
- Maximum flexibility for a one-off
- But: no shared parser, no muscle memory, easy to drift
- Referencing "the text above" breaks when layout changes
EXAM TRAPS
<doc> and <document> for the same
content across calls. → Inconsistency undoes the benefit; pick one name and keep it.<formatting> guarantees strict output. → It steers
strongly, but for hard guarantees use prefill, structured outputs, or post-validation (covered elsewhere in
D4).PRACTICE
Q1 · Name four commonly used prompt tags and what each holds.
<document> — source material to read; <instructions> — the task; <example> — few-shot demonstrations; <formatting> — rules for the output shape. (<context> and <input>/<query> are also common.)
Q2 · Why refer to a tag by name inside the instructions?
It ties the instruction to an exact region of the prompt. "Summarize the article in <document>" removes any doubt about which text Claude should act on, versus a vague "summarize the article."
Q3 · Is <source_text> a valid substitute for <document>?
Yes. No tag names are reserved, so <source_text> is fine — provided it's descriptive and you use it consistently and reference it by that same name in the instructions.