Chain-of-Thought Prompting — Claude
Asking a model to "think step by step" before answering measurably improves accuracy on reasoning, math, and multi-step logic tasks because it forces the model to externalize intermediate steps instead of jumping to a guess..
The prompt
Before answering, list the 3 possible root causes of this bug, evaluate each against the stack trace below, then state which is most likely and why. [paste stack trace]
What to replace
Swap these placeholders for your own details before running the prompt:
[paste stack trace]your own value
Pro tip: Chain-of-thought helps most on math, logic, debugging, and multi-criteria decisions — skip it for simple factual lookups, it just adds noise.
How to use this prompt
- Copy the prompt using the button above.
- Replace [paste stack trace] with your own details — the more specific you are, the better the output.
- Paste it into Claude and run it.
- If the answer feels generic, add constraints: audience, length, tone, and what to avoid. That single change fixes most weak output.
Learn the technique
Chain-of-Thought Prompting
Module 2 — Core Techniques · Prompt Engineering Fundamentals
Related prompts
The 5-Part Prompt Framework — ChatGPT
Every strong prompt combines five parts: Role (who the AI should act as), Context (background info it needs), Task (the specific ask), Format (how you want the output structured), and Constraints (length, tone, things to avoid).
ClaudeThe 5-Part Prompt Framework — Claude
Every strong prompt combines five parts: Role (who the AI should act as), Context (background info it needs), Task (the specific ask), Format (how you want the output structured), and Constraints (length, tone, things to avoid).
ChatGPTZero-Shot vs Few-Shot Prompting — ChatGPT
Zero-shot means asking directly with no examples.
GrokZero-Shot vs Few-Shot Prompting — Grok
Zero-shot means asking directly with no examples.
ChatGPTChain-of-Thought Prompting — ChatGPT
Asking a model to "think step by step" before answering measurably improves accuracy on reasoning, math, and multi-step logic tasks because it forces the model to externalize intermediate steps instead of jumping to a guess..
ChatGPTStructured Output (JSON & Tables) — ChatGPT
When you need output your app or spreadsheet can actually use, explicitly request a schema.
Topics
Related across the site
Chain-of-thought prompting
Chain-of-thought prompting asks a model to work through its reasoning step by step before answering. It measurably improves accuracy on maths, logic, and multi-step problems by forcing intermediate steps instead of an immediate guess.
Chain-of-Thought Prompting: When It Helps and When It Wastes Money
Chain-of-thought prompting improves accuracy on reasoning tasks by asking the model to work step by step. Here is why it works, where it helps most, and when it is pure overhead.
Prompt Engineering Fundamentals
Learn the building blocks of a great prompt — role, context, task, format, and constraints — and how ChatGPT, Claude, Perplexity, and Grok each respond differently to the same instructions.
ChatGPT vs Claude vs Perplexity vs Grok — Grok
The same task often needs a slightly different prompt style per model.
ChatGPT vs Claude vs Perplexity vs Grok — Perplexity
The same task often needs a slightly different prompt style per model.
Role + Constraints to Kill Vagueness — Claude
When answers are generic, the fix is almost always more specificity, not a longer prompt.