Prompting

How to Write Prompts for Claude (Anthropic Style)

Claude rewards structure. Tag your inputs, split instructions from data, show examples and let it think out loud, and you will get cleaner, more reliable output.

Setuproll Team9 min read2026-06-20

Claude is unusually responsive to how you organize a prompt. The same request, written as a wall of text or as a tagged, sectioned brief, can produce very different results. This guide covers the moves that pay off most: XML tags, a clean split between the system prompt and the user turn, structured thinking, and concrete examples.

Use XML tags to mark up your prompt

Claude was trained on a lot of tagged text, so it follows <tags> well. Wrap each distinct part of your prompt in a named tag so the model knows where the instructions end and the data begins. This is the single highest-leverage habit when prompting Claude.

prompt.txt
<instructions>
Summarize the support ticket below in two sentences.
Then classify its urgency as low, medium, or high.
</instructions>

<ticket>
Hi, our checkout page has been returning a 500 error
for the last hour. We are losing sales. Please help.
</ticket>

<output_format>
Return a JSON object: { "summary": "...", "urgency": "..." }
</output_format>
Tag names are yours to choose
There is no fixed schema. Pick clear, lowercase names like <document>, <example>, <rules>. The point is separation, not a magic vocabulary. Just be consistent: refer to the tag by the same name later in the prompt.

System prompt vs user turn

Put durable role and behavior rules in the system prompt, and put the actual task and data in the user turn. The system prompt is who Claude is across the whole conversation. The user turn is what you want right now. Mixing them makes both harder to maintain.

Goes in the system promptGoes in the user turn
Role, tone, hard constraintsThe specific question or task
Output format defaultsThe document or data to act on
Domain rules that never changeOne-off instructions for this request
claude_call.py
from anthropic import Anthropic

client = Anthropic()
resp = client.messages.create(
    model="claude-opus-4-8",
    max_tokens=1024,
    system=(
        "You are a precise support triage assistant. "
        "Always answer in the requested format and never invent ticket fields."
    ),
    messages=[{"role": "user", "content": tagged_prompt}],
)

Let Claude think before it answers

For anything that needs reasoning, ask Claude to work through the problem first. The simplest version is a prompting technique: tell it to reason inside a <thinking> block, then give the final answer in an <answer> block so you can parse just the result. On current models you can also turn on adaptive thinking through the API, which lets Claude decide how much to reason on its own.

Two different levers
The <thinking> tag is a prompt pattern that shapes the visible response. Adaptive thinking is an API setting (thinking: adaptive) that controls real extended reasoning. They stack: use the API setting for hard problems, use the tag when you want a structured, parseable answer.

Show, do not just tell

A couple of worked examples beat a paragraph of description. Wrap each example in a tag and show the exact input and the exact output you want. Claude will match the shape closely.

Claude - example-driven prompt
You
<example><in>refund a duplicate charge</in><out>{"intent":"refund","reason":"duplicate"}</out></example> Now classify: customer was billed twice for one order.
Agent
{"intent":"refund","reason":"duplicate"}
One tagged example sets the format better than a long instruction.

A checklist for Claude prompts

  1. Tag every distinct input section with a clear name.
  2. Put role and constraints in the system prompt, task and data in the user turn.
  3. Ask for reasoning before the answer when the task is non-trivial.
  4. Give one or two tagged examples of the input and output you want.
  5. State the output format explicitly, ideally with a tag of its own.
Claude prompt engineering overviewAnthropic's own guidance on tags, system prompts, examples and chain of thought.platform.claude.com
Claude Code - Full Tutorial for Beginners1:42:18
Claude Code - Full Tutorial for Beginners· freeCodeCamp.org

Structure is the prompt. With Claude, the tags you choose do half the work of the instruction.

0 Comments

Sign in to post

Loading discussion...