Back to Library
PromptingBeginner
Use XML Tags for Structure
Claude is specifically trained to recognize and parse XML tags to separate instructions from content. Wrapping your prompt in named sections removes ambiguity.
xmlstructureclarity
The Strategy
Without XML tags, Claude must guess where context ends and instructions begin. With tags like `<context>`, `<task>`, and `<constraints>`, you create an unambiguous contract that dramatically improves output quality.
prompt.txt
<context>
[Paste your code or relevant background here]
</context>
<task>
Refactor this for readability. Focus on:
- Extracting magic numbers into named constants
- Improving function naming
- Adding JSDoc comments
</task>You might also need
PromptingBeginner
Write Effective System Prompts
A well-crafted system prompt defines Claude's role, output format, and constraints before any user turn—ensuring consistent, high-quality responses.
system-promptroleconstraints
View snippet
PromptingIntermediate
Elicit Chain-of-Thought Reasoning
Tell Claude to "think step by step" or use `<thinking>` tags to get more accurate answers for complex problems.
reasoningchain-of-thoughtanalysis
View snippet