mcpField
T
thought-based-reasoning

thought-based-reasoning

github.com/guia-matthieuエージェントワークフロー150304 回インストール4 週間前に更新
リポジトリ

thought-based-reasoning について

Claude向けの推論スキルで、複数段階の問題や判断、パズルに適した手法を選び、適用します。問題の分解、複数経路の検討、外部情報の確認、計算を扱い、直接回答が適切な場面も示します。

主な機能

  1. 01Zero-shot Chain-of-Thoughtプロンプト
  2. 02Self-Consistencyによる多数決
  3. 03Tree of Thoughtsによる分岐探索
  4. 04Least-to-Mostによる問題分解
  5. 05ReActとPALの手法
  6. 06各手法の適用場面の案内

活用シーン

  1. 01複数段階の数学・論理問題の解決
  2. 02パズルでの複数案の検討
  3. 03複雑な判断における選択肢の比較
  4. 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"];
}

使用する場合:

  • 複数段階の算術問題や文章題
  • 推論の連鎖を必要とする論理問題
  • 複数の要素を考慮する判断
  • 探索が必要な創造的な問題
  • 直接答えた結果、誤りがあったタスク

使用しない場合:

  • 単純な事実の想起
  • 1段階の処理
  • 精度とのトレードオフを許容できる、時間が重要な回答

クイックリファレンス

手法適用場面テンプレート
Zero-shot CoT素早く推論の質を高めたい場合「順を追って考えてみましょう……」
Self-Consistency重要な意思決定3~5通りの推論を実行し、多数決を取る
Tree of Thoughtsパズルや創造的な行き詰まり分岐し、評価し、前の段階に戻る
Least-to-Most複雑な複数パートの問題分解 → 小問題を解く → 統合
ReAct外部情報が必要な場合思考 → 行動 → 観察のループ
PAL計算を伴う数学コードを生成して実行する

手法

1. Zero-shot Chain-of-Thought

使用する場面: 手早くプロトタイプを作成する場合、例がない場合

テンプレート:

[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. Self-Consistency

使用する場面: 重要な意思決定、自信度の測定が必要な場合

手順:

  1. Zero-shot CoTを3~5回実行します(可能であれば温度を変えます)
  2. すべての最終回答を集めます
  3. 多数決を取ります
  4. 一致率を自信度として報告します

テンプレート:

[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. Tree of Thoughts

使用する場面: パズルや創造的な問題、複数の選択肢を検討する必要がある場合

手順:

  1. 最初のアプローチを2~3通り生成します
  2. それぞれを評価します(有望/不確実/行き止まり)
  3. 有望な分岐を展開します
  4. 行き止まりから前の段階に戻ります
  5. 解決策が見つかるまで続けます

テンプレート:

[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. Least-to-Most Prompting

使用する場面: 小問題を含む複雑な問題

手順:

  1. 問題を小問題に分解します
  2. 最も簡単なものから解きます
  3. 解決結果を使って、より難しい問題を解きます
  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(推論+行動)

使用する場面: 外部情報が必要な場合、ハルシネーションを減らしたい場合

手順:

  1. 思考:必要な情報を推論します
  2. 行動:外部ソースに問い合わせます
  3. 観察:結果を記録します
  4. 解決するまで繰り返します

テンプレート:

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(プログラム支援型言語モデル)

使用する場面: 計算を伴う数学、算術ミスをなくしたい場合

手順:

  1. 問題をコードに変換します
  2. コードを実行します
  3. 結果を返します

テンプレート:

[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:

  1. Least-to-Most:小問題に分解する
  2. 小問題ごとに:
    • 計算が必要ならPAL
    • 事実が必要ならReAct
    • 探索が必要ならTree of Thoughts
  3. 最終的な統合にはSelf-Consistencyを使う

---

## 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

コメント