Prompt Engineering · Chain of Thought

Chain of Thought Prompting

Unlock Claude's deepest reasoning capabilities. Chain of Thought (CoT) prompting asks Claude to show its work — think step by step — which dramatically improves performance on complex reasoning, math, logic, and analytical tasks.

🔗 Step-by-Step🧠 Extended Thinking🌳 Tree of Thought🔄 Self-Consistency

What is Chain of Thought Prompting?

Chain of Thought (CoT) is a prompting technique where you ask Claude to reason through a problem step by step before giving a final answer. Instead of jumping directly to the answer, Claude externalizes its reasoning process — which research shows dramatically improves accuracy on complex tasks.

The original discovery (Wei et al., 2022, "Chain-of-Thought Prompting Elicits Reasoning in Large Language Models") showed that simply adding "Let's think step by step" to prompts dramatically improved performance on math and reasoning benchmarks.

❌ Without CoT
If I have 3 apples, give 1 to a friend, buy 5 more, then my friend gives back 2, how many do I have?
🤖 Direct Answer (Error Risk)
You have 9 apples. [May be incorrect — skipped working]
✅ With CoT
Think through this step by step: If I have 3 apples, give 1 to a friend, buy 5 more, then my friend gives back 2, how many do I have?
🤖 CoT Response
Let me work through this step by step: Starting amount: 3 apples After giving 1 away: 3 - 1 = 2 apples After buying 5 more: 2 + 5 = 7 apples After friend gives back 2: 7 + 2 = 9 apples Answer: 9 apples ✓

Why Chain of Thought Improves Reasoning

CoT works for several reasons that are now well-understood:

  1. Forces Sequential Computation: Language models generate text sequentially. When Claude must write out each reasoning step, it effectively allocates more "compute" to the problem — each step is a fresh opportunity to catch errors.
  2. Creates an Audit Trail: The intermediate steps allow both Claude and you to catch logical errors. If step 3 is wrong, you can pinpoint exactly where the reasoning went off track.
  3. Reduces "Pattern Matching" Errors: Without CoT, Claude may jump to an answer that looks like similar problems it's seen. CoT forces it to actually work through the specific problem.
  4. Enables Self-Correction: While generating steps, Claude can notice inconsistencies in its own reasoning and correct them before reaching a final answer.

Basic Chain of Thought Techniques

Technique 1: "Let's think step by step"

The simplest CoT trigger — studied extensively in research. Add it to any prompt where multi-step reasoning is involved:

Simple CoT Triggers
"Think through this step by step before answering."
"Let's work through this carefully, one step at a time."
"Before giving your final answer, show your reasoning."
"Walk me through your thinking process."
"Explain your logic at each stage before concluding."

Technique 2: Structured CoT — Request a Specific Reasoning Framework

You can ask Claude to use a specific structured approach rather than free-form reasoning:

👤 Structured CoT — Case Analysis
Analyze whether I should accept this job offer. Use this structured reasoning: 1. FACTS: List all relevant facts about the offer 2. CRITERIA: What are my stated priorities for a job? 3. FOR EACH CRITERION: How does this offer score? (Good/Neutral/Bad + brief reason) 4. RED FLAGS: What concerns me most? 5. ALTERNATIVES: What happens if I decline? 6. RECOMMENDATION: What should I do and why? Job details: [details pasted here] My priorities: [list your priorities]

Technique 3: Ask Claude to Think Before and After

👤 Pre/Post Analysis CoT
BEFORE answering: - State what category of problem this is - Identify the key information given and what's being asked - Note any assumptions you need to make THEN: Solve the problem step by step. AFTER answering: - Check: does your answer make logical sense? - What would make your answer wrong? Problem: [your problem here]

Extended Thinking Mode

Claude 3.7 Sonnet and later models introduced Extended Thinking — a deeper form of chain-of-thought where Claude has a dedicated internal "scratchpad" for reasoning before producing its final response. This is different from regular CoT:

AspectRegular CoTExtended Thinking
How it worksReasoning visible in the main responseInternal thinking before visible response
TriggerYour prompt instructionModel feature (Pro subscription or API parameter)
TransparencyYou see every stepYou see a summary or just the final answer
Best forLearning, debugging reasoning, math proofsHard research questions, nuanced analysis
SpeedAdds some latencySignificantly slower (more computation)
💡 When to Enable Extended Thinking

Self-Consistency Prompting

Self-consistency is a powerful technique: you ask Claude to solve the same problem multiple times (with different reasoning approaches), then take the most common answer. It's like having Claude take a vote among its own reasoning paths.

👤 Self-Consistency Prompt
Solve this probability problem using THREE different approaches or reasoning paths. After all three, tell me which answer appears most often and which approach you trust most. Problem: A bag has 3 red balls and 2 blue balls. You draw 2 balls without replacement. What's the probability both are red? Approach 1: Use direct probability calculation Approach 2: Use a counting/combinations approach Approach 3: Use a tree diagram or sequential probability approach Be explicit about each approach's working. Note if they agree or disagree.
🔑 Key Use Case

Self-consistency is particularly valuable for: math problems with multiple solution paths, ethical dilemmas (what do different ethical frameworks conclude?), strategic decisions (what do different analytical frameworks recommend?), and any complex question where you want to stress-test a conclusion.

Tree of Thought (ToT)

Tree of Thought extends CoT by having Claude explore multiple reasoning branches at each step, then evaluate which branches are most promising before continuing. It's like a chess player who mentally explores multiple moves before deciding.

👤 Tree of Thought — Strategic Decision
I need to decide between three graduate schools I've been accepted to: MIT (full funding + prestigious but very stressful culture), Berkeley (partial funding + great lab for my specific research), Stanford (no funding + best ranking + best location for my field). Use Tree of Thought reasoning: STEP 1: Identify the 3 most important decision criteria for this choice. For EACH criteria: - BRANCH A: How does MIT score? (pros/cons) - BRANCH B: How does Berkeley score? (pros/cons) - BRANCH C: How does Stanford score? (pros/cons) STEP 2: Evaluate which branches (school/criteria combinations) are strongest. STEP 3: Synthesize and recommend, acknowledging the most significant uncertainty.

Step-Back Prompting

"Step-Back Prompting" (Google, 2023) is a technique where you first ask a more general question before the specific one — letting Claude establish foundational reasoning before diving into the specific problem.

Step-Back Pattern
# Standard Direct Approach (may miss principles)
"Why did the 2008 financial crisis lead to such severe global recession?"

# Step-Back Approach (establishes principles first)
Step 1: "What are the general mechanisms by which financial crises propagate 
         through the global economy?"
Step 2: "Now, using those principles, explain specifically why the 2008 
         crisis led to such a severe global recession."

# Another Example:
Step 1: "What are the fundamental principles of enzyme kinetics?"
Step 2: "Using those principles, explain why competitive inhibitors 
         change Km but not Vmax."

When CoT Helps — and When It Doesn't

Task TypeCoT Helpful?Why
Math problems (multi-step)Highly BeneficialEach step is a chance to catch arithmetic errors
Logic puzzlesHighly BeneficialSequential deduction requires showing work
Code debuggingVery HelpfulWalking through execution state catches bugs
Essay argument constructionHelpfulForces logical structure before writing
Strategic decision analysisHelpfulPrevents jumping to conclusions
Simple factual lookupsNot NeededAdds latency with no accuracy benefit
TranslationNot NeededLanguage translation is direct, not multi-step
Creative writing generationCan HurtOver-analyzing can kill creative flow
Format conversionNot NeededMechanical transformation, no reasoning needed

Academic CoT Examples for Students

CoT for Proof Construction

👤 Math Proof — CoT
Prove that the square root of 2 is irrational. Walk through the classic proof by contradiction step by step. After writing each step, explain in plain English WHY that step is necessary and what it establishes. This is for a student who knows the proof exists but doesn't understand why each step matters.

CoT for Case Law Analysis

👤 Legal Reasoning — CoT
Analyze this hypothetical legal case using IRAC method (Issue, Rule, Application, Conclusion). Work through each section explicitly, and after each IRAC element, identify the strongest opposing argument a skilled lawyer would make. Case: [your case facts here] Relevant law: [outline relevant statutes or precedents]

CoT for Scientific Hypothesis Evaluation

👤 Scientific Reasoning — CoT
I'll describe an experiment and its results. Using scientific reasoning step by step: 1. What hypotheses could explain these results? 2. For each hypothesis: what evidence supports it? what evidence argues against it? 3. What additional experiments would distinguish between the hypotheses? 4. What's the most parsimonious explanation? Experiment: [describe your experiment and results]
🏆 The Ambassador Insight on CoT

Chain of Thought is one of Claude's most transformative capabilities when used well. The key insight that separates expert users from novices: CoT isn't just about getting better answers — it's about getting auditable answers. When Claude shows its reasoning, you can verify each step, catch errors, and learn the reasoning pattern yourself. This is especially powerful for academic learning: you're not just getting an answer, you're watching a worked example of expert thinking.