Chain of Thought Prompting

Using chain of thought prompting for complex reasoning tasks

Table of Contents

Chain of thought prompting asks an AI model to reason through a problem step by step, out loud, before giving a final answer, instead of jumping straight to a conclusion. Adding a phrase like "let's think step by step" reduces errors on math, logic, multi-step instructions, and business decisions because the reasoning becomes visible and checkable.

What you will be able to do

  • Add zero-shot chain of thought trigger phrases, such as "let's think step by step" or "work through this carefully before answering," to any prompt
  • Run self-consistency checks: solve a problem 3-5 times at temperature above 0 and keep the answer that shows up most often
  • Use step back prompting to make the model restate a problem in its own words before solving it, so it catches misread questions
  • Structure ReAct prompts with Thought, Action, Observation, Thought, Answer so the model uses tools and cites sources instead of guessing
  • Judge when chain of thought is worth using and when it's overkill for simple lookups, translations, or one-step formatting

Before you start

  • Access to a chat-based LLM such as Claude, ChatGPT, or Gemini
  • Comfort writing plain-language prompts, no coding required for basic chain of thought
  • API or playground access for self-consistency, since it works best with temperature set above 0 and requires running the same prompt several times
  • Familiarity with zero-shot and few-shot prompting from earlier lessons in this course is helpful but not required

Reference

Technique What it does How to trigger it Best for
Chain of thought Model reasons in explicit steps before giving a final answer Add "Think step by step," "Show your reasoning," "Explain your thought process," or "Break this down into steps" Math problems, logic puzzles, multi-step instructions, complex decisions
Zero-shot CoT phrases Single-phrase triggers tested across Claude, ChatGPT, and Gemini Use phrases like "Let's think step by step" or "Reason through this systematically, then state your answer" Any task where you want reasoning without providing examples
Self-consistency Runs the same prompt multiple times and keeps the most common answer Ask the model to solve the problem 3 different ways, then state which answer appears most often; use temperature above 0 High-stakes decisions, calculations, problems with multiple solution paths
Step back (task restatement) Model restates the problem before solving it Add "First, restate the problem in your own words. Then solve it step by step." Word problems, multi-part questions, problems that could be misunderstood
ReAct Model alternates reasoning with tool use such as search or calculator Structure the prompt as Thought, Action, Observation, Thought, Answer Research tasks, current facts, tasks needing citations or verification

Common errors and fixes

What goes wrong The fix
Model jumps to an answer and adds or skips a step incorrectly Add "think step by step" or "show your reasoning" so it works through the problem before answering
Model misreads a word problem and calculates the wrong relationship Use step back prompting: have it restate the problem in its own words before solving
A single attempt contains a hidden calculation error you can't catch Run self-consistency: repeat the same prompt 3-5 times at temperature above 0 and pick the most frequent answer
Chain of thought gets applied to simple factual lookups, translations, or one-step formatting Skip it. These tasks have only one obvious step, so CoT adds cost and time without improving accuracy
Self-consistency gets used on every task Reserve it for high-stakes or high-cost-of-error tasks since it needs multiple API calls and costs more

Read the full walkthrough

The complete lesson, with screenshots and any downloads, is published on Substack as part of Prompt Engineering for AI Automation.

Read Lesson 5 on Substack →

More in this section

Continue the course

Browse all lessons in the Prompt Engineering for AI Automation course, or subscribe to the GenAI Unplugged newsletter to get new lessons in your inbox.

Dheeraj Sharma

Dheeraj Sharma

AI Systems Builder
Creator of the n8n Zero to Hero course (42 lessons, 31+ hours). I help solopreneurs build AI systems that grow revenue without growing workload.

Get the n8n Mastery Bundle

All workflows, cheat sheets, and premium resources from the entire course in one package.

Read the full lesson on Substack