Skip to content
Projects

AI-Prompt-Development/chain-of-thought-prompts

View on GitHub

About

Chain-of-Thought, Tree-of-Thought, and ReAct prompt collections — step-by-step reasoning frameworks for complex problem solving

Web & App Development

How these counts are measured

Measured star growth

in 24h
0
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

Chain-of-Thought Prompts

Stars License

Step-by-step reasoning frameworks for complex problem solving with LLMs.


Why Chain-of-Thought?

Standard prompting asks for the answer directly. Chain-of-Thought (CoT) asks the model to reason through the problem first.

Approach Accuracy on GSM8K Math Benchmark
Standard prompting 17.9%
Chain-of-Thought 56.9%
CoT + Self-consistency 74.4%

Source: Wei et al. (2022), "Chain-of-Thought Prompting Elicits Reasoning in Large Language Models"


Techniques

Basic CoT

Adding "Let's think step by step" increases accuracy by 40-80% on reasoning tasks.

Q: If a train travels at 60 mph and needs to cover 150 miles, how long will the journey take?
A: Let's think step by step.

Zero-Shot CoT

Solve this problem. Show your reasoning before giving the final answer.

Problem: A company's revenue grew 15% in Q1, then declined 8% in Q2.
What is the net change from start of Q1 to end of Q2?

Few-Shot CoT

Problem: A baker made 24 muffins. She sold 1/3 in the morning and 1/4 of the remaining in the afternoon. How many are left?
Reasoning:
  - Sold in morning: 24 x 1/3 = 8 muffins
  - Remaining: 24 - 8 = 16 muffins
  - Sold in afternoon: 16 x 1/4 = 4 muffins
  - Remaining: 16 - 4 = 12 muffins
Answer: 12 muffins

Problem: {your_problem}
Reasoning:

Tree-of-Thought (ToT)

Explore multiple reasoning paths simultaneously.

You are solving a complex problem. Generate 3 different approaches.
For each approach:
1. Describe the approach (2 sentences)
2. Work through it step by step
3. Evaluate: does it lead to a valid solution?

Then select the best approach and provide the final answer.

Problem: {problem}

ReAct (Reasoning + Acting)

Interleave reasoning with tool use or information retrieval.

Solve the following by alternating between Thought, Action, and Observation steps.

Thought: What do I need to find out first?
Action: [describe what you would look up or calculate]
Observation: [result of that action]
...
Final Answer: [conclusion]

Task: {task}

Self-Consistency CoT

Generate multiple independent chains, then vote.

Solve this problem 3 times independently using different approaches.
After all 3 solutions, identify which answer appears most often and explain why.

Problem: {problem}

Solution 1 (direct calculation):
Solution 2 (estimation and verification):
Solution 3 (working backwards):
Final answer (most consistent):

Domain Applications

Mathematical Reasoning

Solve step by step. Show all intermediate calculations.
If a step involves an assumption, state it explicitly.
Problem: {math_problem}

Logical Deduction

Analyze this logic puzzle. Work through each clue systematically.
State what each clue eliminates or confirms.
Clues: {clues}
Question: {question}

Code Debugging

Debug this code step by step.
1. Describe what the code is supposed to do
2. Trace the execution with the given input
3. Identify where behavior diverges from expected
4. Propose a fix and explain why it works

Code: {code}
Input: {input}
Expected output: {expected}
Actual output: {actual}

Decision Analysis

Analyze this decision using the following framework:
1. List all viable options (at least 3)
2. For each option: pros, cons, risks, assumptions
3. Score each: feasibility (1-5), impact (1-5), risk (1-5, lower=better)
4. Recommend the highest-scoring option with justification

Decision context: {context}

Multilingual

TR: Düşünce zinciri, karmaşık problemleri adım adım çözmek için LLM'lere yönlendirme tekniğidir. DE: Chain-of-Thought ist eine Technik, bei der LLMs Schritt für Schritt durch komplexe Probleme geführt werden. FR: Le raisonnement en chaîne guide les LLM dans la résolution étape par étape de problèmes complexes. ES: La cadena de pensamiento guía a los LLM paso a paso para resolver problemas complejos. ZH: 思维链是引导大型语言模型逐步解决复杂问题的技术。 RU: Цепочка мыслей — техника пошагового решения задач с помощью LLM. JA: 思考の連鎖は、LLMが複雑な問題を段階的に解決するための手法です。 KO: 사고의 연쇄는 LLM이 복잡한 문제를 단계별로 해결하도록 안내하는 기술입니다. AR: سلسلة الأفكار هي تقنية لتوجيه نماذج LLM لحل المشكلات المعقدة خطوة بخطوة. PT: A cadeia de pensamento guia os LLM na resolução passo a passo de problemas complexos.


License

MIT — Free to use, modify, and distribute.

Keywords

chain of thought CoT prompting tree of thought ReAct prompting step by step reasoning LLM reasoning AI problem solving logical reasoning AI mathematical reasoning LLM CoT examples reasoning prompts düşünce zinciri adım adım akıl yürütme Kettendenken LLM raisonnement en chaîne cadena de pensamiento IA 思维链提示 цепочка мыслей ИИ 思考の連鎖 사고의 연쇄

Explore related projects

Loading…