chain-of-thought

Prompting the model to explicitly reason step-by-step before producing a final answer. Improves accuracy on math, logic, and multi-step tasks.

Syntax

prompt-engineering
Add "Let's think step by step" or show reasoning in examples.

Example

prompt-engineering
"Q: A store has 15 apples. They sell 7 and receive 12 more. How many are left?

Let's think step by step:
1. Start: 15 apples
2. After selling 7: 15 - 7 = 8
3. After receiving 12: 8 + 12 = 20
Answer: 20 apples"