Chain-of-Thought Prompting

Guide AI through step-by-step reasoning for complex problems.

What Is Chain-of-Thought Prompting?

Chain-of-thought (CoT) prompting is a technique where you ask the AI to "think step by step" or show its reasoning before arriving at a final answer. Instead of jumping straight to a conclusion, the AI breaks the problem into smaller parts and works through each one logically. This is one of the most powerful techniques in prompt engineering. Research has shown that simply adding "think step by step" or "walk me through your reasoning" can dramatically improve accuracy on math, logic, coding, and analysis tasks — sometimes turning a wrong answer into a correct one. Think of it like asking a student to "show their work" on a math test. The process of writing out each step forces more careful thinking and makes errors easier to spot.

When Should You Use It?

Chain-of-thought prompting shines in situations where the answer requires multiple logical steps. Here are the best use cases:

When NOT to Use It

For simple factual questions ("What's the capital of France?"), creative writing, or casual conversation, chain-of-thought adds unnecessary overhead. Save it for problems where reasoning matters.

How to Trigger Step-by-Step Reasoning

There are several phrases you can add to your prompts to activate chain-of-thought reasoning:

See the Difference

Watch how chain-of-thought transforms the quality of a response to a complex question:

A Chain-of-Thought Prompt in Action

Here's a full example that combines chain-of-thought with context for a real business problem:

Number Your Steps

For complex problems, explicitly number the steps you want the AI to follow. "Step 1: Identify the root cause. Step 2: List all affected systems. Step 3: Propose fixes ranked by effort." This gives you even more control over the reasoning process.

Combining CoT with Role Prompting

Chain-of-thought becomes even more powerful when combined with role prompting from the previous lesson. The role sets the expertise, while CoT ensures thorough reasoning:

When NOT to Use It

For simple factual questions ("What's the capital of France?"), creative writing, or casual conversation, chain-of-thought adds unnecessary overhead. Save it for problems where reasoning matters.

  1. "Think step by step" — The classic trigger. Simply append it to any question: "What's the most cost-effective server setup for my app? Think step by step." This is the simplest and most reliable approach.
  2. "Walk me through your reasoning" — More conversational. Great when you want the AI to explain its thought process as if teaching you: "Should I use a SQL or NoSQL database for my project? Walk me through your reasoning."
  3. "Break this down into steps" — Best for action-oriented tasks where you want a numbered plan: "Break down the process of migrating our monolith to microservices into steps."
  4. "Let's think about this carefully" — Sets a deliberate, thorough tone. Works well for nuanced decisions: "I'm choosing between three job offers. Let's think about this carefully and evaluate each one."

Number Your Steps

For complex problems, explicitly number the steps you want the AI to follow. "Step 1: Identify the root cause. Step 2: List all affected systems. Step 3: Propose fixes ranked by effort." This gives you even more control over the reasoning process.