Chain of thought prompting
Skill kjuhwa/skills-hub/skills/llm-agents/chain-of-thought-prompting
Apply chain-of-thought prompting (zero-shot CoT, few-shot CoT, Self-Consistency) to improve LLM multi-step reasoning.From its SKILL.md
npx -y skills add kjuhwa/skills-hub --skill chain-of-thought-promptingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
1.8 KB, 339 tokens by cl100k_base, as published. Nobody here has run it
Chain-of-Thought Prompting
When to use
- Multi-step reasoning: math word problems, logic puzzles, planning.
- Show intermediate steps before giving the final answer.
- Boost accuracy via Self-Consistency (sample multiple paths, majority vote).
Steps
- Zero-shot CoT - append the trigger phrase to the question:
Q: 10 friends playing, 7 quit, each remaining player has 8 lives. Total lives?
A: Let's think step by step.
- Few-shot CoT - prepend fully worked examples:
Q: 15 trees, workers plant more, now 21. How many planted?
A: 15 originally, 21 after. 21-15=6. The answer is 6.
Q: 10 friends, 7 quit, each of remaining has 8 lives. Total lives?
A:
- Self-Consistency - sample multiple times, pick majority answer:
from collections import Counter
answers = []
for _ in range(5):
resp = call_llm(prompt, temperature=0.7)
answers.append(extract_final_answer(resp))
final = Counter(answers).most_common(1)[0][0]
- Program-of-Thought (PoT) - instruct the model to return Python code that computes the answer.
Pitfalls
- Wrong few-shot exemplar answers reduce accuracy while shifting answer format.
- Self-Consistency multiplies API cost by the number of samples.
Source
- Chapter 2 of dive-into-llms - documents/chapter2/README.md
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.