aiwithgrant
about me
aiwithgrantGuidesAnthropic
Anthropic
Anthropic
Official Docs
Intermediate

Let Claude Think (Chain of Thought)

Encourage step-by-step reasoning to dramatically improve Claude's accuracy on complex tasks.

Official Anthropic docs →
Content sourced from official Anthropic documentation
1

Why let Claude think?

Giving Claude space to think dramatically improves performance on complex tasks. Benefits: Accuracy (reduces errors in math, logic, analysis), Coherence (structured thinking → organized responses), Debugging (see where prompts may be unclear).

💡Use CoT for tasks that a human would need to think through — complex math, multi-step analysis, writing complex documents, or decisions with many factors.
2

When NOT to use chain of thought

Not all tasks require in-depth thinking. CoT increases output length which impacts latency. Simple factual lookups, straightforward formatting tasks, and quick classifications usually don't benefit from CoT.

💡Always have Claude output its thinking. Without outputting its thought process, no thinking occurs!
3

Three levels of CoT prompting

From least to most complex — each level gives you more control over how Claude reasons.

Basic CoT
Draft personalized emails to donors asking for contributions to this year's Care for Kids program.

Program information:
{{PROGRAM_DETAILS}}

Donor information:
{{DONOR_DETAILS}}

Think step-by-step before you write the email.
Basic: Simple but lacks guidance on how to think. Just adds 'Think step-by-step.'
Guided CoT
Draft personalized emails to donors asking for contributions to this year's Care for Kids program.

Program information:
{{PROGRAM_DETAILS}}

Donor information:
{{DONOR_DETAILS}}

Think before you write the email. First, think through what messaging might appeal to this donor given their donation history and which campaigns they've supported in the past. Then, think through what aspects of the Care for Kids program would appeal to them, given their history. Finally, write the personalized donor email using your analysis.
Guided: Outlines specific reasoning steps, but doesn't separate thinking from the answer.
Structured CoT (best)
Draft personalized emails to donors asking for contributions to this year's Care for Kids program.

Program information:
{{PROGRAM_DETAILS}}

Donor information:
{{DONOR_DETAILS}}

Think before you write the email in <thinking> tags. First, think through what messaging might appeal to this donor given their donation history. Then, think through what aspects of the Care for Kids program would appeal to them. Finally, write the personalized donor email in <email> tags, using your analysis.
Structured: Uses XML tags to cleanly separate reasoning from the final output — easy to extract just the answer programmatically.
4

Financial analysis example

Without CoT, Claude recommends a bond but gives surface-level reasoning. With CoT, the analysis is fundamentally deeper.

Investment advice
You're a financial advisor. A client wants to invest $10,000. They can choose between: A) A stock that historically returns 12% annually but is volatile, or B) A bond that guarantees 6% annually. The client needs the money in 5 years for a down payment on a house. Which option do you recommend? Think step-by-step.
With CoT, Claude calculates exact figures ($17,623 best case vs $13,382 guaranteed), considers historical volatility (2003-07 up 82%, 2007-11 down 2%), and analyzes risk tolerance — producing a fundamentally better recommendation.

Key topics covered

Chain of thought
Step-by-step reasoning
Structured thinking
XML tags
Debugging
Complex analysis
Read the full guide
View the complete Anthropic documentation
Official docs →

More guides