thought-based-reasoning

0
0
Source

Use when tackling complex reasoning tasks requiring step-by-step logic, multi-step arithmetic, commonsense reasoning, symbolic manipulation, or problems where simple prompting fails - provides comprehensive guide to Chain-of-Thought and related prompting techniques (Zero-shot CoT, Self-Consistency, Tree of Thoughts, Least-to-Most, ReAct, PAL, Reflexion) with templates, decision matrices, and research-backed patterns

Install

mkdir -p .claude/skills/thought-based-reasoning && curl -L -o skill.zip "https://mcp.directory/api/skills/download/6499" && unzip -o skill.zip -d .claude/skills/thought-based-reasoning && rm skill.zip

Installs to .claude/skills/thought-based-reasoning

About this skill

Thought-Based Reasoning Techniques for LLMs

Overview

Chain-of-Thought (CoT) prompting and its variants encourage LLMs to generate intermediate reasoning steps before arriving at a final answer, significantly improving performance on complex reasoning tasks. These techniques transform how models approach problems by making implicit reasoning explicit.

Quick Reference

TechniqueWhen to UseComplexityAccuracy Gain
Zero-shot CoTQuick reasoning, no examples availableLow+20-60%
Few-shot CoTHave good examples, consistent format neededMedium+30-70%
Self-ConsistencyHigh-stakes decisions, need confidenceMedium+10-20% over CoT
Tree of ThoughtsComplex problems requiring explorationHigh+50-70% on hard tasks
Least-to-MostMulti-step problems with subproblemsMedium+30-80%
ReActTasks requiring external informationMedium+15-35%
PALMathematical/computational problemsMedium+10-15%
ReflexionIterative improvement, learning from errorsHigh+10-20%

Core Techniques

1. Chain-of-Thought (CoT) Prompting

Paper: "Chain of Thought Prompting Elicits Reasoning in Large Language Models" (Wei et al., 2022) Citations: 14,255+

When to Use

  • Multi-step arithmetic or math word problems
  • Commonsense reasoning requiring logical deduction
  • Symbolic reasoning tasks
  • When you have good exemplars showing reasoning

How It Works

Provide few-shot examples that include intermediate reasoning steps, not just question-answer pairs. The model learns to generate similar step-by-step reasoning.

Prompt Template

Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now?
A: Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11. The answer is 11.

Q: The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?
A: The cafeteria had 23 apples originally. They used 20 to make lunch. So they had 23 - 20 = 3. They bought 6 more apples, so they have 3 + 6 = 9. The answer is 9.

Q: [YOUR QUESTION HERE]
A:

Strengths

  • Significant accuracy improvements on reasoning tasks
  • Interpretable intermediate steps
  • Works well with large models (>100B parameters)

Limitations

  • Requires crafting good exemplars
  • Less effective on smaller models
  • Can still make calculation errors

2. Zero-shot Chain-of-Thought

Paper: "Large Language Models are Zero-Shot Reasoners" (Kojima et al., 2022) Citations: 5,985+

When to Use

  • No exemplars available
  • Quick reasoning needed
  • General-purpose reasoning across task types
  • Prototyping before creating few-shot examples

How It Works

Simply append "Let's think step by step" (or similar phrase) to the prompt. This triggers the model to generate reasoning steps without any examples.

Prompt Template

Q: A juggler can juggle 16 balls. Half of the balls are golf balls, and half of the golf balls are blue. How many blue golf balls are there?

Let's think step by step.

Alternative trigger phrases:

  • "Let's work this out step by step to be sure we have the right answer."
  • "Let's break this down."
  • "Let's approach this systematically."
  • "First, let me understand the problem..."

Two-Stage Approach (More Robust)

Stage 1 - Reasoning Extraction:

Q: [QUESTION]
A: Let's think step by step.

Stage 2 - Answer Extraction:

[REASONING FROM STAGE 1]
Therefore, the answer is

Strengths

  • No exemplar crafting required
  • Generalizes across task types
  • Simple to implement

Limitations

  • Less effective than few-shot CoT
  • Can produce verbose or irrelevant reasoning
  • Sensitive to exact phrasing

3. Self-Consistency

Paper: "Self-Consistency Improves Chain of Thought Reasoning in Language Models" (Wang et al., 2022) Citations: 5,379+

When to Use

  • High-stakes decisions requiring confidence
  • Problems with multiple valid reasoning paths
  • When you need to reduce variance in outputs
  • Verification of reasoning correctness

How It Works

Sample multiple diverse reasoning paths, then select the most consistent answer via majority voting. The intuition: correct answers can be reached through multiple reasoning paths.

Prompt Template

[Use any CoT prompt - zero-shot or few-shot]

[Generate N samples with temperature > 0]

[Extract final answers from each sample]

[Return the most frequent answer (majority vote)]

Implementation Example

def self_consistency(prompt, n_samples=5, temperature=0.7):
    answers = []
    for _ in range(n_samples):
        response = llm.generate(prompt, temperature=temperature)
        answer = extract_answer(response)
        answers.append(answer)

    # Majority vote
    return Counter(answers).most_common(1)[0][0]

Strengths

  • Significant accuracy boost over single-path CoT
  • Provides confidence measure (agreement level)
  • Task-agnostic improvement

Limitations

  • Higher computational cost (N times more generations)
  • Requires extractable discrete answers
  • Diminishing returns beyond ~10-20 samples

4. Tree of Thoughts (ToT)

Paper: "Tree of Thoughts: Deliberate Problem Solving with Large Language Models" (Yao et al., 2023) Citations: 3,026+

When to Use

  • Complex problems requiring exploration/backtracking
  • Tasks where initial decisions are pivotal
  • Creative problem-solving (writing, puzzles)
  • When CoT alone achieves <50% accuracy

How It Works

Generalize CoT to a tree structure where each node is a "thought" (coherent language unit). Uses search algorithms (BFS/DFS) with self-evaluation to explore and select promising reasoning paths.

Prompt Template

Thought Generation:

Given the current state:
[STATE]

Generate 3-5 possible next steps to solve this problem.

State Evaluation:

Evaluate if the following partial solution is:
- "sure" (definitely leads to solution)
- "maybe" (could potentially work)
- "impossible" (cannot lead to solution)

Partial solution:
[THOUGHTS SO FAR]

BFS/DFS Search:

def tree_of_thoughts(problem, max_depth=3, beam_width=3):
    queue = [(problem, [])]  # (state, thought_path)

    while queue:
        state, path = queue.pop(0)

        if is_solved(state):
            return path

        # Generate candidate thoughts
        thoughts = generate_thoughts(state, k=5)

        # Evaluate and keep top-k
        evaluated = [(t, evaluate(state, t)) for t in thoughts]
        top_k = sorted(evaluated, key=lambda x: x[1])[:beam_width]

        for thought, score in top_k:
            if score != "impossible":
                new_state = apply_thought(state, thought)
                queue.append((new_state, path + [thought]))

    return None

Example: Game of 24

Problem: Use 4, 9, 10, 13 to get 24 (use +, -, *, / and each number once)

Thought 1: 13 - 9 = 4 (Now have: 4, 4, 10)
Evaluation: "maybe" - have two 4s and 10, could work

Thought 2: 10 - 4 = 6 (Now have: 4, 6, 13)
Evaluation: "maybe" - 4 * 6 = 24, need to use 13

Thought 3: 4 + 9 = 13 (Now have: 10, 13, 13)
Evaluation: "impossible" - no way to get 24 from these

Strengths

  • Dramatically improves performance on hard tasks (4% → 74% on Game of 24)
  • Enables backtracking and exploration
  • Self-evaluation catches errors early

Limitations

  • Significantly higher computational cost
  • Requires task-specific thought decomposition
  • Complex to implement

5. Least-to-Most Prompting

Paper: "Least-to-Most Prompting Enables Complex Reasoning in Large Language Models" (Zhou et al., 2022) Citations: 1,466+

When to Use

  • Problems harder than your exemplars
  • Compositional generalization tasks
  • Multi-step problems with clear subproblems
  • Symbol manipulation and SCAN-like tasks

How It Works

Two-stage process:

  1. Decomposition: Break complex problem into simpler subproblems
  2. Sequential Solving: Solve subproblems in order, using previous answers

Prompt Template

Stage 1: Decomposition

Q: Four years ago, Kody was only half as old as Mohamed. If Mohamed is currently twice as old as 30 years old, how old is Kody?

To solve "Four years ago, Kody was only half as old as Mohamed. If Mohamed is currently twice as old as 30 years old, how old is Kody?", we need to first solve:
- "If Mohamed is currently twice as old as 30 years old, how old is Mohamed?"
Then we need to solve:
- "Four years ago, Kody was only half as old as Mohamed. How old is Kody?"

Stage 2: Sequential Solving

Q: If Mohamed is currently twice as old as 30 years old, how old is Mohamed?
A: Mohamed is twice as old as 30, so Mohamed is 30 * 2 = 60 years old.

Q: Four years ago, Kody was only half as old as Mohamed. Mohamed is 60 years old. How old is Kody?
A: Four years ago, Mohamed was 60 - 4 = 56 years old. Kody was half as old, so Kody was 56 / 2 = 28 years old four years ago. Therefore, Kody is currently 28 + 4 = 32 years old.

The answer is 32.

Strengths

  • Excellent at generalizing to harder problems
  • Works well on compositional tasks
  • Explicit problem decomposition aids interpretability

Limitations

  • Requires two-stage prompting
  • Decomposition step can fail on novel structures
  • More complex setup than single-stage CoT

6. ReAct (Reasoning + Acting)

Paper: "ReAct: Synergizing Reasoning and Acting in Language Models" (Yao et al., 2022) Citations: 5,012+

When to Use

  • Tasks requiring external information (search, APIs)
  • Interactive decision-making environments
  • Multi-hop question answering
  • When pure reasoning leads to hallucination

How It Works

Interleave reasoning traces ("Thought") with actions ("Action") and observations ("Observation"). Reasoning h


Content truncated.

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

642968

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

590705

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

339397

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

318395

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

451339

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

304231

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.