Official best practices for prompting Claude models effectively, including Claude 4 Sonnet and Haiku
View Official DocumentationTell me about climate change
Explain climate change to a high school student. Include: 1. What causes it 2. Three main effects 3. Two things individuals can do Keep it under 200 words.
Specific parameters (audience, structure, length) ensure Claude delivers exactly what you need.
<context>
You are reviewing a customer support conversation.
</context>
<transcript>
{{TRANSCRIPT}}
</transcript>
<instructions>
Summarize the main issue and how it was resolved in 2-3 sentences.
</instructions>XML tags make the prompt structure explicit and help Claude understand where each piece of information belongs.
Extract all names from this text: "Meeting attendees: John Smith, Jane Doe, and Bob Wilson." Assistant: Here are the names: 1.
By starting with "1." you ensure Claude continues with a numbered list format.
Extract the person's name and age from: "My name is Sarah and I'm 28."
Assistant: {Starting with "{" ensures Claude outputs valid JSON.
Think through this problem step by step, showing your work, then give the final answer. Problem: If a train travels 120 miles in 2 hours, stops for 30 minutes, then travels 60 miles in 1 hour, what is the average speed for the whole journey?
Asking for step-by-step thinking helps Claude avoid calculation errors and shows its reasoning.
<instructions> Convert the description into a product listing. </instructions> <example> Input: Soft cotton t-shirt, blue, sizes S-XL, $25 Output: - Product: Cotton T-Shirt - Color: Blue - Sizes: S, M, L, XL - Price: $25.00 </example> Now convert: Leather wallet, brown, fits in pocket, $45
The example shows Claude exactly how to format the output.
Step 1: Extract all the key claims from the document. Step 2: For each claim, identify the supporting evidence. Step 3: Rate each claim's strength (strong, moderate, weak) based on the evidence. Let's start with Step 1:
Breaking into explicit steps ensures each sub-task is completed thoroughly before moving on.