Magic Tools
Claude GuidesBy CooconApril 13, 2026435 views2 min read

Chain of Thought Prompting: Solve Complex Problems Step by Step with Claude

What Is Chain of Thought Prompting?

Chain of Thought (CoT) is a prompting technique that asks the AI to show its reasoning process. Instead of jumping straight to an answer, CoT makes Claude write out each step, significantly improving accuracy on complex problems.

Research shows that for tasks requiring multi-step reasoning — math, logic, code debugging — chain of thought prompting substantially reduces errors.

The Simplest Approach

Just add one sentence to your prompt:

Think through this step by step, then give your final answer.

Example without CoT:

A pool has two pipes. Pipe A fills it alone in 6 hours, pipe B in 3 hours. How long to fill it with both open?

Claude might answer "2 hours" directly but occasionally makes mistakes.

Example with CoT:

A pool has two pipes. Pipe A fills it alone in 6 hours, pipe B in 3 hours. How long to fill it with both open? Please reason step by step.

Claude will output:

  1. Pipe A fills 1/6 of the pool per hour
  2. Pipe B fills 1/3 of the pool per hour
  3. Combined rate: 1/6 + 1/3 = 1/6 + 2/6 = 3/6 = 1/2 per hour
  4. Time to fill: 1 / (1/2) = 2 hours

Showing the reasoning process lets Claude self-check and reduces calculation errors.

Extended Thinking: Built-In Deep Reasoning

Claude offers Extended Thinking. When enabled, Claude performs internal deep reasoning before answering (users can see the thinking process). Via the API, you control depth with the budget_tokens parameter:

{
  "thinking": {
    "type": "enabled",
    "budget_tokens": 5000
  }
}

Best suited for scenarios demanding high accuracy, such as mathematical proofs and complex code logic analysis.

Few-Shot CoT: Teach Claude by Example

By providing examples that include reasoning steps, Claude mirrors the same reasoning pattern:

Question: Tom has 5 apples. He gives 2 to Jane and buys 3 more. How many does Tom have now?
Reasoning:
- Start: 5
- Gave away 2: 5 - 2 = 3
- Bought 3: 3 + 3 = 6
Answer: 6

Question: A store sold 45 items in the morning, 38 in the afternoon, and had 7 returns. What is the actual number of items sold?
Reasoning:

Claude will automatically continue using the reasoning format from the example.

Task Decomposition Strategy

For particularly complex problems, proactively break the task into sub-questions:

Complete this task in three steps:
1. First, analyze the time complexity of this Python code
2. Then, identify performance bottlenecks
3. Finally, provide optimized solutions and explain why they are faster

This is far more effective than a single "optimize this code" because each sub-step forces Claude to reason independently.

When to Use What

Scenario Recommended Technique
Math / logic problems "Please reason step by step"
High-stakes decisions Extended Thinking
Fixed reasoning format Few-Shot CoT
Complex multi-step tasks Proactive task decomposition

Frequently Asked Questions

Does every problem need chain of thought?

No. For simple factual queries, translations, or copywriting, CoT adds unnecessary verbosity. Chain of thought works best for problems requiring multi-step reasoning — calculations, logical deductions, code debugging, and multi-criteria decisions.

What is the difference between Extended Thinking and manual CoT?

Manual CoT is when you ask Claude to "think step by step" in your prompt. Extended Thinking is Claude's built-in capability with deeper reasoning, suited for truly challenging problems. You can combine both, but Extended Thinking alone is usually sufficient.

Does chain of thought make responses too long?

It can. If you only need the final answer, add: "After your reasoning, provide the final answer on a separate line." This gives you the accuracy benefits of reasoning while making the conclusion easy to find.

Related Articles

Auto-Generating Daily WeChat Covers with MiniMax: A Production Pipeline Postmortem

Auto-Generating Daily WeChat Covers with MiniMax: A Production Pipeline Postmortem

We automated our newsletter's daily WeChat cover: MiniMax image-01 renders a marketing-style background, an SVG text layer composites the headline, sharp crops to the exact 2.35:1 ratio, and Playwright drops it into the WeChat draft. The full postmortem covers why AI must never draw the title text, how one 'negative space' prompt word shoved the subject out of frame, and how word-splitting line breaks got fixed — with three real before/after images.

prompt-engineeringautomation+6
ai-tutorialsAug 5, 20266 min
124

I Put My Opus 5 Config on the Recommended Diet, Then Ran 18 A/B Trials: 21% Cheaper, and I Can't Prove It's Better

"Opus 5 verifies itself, so delete your fallback prompts" is advice you hear everywhere. I took it, then isolated both configs with CLAUDE_CONFIG_DIR and ran 18 headless trials on identical tasks. Output tokens dropped 21% and wall clock 20-29%, with zero counterexamples. But two of the rewritten rules never fired at all, and one result points the other way: the old config's most thorough run covered a strict superset of what the new one found. Why cheaper and better are separate questions.

prompt-engineeringclaude-code+4
claudeAug 5, 20266 min
181

Anthropic Deleted 80% of Claude Code's System Prompt. The Evals Didn't Move.

'We removed over 80% of Claude Code's system prompt' — and the evals didn't move. The popular takeaway ('write shorter prompts') is wrong: what got deleted was constraints, not information. A usable dividing line, plus the API-layer mechanics the official post left out and the two real disagreements from 343 HN comments.

prompt-engineeringclaude-code+5
ai-tutorialsJul 27, 202613 min
311

Prompt Engineering for Beginners: 10 Techniques That Actually Work

Two people ask the same AI the same question and get completely different results. The difference is prompt quality. This guide covers 10 concrete, practical techniques for writing prompts that consistently get useful, accurate outputs from any large language model.

prompt-engineeringchatgpt+3
ai-promptsApr 22, 20268 min
178

Published by Magic Tools