关于 thought-based-reasoning
面向 Claude 的推理技能,为多步骤问题、决策和谜题选择并应用结构化方法。内容涵盖问题拆解、多路径探索、回溯、外部信息查询与计算,也说明何时直接作答更合适。
主要功能
- 01Zero-shot Chain-of-Thought 提示
- 02Self-Consistency 多数表决
- 03Tree of Thoughts 分支探索
- 04Least-to-Most 问题拆解
- 05ReAct 与 PAL 技术
- 06各方法的适用时机说明
适用场景
- 01解决多步骤数学与逻辑题
- 02探索谜题的多种解法
- 03比较复杂决策中的选项
- 04初次作答错误后复核答案
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ guia-matthieu/ clawfu-skills --skill thought-based-reasoning安装后在 Claude Code 中输入/thought-based-reasoning确认已加载。
详细介绍
基于思考的推理
概述
核心原则: 明确推理过程可将复杂任务的准确率提升 20-70%。
不要急于给出答案,而应将问题分解为多个步骤。这样可以发现错误、回溯,并产出可验证的推理过程。
适用场景
digraph decide {
"Problem type?" [shape=diamond];
"Direct answer worked?" [shape=diamond];
"Need confidence?" [shape=diamond];
"Use direct prompting" [shape=box];
"Use Zero-shot CoT" [shape=box];
"Use Self-Consistency" [shape=box];
"Use technique from table" [shape=box];
"Problem type?" -> "Direct answer worked?" [label="simple"];
"Problem type?" -> "Use technique from table" [label="math/logic/creative"];
"Direct answer worked?" -> "Use direct prompting" [label="yes"];
"Direct answer worked?" -> "Need confidence?" [label="no"];
"Need confidence?" -> "Use Self-Consistency" [label="yes, high stakes"];
"Need confidence?" -> "Use Zero-shot CoT" [label="no, just need better"];
}
适用于:
- 多步算术题或文字题
- 需要通过推理链进行演绎的逻辑题
- 涉及多个因素的决策
- 需要探索的创意问题
- 任何曾经直接作答出错的任务
不适用于:
- 简单的事实回忆
- 单步操作
- 在准确率有所取舍也可以接受的时间紧迫型响应
快速参考
| 技术 | 触发条件 | 模板 |
|---|---|---|
| 零样本 CoT | 快速提升推理能力 | “让我们一步步思考……” |
| 自洽性 | 高风险决策 | 运行 3-5 条推理路径,取多数结果 |
| 思维树 | 谜题/创意受阻 | 分支探索、评估、回溯 |
| 由简到难 | 复杂的多部分问题 | 分解 → 解决子问题 → 合并 |
| ReAct | 需要外部事实 | 思考 → 行动 → 观察循环 |
| PAL | 需要计算的数学题 | 生成代码并执行 |
技术
1. 零样本思维链
适用场景: 快速原型设计,没有可用示例
模板:
[Problem statement]
Let's think step by step:
示例:
A store has 45 apples. They sell 12 in the morning and receive a shipment of 30.
Then they sell 18 more. How many apples remain?
Let's think step by step:
1. Start: 45 apples
2. Sell 12: 45 - 12 = 33 apples
3. Receive 30: 33 + 30 = 63 apples
4. Sell 18: 63 - 18 = 45 apples
Answer: 45 apples remain.
准确率提升: +20-60%
2. 自洽性
适用场景: 高风险决策,需要置信度衡量
流程:
- 运行零样本 CoT 3-5 次(如可行,调整温度)
- 收集所有最终答案
- 取多数结果
- 以一致比例报告置信度
模板:
[Problem]
I'll reason through this multiple ways to verify:
Path 1:
[reasoning...]
Answer: X
Path 2:
[reasoning...]
Answer: Y
Path 3:
[reasoning...]
Answer: X
Consensus: X (2/3 agreement = 67% confidence)
准确率提升: 比单次 CoT 高 +10-20%
3. 思维树
适用场景: 谜题、创意问题,需要探索不同方案
流程:
- 生成 2-3 个初始方案
- 评估每个方案(有希望/不确定/走不通)
- 扩展有希望的分支
- 从走不通的分支回溯
- 继续,直到找到解决方案
模板:
[Problem]
## Branch 1: [Approach A]
Evaluation: [promising/uncertain/dead-end]
[If promising, continue...]
## Branch 2: [Approach B]
Evaluation: [promising/uncertain/dead-end]
[If dead-end, note why and stop]
## Expanding Branch 1:
### Branch 1.1: [Sub-approach]
...
## Solution found in Branch 1.1
示例(24 点游戏:用 4、7、8、8 算出 24):
Branch 1: Try multiplication first
- 4 × 7 = 28... need to subtract 4, but only have 8,8
- Evaluation: uncertain, continue
Branch 2: Try getting 3 × 8 = 24
- Need to make 3 from 4, 7, 8
- 7 - 4 = 3 ✓
- 3 × 8 = 24 ✓
- Evaluation: SOLUTION
Answer: (7 - 4) × 8 = 24 (using one 8, ignoring other)
Wait - must use all numbers. Backtrack.
Branch 3: Use both 8s
- 8 + 8 = 16, need +8 from 4,7... 7-4=3, not 8
- 8 × 8 = 64, need to subtract 40 from 4,7... no
- 8 - 8 = 0, useless
- 8 / 8 = 1, then 4 × 7 × 1 = 28, not 24
Branch 4: Division approach
- (8 - 4) = 4
- 8 / 4 = 2... not useful
- 4 / (8-8) = undefined
Branch 5: Fractions
- 8 / (1 - 7/8) = 8 / (1/8) = 64... no
- Actually: 8 × (7 - 8/4) = 8 × (7-2) = 8 × 5 = 40
Hmm, trying more systematically...
- Need operations on 4,7,8,8 = 24
- (4 - 8/8) × 7 = 3 × 7 = 21
- 4 × (8 - 8/7)... messy
- (8 - 4) × (8 - 2)... don't have 2
Let me try: 8 / (8 - 4/7)... no
Try: (7 + 8/8) × 4 = 8 × 4 = 32... nope that's wrong
Wait: (7 + 1) × 3 = 24, can I make 1 and 3?
8/8 = 1 ✓, but can't make 3 from just 4
Try factoring 24: 1×24, 2×12, 3×8, 4×6
- 3×8: need 3 from 4,7,8. (4+8)/7 ≈ 1.7, 7-4=3 ✓ but used 8 for the ×8
- 4×6: need 6 from 7,8,8. 8-8+7=7, (8+8)/7≈2.3, nope
Solution: (8 - 8/4) × 7 = (8 - 2) × 7 = 6 × 7 = 42... no
Actually: 4 × 8 - 8 + 7 - 7 = 32... wait no sevens wrong
Let me be systematic: 4 × 8 = 32, 32 - 8 = 24 ✓
What about 7? 32 - 8 × 7/7 = 32 - 8 = 24 ✓
Answer: 4 × 8 - 8 × 7/7 = 32 - 8 = 24
Or simpler: 4 × 8 - 8 + 7 - 7 = 24 (trivially using 7-7=0)
准确率提升: 难题上提升 +50-70%
4. 由简到难提示
适用场景: 包含子问题的复杂问题
流程:
- 将问题分解为子问题
- 先解决最简单的子问题
- 利用已得解答解决更难的问题
- 合并得出最终答案
模板:
[Complex problem]
## Subproblems (easiest to hardest):
1. [Subproblem A]
2. [Subproblem B, may need A's answer]
3. [Subproblem C, needs A and B]
## Solutions:
### Subproblem 1:
[solve...]
Answer: [X]
### Subproblem 2 (using X):
[solve...]
Answer: [Y]
### Subproblem 3 (using X, Y):
[solve...]
## Final Answer:
[Combine solutions]
准确率提升: 组合型任务上提升 +30-80%
5. ReAct(推理 + 行动)
适用场景: 需要外部信息,减少幻觉
流程:
- 思考:推理需要什么信息
- 行动:查询外部来源
- 观察:记录结果
- 重复,直到解决问题
模板:
Question: [Question requiring external info]
Thought 1: I need to find [X] to answer this.
Action 1: Search/Lookup [X]
Observation 1: [Result]
Thought 2: Now I know X. I also need [Y].
Action 2: Search/Lookup [Y]
Observation 2: [Result]
Thought 3: With X and Y, I can now answer.
Answer: [Final answer grounded in observations]
准确率提升: +15-35%,大幅减少幻觉
6. PAL(程序辅助语言)
适用场景: 需要计算的数学题,避免算术错误
流程:
- 将问题转换为代码
- 执行代码
- 返回结果
模板:
[Math problem]
Let me write code to solve this:
```python
# [Problem restated as comments]
initial = 45
after_morning_sales = initial - 12
after_shipment = after_morning_sales + 30
after_afternoon_sales = after_shipment - 18
print(f"Remaining: {after_afternoon_sales}")
[执行] 输出:剩余:45
答案:45
**Accuracy gain:** Eliminates arithmetic errors entirely
## Decision Matrix
| Situation | Best Technique |
|-----------|----------------|
| Quick reasoning, no examples | Zero-shot CoT |
| High-stakes, need confidence | Self-Consistency |
| Puzzle, creative, exploration needed | Tree of Thoughts |
| Multi-part with dependencies | Least-to-Most |
| Need facts, reduce hallucination | ReAct |
| Math with many calculations | PAL |
| Iterative improvement | Reflexion (run, critique, retry) |
## Common Mistakes
| Mistake | Fix |
|---------|-----|
| Using CoT for simple queries | Direct answer is fine for 1-step problems |
| Not showing work | Explicit steps catch errors |
| Stopping at first answer | Self-consistency finds better answers |
| Linear thinking on puzzles | Tree of Thoughts enables backtracking |
| Computing mentally | PAL eliminates arithmetic errors |
| Guessing facts | ReAct grounds in external sources |
## Combining Techniques
For maximum accuracy on hard problems:
- 由简到难:分解为子问题
- 对每个子问题:
- 若需要计算,则使用 PAL
- 若需要事实,则使用 ReAct
- 若需要探索,则使用思维树
- 对最终整合结果使用自洽性
---
## What Claude Does vs What You Decide
| Claude handles | You provide |
|---------------|-------------|
| Selecting appropriate reasoning technique | Problem statement and constraints |
| Executing multi-step reasoning chains | Verification of intermediate steps |
| Generating multiple reasoning paths | Selection of best answer |
| Backtracking from dead-ends | Judgment on acceptable confidence |
| Computing via PAL when needed | Real-world validation of results |
---
## Skill Boundaries
### This skill excels for:
- Math and logic problems with multiple steps
- Decisions with competing factors
- Puzzles requiring exploration
- Tasks where initial answers were wrong
### This skill is NOT ideal for:
- Simple factual recall → Direct answer is faster
- Creative writing → Different techniques apply
- Time-critical responses → CoT adds latency
---
## Skill Metadata
```yaml
name: thought-based-reasoning
category: thinking
version: 2.0
author: GUIA
source_expert: Wei et al. (CoT), Yao et al. (ToT), Kojima et al. (Zero-shot CoT)
difficulty: intermediate
mode: both
tags: [reasoning, cot, tot, react, pal, logic, math, problem-solving]
created: 2026-02-03
updated: 2026-02-03
评论
支持 Markdown