@rfxlamia/skillkit 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents/agents/creative-copywriter.md +212 -0
- package/agents/agents/dario-amodei.md +135 -0
- package/agents/agents/doc-simplifier.md +63 -0
- package/agents/agents/kotlin-pro.md +433 -0
- package/agents/agents/red-team.md +136 -0
- package/agents/agents/sam-altman.md +121 -0
- package/agents/agents/seo-manager.md +184 -0
- package/package.json +1 -1
- package/skills/skillkit-help/SKILL.md +81 -0
- package/skills/skillkit-help/knowledge/application/09-case-studies.md +257 -0
- package/skills/skillkit-help/knowledge/application/12-testing-and-validation.md +276 -0
- package/skills/skillkit-help/knowledge/foundation/01-why-skills-exist.md +246 -0
- package/skills/skillkit-help/knowledge/foundation/02-skills-vs-subagents-comparison.md +312 -0
- package/skills/skillkit-help/knowledge/foundation/03-skills-vs-subagents-decision-tree.md +346 -0
- package/skills/skillkit-help/knowledge/foundation/06-platform-constraints.md +237 -0
- package/skills/skillkit-help/knowledge/foundation/08-when-not-to-use-skills.md +270 -0
- package/skills/skillkit-help/template/SKILL.md +52 -0
- package/skills/skills/adversarial-review/SKILL.md +219 -0
- package/skills/skills/baby-education/SKILL.md +260 -0
- package/skills/skills/baby-education/references/advanced-techniques.md +323 -0
- package/skills/skills/baby-education/references/transformations.md +345 -0
- package/skills/skills/been-there-done-that/SKILL.md +455 -0
- package/skills/skills/been-there-done-that/references/analysis-patterns.md +162 -0
- package/skills/skills/been-there-done-that/references/git-commands.md +132 -0
- package/skills/skills/been-there-done-that/references/tree-insertion-logic.md +145 -0
- package/skills/skills/coolhunter/SKILL.md +270 -0
- package/skills/skills/coolhunter/assets/elicitation-methods.csv +51 -0
- package/skills/skills/coolhunter/knowledge/elicitation-methods.md +312 -0
- package/skills/skills/coolhunter/references/workflow-execution.md +238 -0
- package/skills/skills/coolhunter/workflow-plan-coolhunter.md +232 -0
- package/skills/skills/creative-copywriting/SKILL.md +324 -0
- package/skills/skills/creative-copywriting/databases/README.md +60 -0
- package/skills/skills/creative-copywriting/databases/carousel-structures.csv +16 -0
- package/skills/skills/creative-copywriting/databases/emotional-arcs.csv +11 -0
- package/skills/skills/creative-copywriting/databases/hook-formulas.csv +51 -0
- package/skills/skills/creative-copywriting/databases/power-words.csv +201 -0
- package/skills/skills/creative-copywriting/databases/psychological-triggers.csv +21 -0
- package/skills/skills/creative-copywriting/databases/read-more-patterns.csv +26 -0
- package/skills/skills/creative-copywriting/databases/swipe-triggers.csv +31 -0
- package/skills/skills/creative-copywriting/references/carousel-psychology.md +223 -0
- package/skills/skills/creative-copywriting/references/hook-anatomy.md +169 -0
- package/skills/skills/creative-copywriting/references/power-word-science.md +134 -0
- package/skills/skills/creative-copywriting/references/storytelling-frameworks.md +157 -0
- package/skills/skills/diverse-content-gen/SKILL.md +201 -0
- package/skills/skills/diverse-content-gen/references/advanced-techniques.md +320 -0
- package/skills/skills/diverse-content-gen/references/research-findings.md +379 -0
- package/skills/skills/diverse-content-gen/references/task-workflows.md +241 -0
- package/skills/skills/diverse-content-gen/references/tool-integration.md +419 -0
- package/skills/skills/diverse-content-gen/references/troubleshooting.md +426 -0
- package/skills/skills/diverse-content-gen/references/vs-core-technique.md +240 -0
- package/skills/skills/framework-critical-thinking/SKILL.md +220 -0
- package/skills/skills/framework-critical-thinking/references/bias_detector.md +375 -0
- package/skills/skills/framework-critical-thinking/references/fallback_handler.md +239 -0
- package/skills/skills/framework-critical-thinking/references/memory_curator.md +161 -0
- package/skills/skills/framework-critical-thinking/references/metacognitive_monitor.md +297 -0
- package/skills/skills/framework-critical-thinking/references/producer_critic_orchestrator.md +333 -0
- package/skills/skills/framework-critical-thinking/references/reasoning_router.md +235 -0
- package/skills/skills/framework-critical-thinking/references/reasoning_validator.md +97 -0
- package/skills/skills/framework-critical-thinking/references/reflection_trigger.md +78 -0
- package/skills/skills/framework-critical-thinking/references/self_verification.md +388 -0
- package/skills/skills/framework-critical-thinking/references/uncertainty_quantifier.md +207 -0
- package/skills/skills/framework-initiative/SKILL.md +231 -0
- package/skills/skills/framework-initiative/references/examples.md +150 -0
- package/skills/skills/framework-initiative/references/impact-analysis.md +157 -0
- package/skills/skills/framework-initiative/references/intent-patterns.md +145 -0
- package/skills/skills/framework-initiative/references/star-framework.md +165 -0
- package/skills/skills/humanize-docs/SKILL.md +203 -0
- package/skills/skills/humanize-docs/references/advanced-techniques.md +13 -0
- package/skills/skills/humanize-docs/references/core-transformations.md +368 -0
- package/skills/skills/humanize-docs/references/detection-patterns.md +400 -0
- package/skills/skills/humanize-docs/references/examples-gallery.md +374 -0
- package/skills/skills/imagine/SKILL.md +190 -0
- package/skills/skills/imagine/references/artstyle-corporate-memphis.md +625 -0
- package/skills/skills/imagine/references/artstyle-crewdson-hyperrealism.md +295 -0
- package/skills/skills/imagine/references/artstyle-iphone-social-media.md +426 -0
- package/skills/skills/imagine/references/artstyle-sciencesaru.md +276 -0
- package/skills/skills/pre-deploy-checklist/README.md +26 -0
- package/skills/skills/pre-deploy-checklist/SKILL.md +153 -0
- package/skills/skills/pre-deploy-checklist/references/checklist-categories.md +174 -0
- package/skills/skills/pre-deploy-checklist/references/domain-prompts.md +216 -0
- package/skills/skills/prompt-engineering/SKILL.md +209 -0
- package/skills/skills/prompt-engineering/references/advanced-combinations.md +444 -0
- package/skills/skills/prompt-engineering/references/chain-of-thought.md +140 -0
- package/skills/skills/prompt-engineering/references/decision_matrix.md +220 -0
- package/skills/skills/prompt-engineering/references/few-shot.md +346 -0
- package/skills/skills/prompt-engineering/references/json-format.md +270 -0
- package/skills/skills/prompt-engineering/references/natural-language.md +420 -0
- package/skills/skills/prompt-engineering/references/pitfalls.md +365 -0
- package/skills/skills/prompt-engineering/references/prompt-chaining.md +498 -0
- package/skills/skills/prompt-engineering/references/react.md +108 -0
- package/skills/skills/prompt-engineering/references/self-consistency.md +322 -0
- package/skills/skills/prompt-engineering/references/tree-of-thoughts.md +386 -0
- package/skills/skills/prompt-engineering/references/xml-format.md +220 -0
- package/skills/skills/prompt-engineering/references/yaml-format.md +488 -0
- package/skills/skills/prompt-engineering/references/zero-shot.md +74 -0
- package/skills/skills/quick-spec/SKILL.md +280 -0
- package/skills/skills/quick-spec/assets/tech-spec-template.md +74 -0
- package/skills/skills/quick-spec/references/step-01-understand.md +189 -0
- package/skills/skills/quick-spec/references/step-02-investigate.md +144 -0
- package/skills/skills/quick-spec/references/step-03-generate.md +128 -0
- package/skills/skills/quick-spec/references/step-04-review.md +173 -0
- package/skills/skills/quick-spec/tests/__pycache__/test_skill.cpython-314-pytest-9.0.2.pyc +0 -0
- package/skills/skills/quick-spec/tests/test_scenarios.md +83 -0
- package/skills/skills/quick-spec/tests/test_skill.py +136 -0
- package/skills/skills/readme-expert/SKILL.md +538 -0
- package/skills/skills/readme-expert/knowledge/INDEX.md +192 -0
- package/skills/skills/readme-expert/knowledge/application/quality-standards.md +470 -0
- package/skills/skills/readme-expert/knowledge/application/script-executor.md +604 -0
- package/skills/skills/readme-expert/knowledge/application/template-library.md +822 -0
- package/skills/skills/readme-expert/knowledge/foundation/codebase-scanner.md +361 -0
- package/skills/skills/readme-expert/knowledge/foundation/validation-checklist.md +481 -0
- package/skills/skills/red-teaming/SKILL.md +321 -0
- package/skills/skills/red-teaming/references/ai-llm-redteam.md +517 -0
- package/skills/skills/red-teaming/references/attack-techniques.md +410 -0
- package/skills/skills/red-teaming/references/cybersecurity-redteam.md +383 -0
- package/skills/skills/red-teaming/references/tools-frameworks.md +446 -0
- package/skills/skills/releasing/.skillkit-mode +1 -0
- package/skills/skills/releasing/SKILL.md +225 -0
- package/skills/skills/releasing/references/version-detection.md +108 -0
- package/skills/skills/screenwriter/SKILL.md +273 -0
- package/skills/skills/screenwriter/references/advanced-techniques.md +216 -0
- package/skills/skills/screenwriter/references/pipeline-integration.md +266 -0
- package/skills/skills/skillkit/.claude/settings.local.json +7 -0
- package/skills/skills/skillkit/.claude-plugin/plugin.json +27 -0
- package/skills/skills/skillkit/CHANGELOG.md +484 -0
- package/skills/skills/skillkit/SKILL.md +511 -0
- package/skills/skills/skillkit/commands/skillkit.md +6 -0
- package/skills/skills/skillkit/commands/validate-plan.md +6 -0
- package/skills/skills/skillkit/commands/verify.md +6 -0
- package/skills/skills/skillkit/knowledge/INDEX.md +352 -0
- package/skills/skills/skillkit/knowledge/application/09-case-studies.md +257 -0
- package/skills/skills/skillkit/knowledge/application/10-technical-architecture.md +324 -0
- package/skills/skills/skillkit/knowledge/application/11-adoption-strategy.md +267 -0
- package/skills/skills/skillkit/knowledge/application/12-testing-and-validation.md +276 -0
- package/skills/skills/skillkit/knowledge/application/13-competitive-landscape.md +198 -0
- package/skills/skills/skillkit/knowledge/foundation/01-why-skills-exist.md +246 -0
- package/skills/skills/skillkit/knowledge/foundation/02-skills-vs-subagents-comparison.md +312 -0
- package/skills/skills/skillkit/knowledge/foundation/03-skills-vs-subagents-decision-tree.md +346 -0
- package/skills/skills/skillkit/knowledge/foundation/04-hybrid-patterns.md +308 -0
- package/skills/skills/skillkit/knowledge/foundation/05-token-economics.md +275 -0
- package/skills/skills/skillkit/knowledge/foundation/06-platform-constraints.md +237 -0
- package/skills/skills/skillkit/knowledge/foundation/07-security-concerns.md +322 -0
- package/skills/skills/skillkit/knowledge/foundation/08-when-not-to-use-skills.md +270 -0
- package/skills/skills/skillkit/knowledge/plugin-guide.md +614 -0
- package/skills/skills/skillkit/knowledge/tools/14-validation-tools-guide.md +150 -0
- package/skills/skills/skillkit/knowledge/tools/15-cost-tools-guide.md +157 -0
- package/skills/skills/skillkit/knowledge/tools/16-security-tools-guide.md +122 -0
- package/skills/skills/skillkit/knowledge/tools/17-pattern-tools-guide.md +161 -0
- package/skills/skills/skillkit/knowledge/tools/18-decision-helper-guide.md +243 -0
- package/skills/skills/skillkit/knowledge/tools/19-test-generator-guide.md +275 -0
- package/skills/skills/skillkit/knowledge/tools/20-split-skill-guide.md +149 -0
- package/skills/skills/skillkit/knowledge/tools/21-quality-scorer-guide.md +226 -0
- package/skills/skills/skillkit/knowledge/tools/22-migration-helper-guide.md +356 -0
- package/skills/skills/skillkit/knowledge/tools/23-subagent-creation-guide.md +448 -0
- package/skills/skills/skillkit/knowledge/tools/24-behavioral-testing-guide.md +122 -0
- package/skills/skills/skillkit/references/proposal-generation.md +982 -0
- package/skills/skills/skillkit/references/rationalization-catalog.md +75 -0
- package/skills/skills/skillkit/references/research-methodology.md +661 -0
- package/skills/skills/skillkit/references/section-2-full-creation-workflow.md +452 -0
- package/skills/skills/skillkit/references/section-3-validation-workflow-existing-skill.md +63 -0
- package/skills/skills/skillkit/references/section-4-decision-workflow-skills-vs-subagents.md +64 -0
- package/skills/skills/skillkit/references/section-5-migration-workflow-doc-to-skill.md +58 -0
- package/skills/skills/skillkit/references/section-6-subagent-creation-workflow.md +499 -0
- package/skills/skills/skillkit/references/section-7-knowledge-reference-map.md +72 -0
- package/skills/skills/skillkit/scripts/__pycache__/decision_helper.cpython-314.pyc +0 -0
- package/skills/skills/skillkit/scripts/__pycache__/quick_validate.cpython-312.pyc +0 -0
- package/skills/skills/skillkit/scripts/__pycache__/quick_validate.cpython-314.pyc +0 -0
- package/skills/skills/skillkit/scripts/__pycache__/test_generator.cpython-314-pytest-9.0.2.pyc +0 -0
- package/skills/skills/skillkit/scripts/decision_helper.py +799 -0
- package/skills/skills/skillkit/scripts/init_skill.py +400 -0
- package/skills/skills/skillkit/scripts/init_subagent.py +231 -0
- package/skills/skills/skillkit/scripts/migration_helper.py +669 -0
- package/skills/skills/skillkit/scripts/package_skill.py +211 -0
- package/skills/skills/skillkit/scripts/pattern_detector.py +381 -0
- package/skills/skills/skillkit/scripts/pattern_detector_new.py +382 -0
- package/skills/skills/skillkit/scripts/pressure_tester.py +157 -0
- package/skills/skills/skillkit/scripts/quality_scorer.py +999 -0
- package/skills/skills/skillkit/scripts/quick_validate.py +100 -0
- package/skills/skills/skillkit/scripts/security_scanner.py +474 -0
- package/skills/skills/skillkit/scripts/split_skill.py +540 -0
- package/skills/skills/skillkit/scripts/test_generator.py +695 -0
- package/skills/skills/skillkit/scripts/token_estimator.py +493 -0
- package/skills/skills/skillkit/scripts/utils/__init__.py +49 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/__init__.cpython-314.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/budget_tracker.cpython-312.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/budget_tracker.cpython-314.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/output_formatter.cpython-312.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/output_formatter.cpython-314.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/reference_validator.cpython-312.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/reference_validator.cpython-314.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/budget_tracker.py +388 -0
- package/skills/skills/skillkit/scripts/utils/output_formatter.py +263 -0
- package/skills/skills/skillkit/scripts/utils/reference_validator.py +401 -0
- package/skills/skills/skillkit/scripts/validate_skill.py +594 -0
- package/skills/skills/skillkit/tests/test_behavioral.py +39 -0
- package/skills/skills/skillkit/tests/test_scenarios.md +83 -0
- package/skills/skills/skillkit/tests/test_skill.py +136 -0
- package/skills/skills/skillkit-help/SKILL.md +81 -0
- package/skills/skills/skillkit-help/knowledge/application/09-case-studies.md +257 -0
- package/skills/skills/skillkit-help/knowledge/application/12-testing-and-validation.md +276 -0
- package/skills/skills/skillkit-help/knowledge/foundation/01-why-skills-exist.md +246 -0
- package/skills/skills/skillkit-help/knowledge/foundation/02-skills-vs-subagents-comparison.md +312 -0
- package/skills/skills/skillkit-help/knowledge/foundation/03-skills-vs-subagents-decision-tree.md +346 -0
- package/skills/skills/skillkit-help/knowledge/foundation/06-platform-constraints.md +237 -0
- package/skills/skills/skillkit-help/knowledge/foundation/08-when-not-to-use-skills.md +270 -0
- package/skills/skills/skillkit-help/template/SKILL.md +52 -0
- package/skills/skills/social-media-seo/SKILL.md +278 -0
- package/skills/skills/social-media-seo/databases/caption-styles.csv +31 -0
- package/skills/skills/social-media-seo/databases/engagement-tactics.csv +16 -0
- package/skills/skills/social-media-seo/databases/hashtag-strategies.csv +21 -0
- package/skills/skills/social-media-seo/databases/hook-formulas.csv +26 -0
- package/skills/skills/social-media-seo/databases/keyword-clusters.csv +11 -0
- package/skills/skills/social-media-seo/databases/thread-structures.csv +26 -0
- package/skills/skills/social-media-seo/databases/viral-patterns.csv +21 -0
- package/skills/skills/social-media-seo/references/analytics-guide.md +321 -0
- package/skills/skills/social-media-seo/references/instagram-seo.md +235 -0
- package/skills/skills/social-media-seo/references/threads-seo.md +305 -0
- package/skills/skills/social-media-seo/references/x-twitter-seo.md +337 -0
- package/skills/skills/social-media-seo/scripts/query_database.py +191 -0
- package/skills/skills/storyteller/SKILL.md +241 -0
- package/skills/skills/storyteller/references/transformation-methodology.md +293 -0
- package/skills/skills/storyteller/references/visual-vocabulary.md +177 -0
- package/skills/skills/thread-pro/SKILL.md +162 -0
- package/skills/skills/thread-pro/anti-ai-patterns.md +120 -0
- package/skills/skills/thread-pro/hook-formulas.md +138 -0
- package/skills/skills/thread-pro/references/anti-ai-patterns.md +120 -0
- package/skills/skills/thread-pro/references/hook-formulas.md +138 -0
- package/skills/skills/thread-pro/references/thread-structures.md +240 -0
- package/skills/skills/thread-pro/references/voice-injection.md +130 -0
- package/skills/skills/thread-pro/thread-structures.md +240 -0
- package/skills/skills/thread-pro/voice-injection.md +130 -0
- package/skills/skills/tinkering/SKILL.md +251 -0
- package/skills/skills/tinkering/references/graduation-checklist.md +100 -0
- package/skills/skills/validate-plan/.skillkit-mode +1 -0
- package/skills/skills/validate-plan/SKILL.md +406 -0
- package/skills/skills/validate-plan/references/dry-principles.md +251 -0
- package/skills/skills/validate-plan/references/gap-analysis-guide.md +320 -0
- package/skills/skills/validate-plan/references/tdd-patterns.md +413 -0
- package/skills/skills/validate-plan/references/yagni-checklist.md +330 -0
- package/skills/skills/verify-before-ship/.skillkit-mode +1 -0
- package/skills/skills/verify-before-ship/SKILL.md +116 -0
- package/skills/skills/verify-before-ship/references/anti-rationalization.md +212 -0
- package/skills/skills/verify-before-ship/references/verification-gates.md +305 -0
- package/skills-manifest.json +8 -2
- package/src/picker.js +11 -5
- package/src/picker.test.js +36 -1
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
# Advanced Techniques: Combining Methods
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Most real-world tasks benefit from combining multiple prompt engineering techniques. This guide shows proven combinations and when to use them.
|
|
6
|
+
|
|
7
|
+
## Common Combinations
|
|
8
|
+
|
|
9
|
+
### 1. Few-Shot + Chain of Thought (Few-Shot CoT)
|
|
10
|
+
|
|
11
|
+
**When to use:** Need both format consistency AND transparent reasoning
|
|
12
|
+
|
|
13
|
+
**Structure:**
|
|
14
|
+
```
|
|
15
|
+
Show examples with reasoning steps included in each example.
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**Template:**
|
|
19
|
+
```
|
|
20
|
+
Task: Solve complex math word problems
|
|
21
|
+
|
|
22
|
+
Example 1 (with reasoning):
|
|
23
|
+
Problem: If 3 oranges cost $2, how much do 7 oranges cost?
|
|
24
|
+
|
|
25
|
+
Reasoning:
|
|
26
|
+
Step 1: Find cost per orange = $2 ÷ 3 = $0.67
|
|
27
|
+
Step 2: Calculate for 7 oranges = $0.67 × 7 = $4.69
|
|
28
|
+
Answer: $4.69
|
|
29
|
+
|
|
30
|
+
Example 2 (with reasoning):
|
|
31
|
+
Problem: A car travels 120 miles in 2 hours. At the same speed,
|
|
32
|
+
how long for 300 miles?
|
|
33
|
+
|
|
34
|
+
Reasoning:
|
|
35
|
+
Step 1: Find speed = 120 miles ÷ 2 hours = 60 mph
|
|
36
|
+
Step 2: Calculate time = 300 miles ÷ 60 mph = 5 hours
|
|
37
|
+
Answer: 5 hours
|
|
38
|
+
|
|
39
|
+
Now solve (show your reasoning):
|
|
40
|
+
Problem: If 5 apples cost $3, how much do 8 apples cost?
|
|
41
|
+
Reasoning:
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Benefits:**
|
|
45
|
+
- Consistent output format (from Few-Shot)
|
|
46
|
+
- Transparent reasoning (from CoT)
|
|
47
|
+
- Higher accuracy than either alone
|
|
48
|
+
|
|
49
|
+
**Token cost:** Medium-High (200-800 tokens)
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### 2. ReAct + Self-Consistency
|
|
54
|
+
|
|
55
|
+
**When to use:** High-stakes decisions requiring both tool use AND verification
|
|
56
|
+
|
|
57
|
+
**Structure:**
|
|
58
|
+
```
|
|
59
|
+
Use ReAct framework multiple times with different tool sequences,
|
|
60
|
+
then compare results for consistency.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Template:**
|
|
64
|
+
```
|
|
65
|
+
Problem: [Complex problem requiring both tools and high confidence]
|
|
66
|
+
|
|
67
|
+
Attempt 1 (Tool Sequence A):
|
|
68
|
+
Thought 1: [Reasoning]
|
|
69
|
+
Action 1: [Tool/API call]
|
|
70
|
+
Observation 1: [Result]
|
|
71
|
+
...
|
|
72
|
+
Final Answer 1: [Result]
|
|
73
|
+
|
|
74
|
+
Attempt 2 (Tool Sequence B):
|
|
75
|
+
Thought 1: [Different approach]
|
|
76
|
+
Action 1: [Different tool or order]
|
|
77
|
+
Observation 1: [Result]
|
|
78
|
+
...
|
|
79
|
+
Final Answer 2: [Result]
|
|
80
|
+
|
|
81
|
+
Attempt 3 (Tool Sequence C):
|
|
82
|
+
[Third approach]
|
|
83
|
+
Final Answer 3: [Result]
|
|
84
|
+
|
|
85
|
+
Consistency Check:
|
|
86
|
+
Answers: [Answer 1, Answer 2, Answer 3]
|
|
87
|
+
Agreement: [X/3 agree]
|
|
88
|
+
Final Answer: [Most consistent result]
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Benefits:**
|
|
92
|
+
- Tool use capability (from ReAct)
|
|
93
|
+
- Verified answers (from Self-Consistency)
|
|
94
|
+
- Higher reliability for critical tasks
|
|
95
|
+
|
|
96
|
+
**Token cost:** Very High (1000-3000+ tokens)
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### 3. Tree of Thoughts + XML (Claude-Specific)
|
|
101
|
+
|
|
102
|
+
**When to use:** Complex planning for Claude with clear structure needed
|
|
103
|
+
|
|
104
|
+
**Template:**
|
|
105
|
+
```xml
|
|
106
|
+
<tree_of_thoughts>
|
|
107
|
+
<problem>[Complex planning problem]</problem>
|
|
108
|
+
|
|
109
|
+
<exploration_config>
|
|
110
|
+
<max_depth>3</max_depth>
|
|
111
|
+
<branches_per_level>3</branches_per_level>
|
|
112
|
+
<evaluation_criteria>
|
|
113
|
+
<criterion weight="0.4">Feasibility</criterion>
|
|
114
|
+
<criterion weight="0.3">Cost</criterion>
|
|
115
|
+
<criterion weight="0.3">Time</criterion>
|
|
116
|
+
</evaluation_criteria>
|
|
117
|
+
</exploration_config>
|
|
118
|
+
|
|
119
|
+
<level_1>
|
|
120
|
+
<thought id="A">
|
|
121
|
+
<description>[Approach A]</description>
|
|
122
|
+
<evaluation>
|
|
123
|
+
<feasibility>0.9</feasibility>
|
|
124
|
+
<cost>0.6</cost>
|
|
125
|
+
<time>0.7</time>
|
|
126
|
+
<total_score>0.75</total_score>
|
|
127
|
+
</evaluation>
|
|
128
|
+
</thought>
|
|
129
|
+
<!-- More thoughts -->
|
|
130
|
+
<selected>A</selected>
|
|
131
|
+
</level_1>
|
|
132
|
+
|
|
133
|
+
<!-- Continue levels -->
|
|
134
|
+
</tree_of_thoughts>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Benefits:**
|
|
138
|
+
- Systematic exploration (from ToT)
|
|
139
|
+
- Clear structure (from XML)
|
|
140
|
+
- Claude-optimized format
|
|
141
|
+
|
|
142
|
+
**Token cost:** High (800-2000 tokens)
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
### 4. Few-Shot + JSON (API Integration)
|
|
147
|
+
|
|
148
|
+
**When to use:** Need format consistency + machine parsing
|
|
149
|
+
|
|
150
|
+
**Template:**
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"task": "Extract structured data from text",
|
|
154
|
+
"examples": [
|
|
155
|
+
{
|
|
156
|
+
"input": "John Doe, 30 years old, works at Google",
|
|
157
|
+
"output": {
|
|
158
|
+
"name": "John Doe",
|
|
159
|
+
"age": 30,
|
|
160
|
+
"company": "Google"
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"input": "Jane Smith, age 25, employed by Microsoft",
|
|
165
|
+
"output": {
|
|
166
|
+
"name": "Jane Smith",
|
|
167
|
+
"age": 25,
|
|
168
|
+
"company": "Microsoft"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
"new_input": "[Text to process]",
|
|
173
|
+
"output_schema": {
|
|
174
|
+
"type": "object",
|
|
175
|
+
"properties": {
|
|
176
|
+
"name": {"type": "string"},
|
|
177
|
+
"age": {"type": "integer"},
|
|
178
|
+
"company": {"type": "string"}
|
|
179
|
+
},
|
|
180
|
+
"required": ["name", "age", "company"]
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Benefits:**
|
|
186
|
+
- Format learning (from Few-Shot)
|
|
187
|
+
- Machine-parseable (from JSON)
|
|
188
|
+
- Schema validation possible
|
|
189
|
+
|
|
190
|
+
**Token cost:** Medium (200-600 tokens)
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
### 5. Zero-Shot CoT + XML (Claude Simple Reasoning)
|
|
195
|
+
|
|
196
|
+
**When to use:** Simple reasoning tasks for Claude without examples
|
|
197
|
+
|
|
198
|
+
**Template:**
|
|
199
|
+
```xml
|
|
200
|
+
<reasoning_task>
|
|
201
|
+
<problem>
|
|
202
|
+
[State problem clearly]
|
|
203
|
+
</problem>
|
|
204
|
+
|
|
205
|
+
<instruction>
|
|
206
|
+
Let's solve this step by step.
|
|
207
|
+
</instruction>
|
|
208
|
+
|
|
209
|
+
<reasoning_steps>
|
|
210
|
+
<!-- LLM fills this in -->
|
|
211
|
+
</reasoning_steps>
|
|
212
|
+
|
|
213
|
+
<answer>
|
|
214
|
+
<!-- LLM provides final answer -->
|
|
215
|
+
</answer>
|
|
216
|
+
</reasoning_task>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Benefits:**
|
|
220
|
+
- Step-by-step reasoning (from CoT)
|
|
221
|
+
- Clean structure (from XML)
|
|
222
|
+
- No examples needed (from Zero-Shot)
|
|
223
|
+
|
|
224
|
+
**Token cost:** Low-Medium (100-300 tokens)
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Decision Matrix: Which Combination?
|
|
229
|
+
|
|
230
|
+
| Need | Combination | Token Cost |
|
|
231
|
+
|------|-------------|------------|
|
|
232
|
+
| Format + Reasoning | Few-Shot CoT | Medium-High |
|
|
233
|
+
| Tools + Verification | ReAct + Self-Consistency | Very High |
|
|
234
|
+
| Planning + Structure (Claude) | ToT + XML | High |
|
|
235
|
+
| Format + Parsing | Few-Shot + JSON | Medium |
|
|
236
|
+
| Simple Reasoning (Claude) | Zero-Shot CoT + XML | Low-Medium |
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Layering Techniques
|
|
241
|
+
|
|
242
|
+
### Layer 1: Base Method
|
|
243
|
+
Choose primary technique:
|
|
244
|
+
- Zero-Shot / Few-Shot / CoT / ReAct / ToT / Self-Consistency
|
|
245
|
+
|
|
246
|
+
### Layer 2: Format
|
|
247
|
+
Choose output format:
|
|
248
|
+
- Natural Language / JSON / XML / YAML
|
|
249
|
+
|
|
250
|
+
### Layer 3: Enhancements (Optional)
|
|
251
|
+
Add refinements:
|
|
252
|
+
- Examples (if not Few-Shot)
|
|
253
|
+
- Verification steps
|
|
254
|
+
- Edge case handling
|
|
255
|
+
- Output schema
|
|
256
|
+
|
|
257
|
+
**Example Layering:**
|
|
258
|
+
```
|
|
259
|
+
Base: ReAct (tool use needed)
|
|
260
|
+
Format: JSON (API integration)
|
|
261
|
+
Enhancement: Add schema validation
|
|
262
|
+
|
|
263
|
+
Result: ReAct + JSON + Schema
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Anti-Patterns to Avoid
|
|
269
|
+
|
|
270
|
+
### ❌ Don't Mix Contradictory Techniques
|
|
271
|
+
|
|
272
|
+
**Bad:**
|
|
273
|
+
```
|
|
274
|
+
Use Zero-Shot (no examples)
|
|
275
|
+
Here are 5 examples... (Few-Shot)
|
|
276
|
+
But ignore the examples and reason from scratch (Contradiction)
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### ❌ Don't Over-Engineer Simple Tasks
|
|
280
|
+
|
|
281
|
+
**Bad:**
|
|
282
|
+
```
|
|
283
|
+
Use Tree of Thoughts + Self-Consistency + Few-Shot CoT
|
|
284
|
+
to answer: "What is 2 + 2?"
|
|
285
|
+
|
|
286
|
+
Token cost: 2000+
|
|
287
|
+
Correct approach: Zero-Shot, 10 tokens
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### ❌ Don't Combine Incompatible Formats
|
|
291
|
+
|
|
292
|
+
**Bad:**
|
|
293
|
+
```xml
|
|
294
|
+
<!-- XML structure -->
|
|
295
|
+
<prompt>
|
|
296
|
+
{
|
|
297
|
+
"json": "inside xml" <!-- Confusing mix -->
|
|
298
|
+
}
|
|
299
|
+
</prompt>
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**Good:**
|
|
303
|
+
```xml
|
|
304
|
+
<prompt>
|
|
305
|
+
<data_format>JSON</data_format>
|
|
306
|
+
<expected_output>
|
|
307
|
+
<!-- Describe JSON, don't embed it -->
|
|
308
|
+
</expected_output>
|
|
309
|
+
</prompt>
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## Progressive Enhancement
|
|
315
|
+
|
|
316
|
+
Start simple, add complexity only if needed:
|
|
317
|
+
|
|
318
|
+
### Level 1: Start Simple
|
|
319
|
+
```
|
|
320
|
+
Zero-Shot with Natural Language
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Level 2: Add Examples (if output quality poor)
|
|
324
|
+
```
|
|
325
|
+
Few-Shot with Natural Language
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Level 3: Add Reasoning (if logic unclear)
|
|
329
|
+
```
|
|
330
|
+
Few-Shot CoT with Natural Language
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Level 4: Add Structure (if Claude or complex)
|
|
334
|
+
```
|
|
335
|
+
Few-Shot CoT with XML
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Level 5: Add Verification (if high-stakes)
|
|
339
|
+
```
|
|
340
|
+
Few-Shot CoT + Self-Consistency with XML
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
**Rule:** Only progress to next level if previous level insufficient.
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## Real-World Combination Examples
|
|
348
|
+
|
|
349
|
+
### Example 1: Medical Diagnosis Support
|
|
350
|
+
|
|
351
|
+
**Combination:** Few-Shot CoT + Self-Consistency + XML
|
|
352
|
+
|
|
353
|
+
```xml
|
|
354
|
+
<medical_diagnosis>
|
|
355
|
+
<examples>
|
|
356
|
+
<example>
|
|
357
|
+
<symptoms>[Symptom list]</symptoms>
|
|
358
|
+
<reasoning>
|
|
359
|
+
<step>Step 1: Consider symptom cluster</step>
|
|
360
|
+
<step>Step 2: Differential diagnosis</step>
|
|
361
|
+
<step>Step 3: Most likely condition</step>
|
|
362
|
+
</reasoning>
|
|
363
|
+
<diagnosis>[Diagnosis]</diagnosis>
|
|
364
|
+
</example>
|
|
365
|
+
</examples>
|
|
366
|
+
|
|
367
|
+
<new_case>
|
|
368
|
+
<symptoms>[Patient symptoms]</symptoms>
|
|
369
|
+
</new_case>
|
|
370
|
+
|
|
371
|
+
<instruction>
|
|
372
|
+
Provide 3 independent diagnostic approaches,
|
|
373
|
+
then select most consistent diagnosis.
|
|
374
|
+
</instruction>
|
|
375
|
+
</medical_diagnosis>
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
**Why this combination:**
|
|
379
|
+
- Few-Shot CoT: Show diagnostic reasoning pattern
|
|
380
|
+
- Self-Consistency: Critical decision needs verification
|
|
381
|
+
- XML: Claude-optimized, clear structure
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
### Example 2: Code Generation with Validation
|
|
386
|
+
|
|
387
|
+
**Combination:** Few-Shot + ReAct + JSON
|
|
388
|
+
|
|
389
|
+
```json
|
|
390
|
+
{
|
|
391
|
+
"task": "Generate and validate Python function",
|
|
392
|
+
"examples": [
|
|
393
|
+
{
|
|
394
|
+
"request": "Function to calculate factorial",
|
|
395
|
+
"code": "def factorial(n): ...",
|
|
396
|
+
"tests": ["assert factorial(5) == 120"]
|
|
397
|
+
}
|
|
398
|
+
],
|
|
399
|
+
"new_request": "[User request]",
|
|
400
|
+
"workflow": {
|
|
401
|
+
"step_1": {
|
|
402
|
+
"action": "GENERATE_CODE",
|
|
403
|
+
"thought": "Based on examples, create function"
|
|
404
|
+
},
|
|
405
|
+
"step_2": {
|
|
406
|
+
"action": "VALIDATE_SYNTAX",
|
|
407
|
+
"thought": "Check for syntax errors"
|
|
408
|
+
},
|
|
409
|
+
"step_3": {
|
|
410
|
+
"action": "RUN_TESTS",
|
|
411
|
+
"thought": "Execute test cases"
|
|
412
|
+
},
|
|
413
|
+
"step_4": {
|
|
414
|
+
"action": "FINISH",
|
|
415
|
+
"output": "Validated code"
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
**Why this combination:**
|
|
422
|
+
- Few-Shot: Show code style and pattern
|
|
423
|
+
- ReAct: Multi-step with validation actions
|
|
424
|
+
- JSON: Machine-parseable output
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
## Quick Reference
|
|
429
|
+
|
|
430
|
+
| Scenario | Best Combination | Cost |
|
|
431
|
+
|----------|-----------------|------|
|
|
432
|
+
| Math word problems | Few-Shot CoT + Natural Language | Medium |
|
|
433
|
+
| Medical diagnosis | Few-Shot CoT + Self-Consistency + XML | Very High |
|
|
434
|
+
| API data extraction | Few-Shot + JSON | Medium |
|
|
435
|
+
| Strategic planning (Claude) | ToT + XML | High |
|
|
436
|
+
| Tool use + verification | ReAct + Self-Consistency | Very High |
|
|
437
|
+
| Simple Claude reasoning | Zero-Shot CoT + XML | Low |
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
**Related:**
|
|
442
|
+
- Individual technique guides for details
|
|
443
|
+
- [Decision Matrix](decision_matrix.md) - Choosing techniques
|
|
444
|
+
- [Pitfalls](pitfalls.md) - Avoid anti-patterns
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Chain of Thought (CoT) Prompting
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Chain of Thought prompting encourages the LLM to break down complex problems into intermediate reasoning steps, making the thought process explicit and transparent.
|
|
6
|
+
|
|
7
|
+
## When to Use
|
|
8
|
+
|
|
9
|
+
✅ **Use CoT When:**
|
|
10
|
+
- Multi-step reasoning required
|
|
11
|
+
- Mathematical or logical problems
|
|
12
|
+
- Need transparency in reasoning
|
|
13
|
+
- Complex decision-making tasks
|
|
14
|
+
- Problem involves calculations or deductions
|
|
15
|
+
|
|
16
|
+
❌ **Don't Use CoT When:**
|
|
17
|
+
- Simple, single-step tasks
|
|
18
|
+
- Just need final answer quickly
|
|
19
|
+
- Token budget is extremely tight
|
|
20
|
+
- Task doesn't benefit from step-by-step breakdown
|
|
21
|
+
|
|
22
|
+
## Variants
|
|
23
|
+
|
|
24
|
+
### 1. Zero-Shot CoT
|
|
25
|
+
Simply add "Let's think step by step" to prompt.
|
|
26
|
+
```
|
|
27
|
+
Problem: [Your problem]
|
|
28
|
+
Let's think step by step:
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. Few-Shot CoT
|
|
32
|
+
Provide examples with reasoning steps shown.
|
|
33
|
+
```
|
|
34
|
+
Example:
|
|
35
|
+
Problem: [Example problem]
|
|
36
|
+
Step 1: [First reasoning step]
|
|
37
|
+
Step 2: [Second reasoning step]
|
|
38
|
+
Answer: [Result]
|
|
39
|
+
|
|
40
|
+
Now solve:
|
|
41
|
+
Problem: [Your problem]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 3. Auto-CoT
|
|
45
|
+
Let model generate reasoning automatically with minimal guidance.
|
|
46
|
+
|
|
47
|
+
## Template: Zero-Shot CoT
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
Problem: [State the problem clearly]
|
|
51
|
+
|
|
52
|
+
Let's solve this step by step:
|
|
53
|
+
|
|
54
|
+
1. First, let's identify what we know:
|
|
55
|
+
[List known information]
|
|
56
|
+
|
|
57
|
+
2. Next, let's determine what we need to find:
|
|
58
|
+
[List unknowns]
|
|
59
|
+
|
|
60
|
+
3. Now, let's work through the solution:
|
|
61
|
+
Step 1: [First reasoning step]
|
|
62
|
+
Step 2: [Second reasoning step]
|
|
63
|
+
Step 3: [Third reasoning step]
|
|
64
|
+
|
|
65
|
+
4. Finally, let's verify our answer:
|
|
66
|
+
[Verification step]
|
|
67
|
+
|
|
68
|
+
Answer: [Final answer]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Template: Few-Shot CoT (XML for Claude)
|
|
72
|
+
|
|
73
|
+
```xml
|
|
74
|
+
<chain_of_thought>
|
|
75
|
+
<examples>
|
|
76
|
+
<example>
|
|
77
|
+
<problem>[Problem 1]</problem>
|
|
78
|
+
<reasoning>
|
|
79
|
+
<step number="1">[First step]</step>
|
|
80
|
+
<step number="2">[Second step]</step>
|
|
81
|
+
<step number="3">[Third step]</step>
|
|
82
|
+
</reasoning>
|
|
83
|
+
<answer>[Answer 1]</answer>
|
|
84
|
+
</example>
|
|
85
|
+
</examples>
|
|
86
|
+
|
|
87
|
+
<new_problem>
|
|
88
|
+
[Your actual problem]
|
|
89
|
+
</new_problem>
|
|
90
|
+
|
|
91
|
+
<instruction>
|
|
92
|
+
Please solve using the same step-by-step reasoning approach.
|
|
93
|
+
</instruction>
|
|
94
|
+
</chain_of_thought>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Real-World Example
|
|
98
|
+
|
|
99
|
+
### Math Problem
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
Problem: A store offers 20% discount on items over $100, and additional 10% member discount.
|
|
103
|
+
If an item costs $150 and I'm a member, what's the final price?
|
|
104
|
+
|
|
105
|
+
Let's think step by step:
|
|
106
|
+
|
|
107
|
+
1. Original price: $150
|
|
108
|
+
2. First, apply 20% discount (item over $100):
|
|
109
|
+
$150 × 0.80 = $120
|
|
110
|
+
3. Then, apply 10% member discount on discounted price:
|
|
111
|
+
$120 × 0.90 = $108
|
|
112
|
+
4. Verification: Total discount = $150 - $108 = $42 (28%)
|
|
113
|
+
This makes sense: 20% + 10% of remaining ≈ 28%
|
|
114
|
+
|
|
115
|
+
Answer: $108
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Best Practices
|
|
119
|
+
|
|
120
|
+
✓ Break down into clear, numbered steps
|
|
121
|
+
✓ Show all intermediate calculations
|
|
122
|
+
✓ Make assumptions explicit
|
|
123
|
+
✓ Verify answer makes sense
|
|
124
|
+
✓ Use consistent step format
|
|
125
|
+
|
|
126
|
+
✗ Don't skip critical steps
|
|
127
|
+
✗ Avoid jumping to conclusions
|
|
128
|
+
✗ Don't mix multiple calculations in one step
|
|
129
|
+
|
|
130
|
+
## Token Cost
|
|
131
|
+
|
|
132
|
+
- Typical: 100-500 tokens
|
|
133
|
+
- Trade-off: More tokens for better accuracy and transparency
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
**Related:**
|
|
138
|
+
- [Few-Shot](few-shot.md) - Combine with CoT for Few-Shot CoT
|
|
139
|
+
- [Self-Consistency](self-consistency.md) - Multiple CoT paths
|
|
140
|
+
- [Decision Matrix](decision_matrix.md) - When to use CoT
|