How to write prompts for Claude

How to write prompts for Anthropic's Claude: direct instructions, rich context, long documents, tags for structure and requests for reasoning.

Claude, Anthropic's assistant, responds very well to clear, detailed instructions. The general principles of a good prompt apply, but some practices tend to work especially well.

Be direct and explicit

Claude tends to follow instructions quite precisely. If you want something, ask for it explicitly: if you want it to go beyond the minimum, say so (“include as many relevant features as you can think of”); if you want something brief, say that too.

Explain the motivation

Saying why you ask for something helps Claude generalize. For example: “Do not use ellipses, because this text will be read by a text-to-speech engine that cannot pronounce them.”

Structure with tags

When you mix instructions, documents and examples, you can separate them with XML-style tags. They are not required, but they help avoid confusion:

Analyze the contract and list the clauses that pose a risk for the tenant.

<contract>
[contract text]
</contract>

<format>
Table with: clause, risk, level (high/medium/low), question for the lawyer.
</format>

Long documents

Claude can work with long documents. For better results:

  • Put the documents at the beginning and the question or instruction at the end.
  • Ask it to quote the relevant passages before answering (“first extract the sentences from the document that answer the question, then respond”).

Ask it to think before answering

For analysis or logic problems, asking it to reason step by step or compare alternatives before concluding usually improves quality. You can ask it to separate the reasoning from the final answer.

Give varied examples

If you include examples, make them varied and representative: Claude may imitate specific details of a single example more than you want.

Example

You are the editor of a popular science magazine.
I will paste a draft. Make it understandable for readers with no
science background, because it is for the beginners' section.

<draft>
[text]
</draft>

Return: 1) the revised text, 2) a list of the main changes
and 3) the claims worth verifying with a source.

Ready-to-use prompts

Browse the Claude prompts in the library and adapt them with variables.

Learn prompting