Prompt design

Complex tasks

When the instructions you give are complex, there are some additional techniques you can consider...


Writing in subtasks

Claude performs worse at "complex" tasks which are composed of several subtasks. If you know already know what those subtasks are i.e. you understand the problem well, you can help Claude by breaking the prompt down into steps.


Human: Tell me how worker bees maintain the nest, in English, but replace any instance of the word "bee" or "bees" in your answer with the German word for bee/bees and put it inside a <german> xml tag like <german>this</german>.

Human: Please follow these steps:
1. Write a paragraph about how worker bees maintain the nest. Please surround this paragraph in <raw-content> tags.
2. Tell me the German word for "bee" or "bees".
3. Copy the contents of <raw-content> but replace any instances of the word "bee(s)" with "<german>The German word for bee(s)</german>". Please surround this version of the content with <tagged-content> tags.

Assistant:
1. Here's how worker bees maintain the nest: <raw-content>

Going further

If you can't get reliable results by breaking the prompt into subtasks, you may need to split it into multiple prompts. By submitting these one after the other, you can iteratively expand the prompt.


Checking comprehension

The best way to determine if Claude has understood your instruction is to ask Claude.


Human: I am going to give you a sentence and you need to tell me how many times it contains the word “apple”. For example, if I say “I would like a apple” then the answer is “1” because the word “apple” is in the sentence once. You can reason through or explain anything you’d like before responding, but make sure at the very end, you end your answer with just the final answer in brackets, like this: [1].

Do you understand the instructions?

Assistant:
Yes, I understand. For a given sentence, I should count how many times the word "apple" occurs in the sentence and provide the count as my response in brackets. For example, given the input "I would like a apple", my response should be "[1]".

If the response is accurate, you can use it to expand the prompt for subsequent requests.


Thinking step-by-step

When you don't know the subtasks well yourself i.e. you're asking Claude to solve a problem, you can signicantly improve the reasoning and accuracy of the response by explicitly telling Claude to think step-by-step. For best results we recommend putting this request in a separate part of the prompt to the main request:


Human: I have two pet cats. One of them is missing a leg. The other one has a normal number of legs for a cat to have. In total, how many legs do my cats have?

Assistant:

Human: I have two pet cats. One of them is missing a leg. The other one has a normal number of legs for a cat to have. In total, how many legs do my cats have? Think step-by-step.

Assistant:

Human: I have two pet cats. One of them is missing a leg. The other one has a normal number of legs for a cat to have. In total, how many legs do my cats have?

Assistant: Can I think step-by-step?

Human: Yes, please do.

Assistant:
Was this page helpful?
Previous
Being explicit