Give Claude room to "think" before responding
We've discussed many techniques to cut out any "chattiness", explanations, or preamble that Claude tends to include with its responses. But there are cases when it can be beneficial to explicitly instruct Claude to generate extra text where it reasons through the problem.
For example, here is part of a prompt that was designed to get Claude to "think" through a question by writing down relevant quotes from an FAQ document:
[Previous sections of the prompt clipped for brevity]
When you reply, first find exact quotes in the FAQ relevant to the user's question and write them down word for word inside <thinking></thinking> XML tags. This is a space for you to write down relevant content and will not be shown to the user. Once you are done extracting relevant quotes, answer the question. Put your answer to the user inside <answer></answer> XML tags.
Claude works by sequence prediction. By prompting it to write down relevant background information first (the quotes, in this case), we increase its chance of predicting a relevant answer after.
The XML tags in Claude's response will still allow you to automatically process it and cut out the "reasoning" section.
Updated 4 months ago