How to improve Claude 4 Sonnet output with the chain of thought prompting (COT method)
A guide to improve Claude's output with the chain of thought prompting (COT) method.

These are notes from the Anthropics chain of thought guide. More details in the below post!
There are three ways to prompt Claude into thinking as per the Anthropic guide
- Basic prompts
- Guided prompts
- Structured prompts
When to use, when not to use Claude’s thinking
1. When to use Claude’s thinking
- Tasks that are complex
- Need reasoning, multi-step approach
- Planning a decision that involves many variables
- Complex documents that need to be reasoned
2. Chain of thought technique (COT) is good for the below tasks
Use COT when Claude is struggling to solve the task that fall in the below categories
- Math & Logic
- Analysis Tasks
- Writing with Structure
- Decision-Making
- Debugging or Explanation
3. When not to use Claude thinking
- When you want to preserve the context length
- Speed of output matters
It is not recommended for below tasks :
- Actual Retrieval
- Basic Text Edits
- Simple API Calls / Function Use
- Low-Latency Tasks
The three methods to prompt Claude into thinking
1. Basic Chain of Thought Prompting
What it is:
A simple way to get Claude to think by just telling it to “think step-by-step.”
How to use: Add “Think step-by-step” or similar phrases like “Let’s think it through step-by-step” at the end of your prompt.
When to use: Useful when Claude has to figure things out by itself
What Claude does: It breaks the problem into steps by step
2. Guided Chain of Thought Prompting
What it is: You explicitly guide the AI with numbered or detailed steps it should follow to reach the solution.
How to use: Write out instructions for Claude to follow
You can list steps like:
- Analyze the input
- Identify key elements
- Apply logic or rules
- Generate an answer
What Claude will do: It will walk through the steps you gave and give the output in adherence to your guided structure.
3. Structured Chain of Thought Prompting
What it is:
You separate Claude’s thinking from its final answer using specific formatting like
How to use:
- Wrap the step-by-step reasoning inside a
tag. - Wrap the final result/output inside an
tag. - You can extract and display just the
if you want to hide the reasoning.
Example:
Prompt: Solve this Cloudflare upload issue <cloudflare_logs> {Cloudflare logs attached} </cloudflare_logs>
Think before the problem using
Why it works:
Helps you see and debug the model’s reasoning. and makes it easy to separate logic from output in your app or interface.
Conclusion
Tried to add the major steps to help you solve AI tasks better. Hopefully, these steps help!
Let me know if there’s any feedback :)