When faced with complex tasks like research, analysis, or problem-solving, giving Claude space to think can dramatically improve its performance. This technique, known as chain of thought (CoT) prompting, encourages Claude to break down problems step-by-step, leading to more accurate and nuanced outputs.

Before implementing CoT

Why let Claude think?

  • Accuracy: Stepping through problems reduces errors, especially in math, logic, analysis, or generally complex tasks.
  • Coherence: Structured thinking leads to more cohesive, well-organized responses.
  • Debugging: Seeing Claude’s thought process helps you pinpoint where prompts may be unclear.

Why not let Claude think?

  • Increased output length may impact latency.
  • Not all tasks require in-depth thinking. Use CoT judiciously to ensure the right balance of performance and latency.
Use CoT for tasks that a human would need to think through, like complex math, multi-step analysis, writing complex documents, or decisions with many factors.

How to prompt for thinking

The chain of thought techniques below are ordered from least to most complex. Less complex methods take up less space in the context window, but are also generally less powerful.

CoT tip: Always have Claude output its thinking. Without outputting its thought process, no thinking occurs!
  • Basic prompt: Include “Think step-by-step” in your prompt.
    • Lacks guidance on how to think (which is especially not ideal if a task is very specific to your app, use case, or organization)
  • Guided prompt: Outline specific steps for Claude to follow in its thinking process.
    • Lacks structuring to make it easy to strip out and separate the answer from the thinking.
  • Structured prompt: Use XML tags like <thinking> and <answer> to separate reasoning from the final answer.

Examples