@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,220 @@
|
|
|
1
|
+
# Prompt Engineering Decision Matrix
|
|
2
|
+
|
|
3
|
+
## Comprehensive Decision Framework
|
|
4
|
+
|
|
5
|
+
This matrix helps you select the optimal combination of prompting technique and output format based on multiple factors.
|
|
6
|
+
|
|
7
|
+
## Decision Factors
|
|
8
|
+
|
|
9
|
+
### 1. Task Complexity
|
|
10
|
+
- **Low:** Single-step, well-defined tasks
|
|
11
|
+
- **Medium:** Multi-step but straightforward
|
|
12
|
+
- **High:** Complex reasoning, planning, or exploration required
|
|
13
|
+
|
|
14
|
+
### 2. LLM Target
|
|
15
|
+
- **Claude (Anthropic):** Optimized for XML, strong reasoning
|
|
16
|
+
- **GPT (OpenAI):** Optimized for JSON, tool use
|
|
17
|
+
- **Gemini (Google):** Flexible, strong multimodal
|
|
18
|
+
- **Multi-LLM:** Need portability across platforms
|
|
19
|
+
|
|
20
|
+
### 3. Accuracy Requirements
|
|
21
|
+
- **Normal:** General use, some errors acceptable
|
|
22
|
+
- **Important:** Business-critical, minimize errors
|
|
23
|
+
- **Critical:** Life/safety/financial, zero tolerance
|
|
24
|
+
|
|
25
|
+
### 4. Available Context
|
|
26
|
+
- **No examples:** Must use zero-shot
|
|
27
|
+
- **2-5 examples:** Can use few-shot
|
|
28
|
+
- **Many examples:** Rich few-shot or self-consistency
|
|
29
|
+
|
|
30
|
+
### 5. Output Consumption
|
|
31
|
+
- **Human reading:** Natural language, YAML
|
|
32
|
+
- **Code parsing:** JSON, XML (structured)
|
|
33
|
+
- **Both:** JSON with clear schema
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Selection Matrix
|
|
38
|
+
|
|
39
|
+
| Task Complexity | LLM Target | Accuracy Need | Examples | Recommended Method | Recommended Format |
|
|
40
|
+
|----------------|-----------|---------------|----------|-------------------|-------------------|
|
|
41
|
+
| Low | Any | Normal | None | Zero-Shot | Natural Language |
|
|
42
|
+
| Low | Any | Normal | 2-5 | Few-Shot | Same as examples |
|
|
43
|
+
| Low | Claude | Important | None | Zero-Shot | XML |
|
|
44
|
+
| Low | GPT/Other | Important | None | Zero-Shot | JSON |
|
|
45
|
+
| Medium | Any | Normal | None | Zero-Shot CoT | Natural Language |
|
|
46
|
+
| Medium | Any | Normal | 2-5 | Few-Shot | Natural Language/JSON |
|
|
47
|
+
| Medium | Claude | Important | None | Chain of Thought | XML |
|
|
48
|
+
| Medium | GPT | Important | None | Chain of Thought | JSON |
|
|
49
|
+
| Medium | Any | Important | 2-5 | Few-Shot CoT | XML (Claude) / JSON (Other) |
|
|
50
|
+
| High | Any | Normal | None | Chain of Thought | Natural Language/XML |
|
|
51
|
+
| High | Any | Important | None | Tree of Thoughts | YAML (planning) / XML |
|
|
52
|
+
| High | Any | Critical | Any | Self-Consistency | XML (Claude) / JSON (Other) |
|
|
53
|
+
| High + Tools | Any | Any | None | ReAct | JSON |
|
|
54
|
+
| Planning | Claude | Important | None | Tree of Thoughts | XML / YAML |
|
|
55
|
+
| Planning | GPT | Important | None | Tree of Thoughts | JSON / YAML |
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Format Selection Detailed
|
|
60
|
+
|
|
61
|
+
### XML
|
|
62
|
+
**Use when:**
|
|
63
|
+
- Target is Claude (Anthropic models)
|
|
64
|
+
- Complex nested structure needed
|
|
65
|
+
- Clear semantic boundaries required
|
|
66
|
+
- Multiple contexts need separation
|
|
67
|
+
|
|
68
|
+
**Avoid when:**
|
|
69
|
+
- Output must be parsed by code (use JSON instead)
|
|
70
|
+
- Token efficiency is critical (XML is verbose)
|
|
71
|
+
- Target is non-Claude LLM
|
|
72
|
+
|
|
73
|
+
### JSON
|
|
74
|
+
**Use when:**
|
|
75
|
+
- Output parsed by code/APIs
|
|
76
|
+
- Multi-LLM compatibility needed
|
|
77
|
+
- Structured data with arrays/objects
|
|
78
|
+
- Token efficiency matters
|
|
79
|
+
|
|
80
|
+
**Avoid when:**
|
|
81
|
+
- Humans will frequently edit (use YAML)
|
|
82
|
+
- Very complex hierarchies (consider XML for Claude)
|
|
83
|
+
|
|
84
|
+
### YAML
|
|
85
|
+
**Use when:**
|
|
86
|
+
- Humans edit/maintain prompts
|
|
87
|
+
- Configuration-driven systems
|
|
88
|
+
- Readability is paramount
|
|
89
|
+
- Multi-line content common
|
|
90
|
+
|
|
91
|
+
**Avoid when:**
|
|
92
|
+
- LLM has limited YAML familiarity
|
|
93
|
+
- Output needs programmatic parsing (use JSON)
|
|
94
|
+
- Whitespace sensitivity is problem
|
|
95
|
+
|
|
96
|
+
### Natural Language
|
|
97
|
+
**Use when:**
|
|
98
|
+
- Task is simple and straightforward
|
|
99
|
+
- No structure adds value
|
|
100
|
+
- General conversation/explanation
|
|
101
|
+
- Brainstorming/creative work
|
|
102
|
+
|
|
103
|
+
**Avoid when:**
|
|
104
|
+
- Output must be parsed
|
|
105
|
+
- Structure reduces ambiguity
|
|
106
|
+
- Complex multi-part instructions
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Method Selection by Use Case
|
|
111
|
+
|
|
112
|
+
### Use Case: Code Review
|
|
113
|
+
- **Method:** Few-Shot CoT (show examples with reasoning)
|
|
114
|
+
- **Format:** XML (Claude) or JSON (GPT)
|
|
115
|
+
- **Why:** Need consistent format + reasoning transparency
|
|
116
|
+
|
|
117
|
+
### Use Case: Data Extraction
|
|
118
|
+
- **Method:** Few-Shot
|
|
119
|
+
- **Format:** JSON (for structured output)
|
|
120
|
+
- **Why:** Examples define format, JSON for parsing
|
|
121
|
+
|
|
122
|
+
### Use Case: Mathematical Problem
|
|
123
|
+
- **Method:** Chain of Thought
|
|
124
|
+
- **Format:** Natural Language or XML
|
|
125
|
+
- **Why:** Need step-by-step reasoning, structure helps
|
|
126
|
+
|
|
127
|
+
### Use Case: Planning/Strategy
|
|
128
|
+
- **Method:** Tree of Thoughts
|
|
129
|
+
- **Format:** YAML (human review) or XML (Claude processing)
|
|
130
|
+
- **Why:** Explore alternatives, human-readable planning
|
|
131
|
+
|
|
132
|
+
### Use Case: High-Stakes Decision
|
|
133
|
+
- **Method:** Self-Consistency
|
|
134
|
+
- **Format:** XML (Claude) or JSON (GPT)
|
|
135
|
+
- **Why:** Multiple reasoning paths, structured comparison
|
|
136
|
+
|
|
137
|
+
### Use Case: Tool/API Orchestration
|
|
138
|
+
- **Method:** ReAct
|
|
139
|
+
- **Format:** JSON
|
|
140
|
+
- **Why:** Tool calling requires structured format
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Quick Decision Flowchart
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
START
|
|
148
|
+
↓
|
|
149
|
+
Critical accuracy needed?
|
|
150
|
+
├─ YES → Self-Consistency
|
|
151
|
+
│ ├─ Claude → XML
|
|
152
|
+
│ └─ Other → JSON
|
|
153
|
+
└─ NO → Continue
|
|
154
|
+
↓
|
|
155
|
+
Need tool/API use?
|
|
156
|
+
├─ YES → ReAct + JSON
|
|
157
|
+
└─ NO → Continue
|
|
158
|
+
↓
|
|
159
|
+
Complex planning/exploration?
|
|
160
|
+
├─ YES → Tree of Thoughts
|
|
161
|
+
│ ├─ Human review → YAML
|
|
162
|
+
│ └─ LLM processing → XML (Claude) / JSON (GPT)
|
|
163
|
+
└─ NO → Continue
|
|
164
|
+
↓
|
|
165
|
+
Multi-step reasoning?
|
|
166
|
+
├─ YES → Chain of Thought
|
|
167
|
+
│ ├─ Examples available → Few-Shot CoT
|
|
168
|
+
│ └─ No examples → Zero-Shot CoT
|
|
169
|
+
│ Format: Natural Language or XML (Claude)
|
|
170
|
+
└─ NO → Continue
|
|
171
|
+
↓
|
|
172
|
+
Examples available?
|
|
173
|
+
├─ YES → Few-Shot
|
|
174
|
+
│ Format: Same as examples
|
|
175
|
+
└─ NO → Zero-Shot
|
|
176
|
+
Format: Natural Language
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Token Budget Considerations
|
|
182
|
+
|
|
183
|
+
| Method | Typical Tokens | When Token Budget is... |
|
|
184
|
+
|--------|---------------|------------------------|
|
|
185
|
+
| Zero-Shot | 50-200 | ✅ Tight budget |
|
|
186
|
+
| Few-Shot (3 ex) | 200-800 | ✅ Medium budget |
|
|
187
|
+
| Chain of Thought | 100-500 | ✅ Medium budget |
|
|
188
|
+
| ReAct | 300-1000 | ⚠️ Moderate budget needed |
|
|
189
|
+
| Tree of Thoughts | 500-2000+ | ❌ Large budget required |
|
|
190
|
+
| Self-Consistency | 500-3000+ | ❌ Large budget required |
|
|
191
|
+
|
|
192
|
+
**Format overhead:**
|
|
193
|
+
- Natural Language: Lowest overhead
|
|
194
|
+
- JSON: Low overhead (compact)
|
|
195
|
+
- YAML: Medium overhead (readable)
|
|
196
|
+
- XML: Higher overhead (verbose but semantic)
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Example Decision Process
|
|
201
|
+
|
|
202
|
+
**Scenario:** "I need to extract product features from customer reviews and output structured data for analysis."
|
|
203
|
+
|
|
204
|
+
**Decision process:**
|
|
205
|
+
1. **Task complexity?** Medium (extraction + structure)
|
|
206
|
+
2. **LLM target?** Multi-LLM (GPT/Claude both possible)
|
|
207
|
+
3. **Accuracy?** Important (business analysis)
|
|
208
|
+
4. **Examples?** Yes, can provide 3-5 review examples
|
|
209
|
+
5. **Output use?** Code parsing (Python analysis script)
|
|
210
|
+
|
|
211
|
+
**Selection:**
|
|
212
|
+
- **Method:** Few-Shot (examples define extraction pattern)
|
|
213
|
+
- **Format:** JSON (code will parse it)
|
|
214
|
+
- **Implementation:** 3-5 examples showing input review → JSON output with feature/sentiment/detail
|
|
215
|
+
|
|
216
|
+
**Result:** Few-Shot + JSON combination optimally balances all requirements.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
**For implementation details of each method, see individual reference files.**
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
# Few-Shot Prompting
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Few-shot prompting provides 2-10 examples in the prompt to guide the LLM's response format, style, and pattern. The model learns from these examples to apply the same pattern to new inputs.
|
|
6
|
+
|
|
7
|
+
## When to Use
|
|
8
|
+
|
|
9
|
+
✅ **Use Few-Shot When:**
|
|
10
|
+
- Need specific formatting or style consistency
|
|
11
|
+
- Task is domain-specific or unusual
|
|
12
|
+
- Examples demonstrate nuances better than instructions
|
|
13
|
+
- You have 2-10 quality examples available
|
|
14
|
+
- Pattern is easier to show than explain
|
|
15
|
+
|
|
16
|
+
❌ **Don't Use Few-Shot When:**
|
|
17
|
+
- Task is simple and well-known (use Zero-Shot)
|
|
18
|
+
- No good examples available
|
|
19
|
+
- Examples would use too many tokens
|
|
20
|
+
- Each input requires unique handling
|
|
21
|
+
|
|
22
|
+
## Best Practices
|
|
23
|
+
|
|
24
|
+
### Example Quality
|
|
25
|
+
✓ Use 2-5 diverse, representative examples (sweet spot)
|
|
26
|
+
✓ Show edge cases in examples
|
|
27
|
+
✓ Maintain consistent format across all examples
|
|
28
|
+
✓ Quality over quantity - better examples > more examples
|
|
29
|
+
✓ Include explanations if pattern is complex
|
|
30
|
+
|
|
31
|
+
✗ Avoid too many examples (diminishing returns after 5-7)
|
|
32
|
+
✗ Don't use contradictory examples
|
|
33
|
+
✗ Avoid examples that don't cover the actual use case
|
|
34
|
+
✗ Don't include wrong or misleading examples
|
|
35
|
+
|
|
36
|
+
### Example Selection
|
|
37
|
+
1. **Coverage:** Examples should cover main variations
|
|
38
|
+
2. **Diversity:** Show different scenarios, not just similar ones
|
|
39
|
+
3. **Clarity:** Each example should be unambiguous
|
|
40
|
+
4. **Relevance:** Examples match the actual task domain
|
|
41
|
+
|
|
42
|
+
## Template Patterns
|
|
43
|
+
|
|
44
|
+
### Pattern 1: Input-Output Pairs (Natural Language)
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
Task: [Clear description]
|
|
48
|
+
|
|
49
|
+
Here are examples of the desired output:
|
|
50
|
+
|
|
51
|
+
Example 1:
|
|
52
|
+
Input: [Example input 1]
|
|
53
|
+
Output: [Example output 1]
|
|
54
|
+
|
|
55
|
+
Example 2:
|
|
56
|
+
Input: [Example input 2]
|
|
57
|
+
Output: [Example output 2]
|
|
58
|
+
|
|
59
|
+
Example 3:
|
|
60
|
+
Input: [Example input 3]
|
|
61
|
+
Output: [Example output 3]
|
|
62
|
+
|
|
63
|
+
Now, apply the same pattern to:
|
|
64
|
+
Input: [Your actual input]
|
|
65
|
+
Output:
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Pattern 2: Structured JSON Format
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"task": "[Task description]",
|
|
73
|
+
"examples": [
|
|
74
|
+
{
|
|
75
|
+
"input": "[Example input 1]",
|
|
76
|
+
"output": "[Example output 1]",
|
|
77
|
+
"explanation": "[Why this output is correct]"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"input": "[Example input 2]",
|
|
81
|
+
"output": "[Example output 2]",
|
|
82
|
+
"explanation": "[Why this output is correct]"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"input": "[Example input 3]",
|
|
86
|
+
"output": "[Example output 3]",
|
|
87
|
+
"explanation": "[Why this output is correct]"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"new_input": "[Your actual input]"
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Pattern 3: XML Format (Claude-Optimized)
|
|
95
|
+
|
|
96
|
+
```xml
|
|
97
|
+
<few_shot_prompt>
|
|
98
|
+
<task>[Task description]</task>
|
|
99
|
+
|
|
100
|
+
<examples>
|
|
101
|
+
<example>
|
|
102
|
+
<input>[Example input 1]</input>
|
|
103
|
+
<output>[Example output 1]</output>
|
|
104
|
+
<note>[Optional explanation]</note>
|
|
105
|
+
</example>
|
|
106
|
+
|
|
107
|
+
<example>
|
|
108
|
+
<input>[Example input 2]</input>
|
|
109
|
+
<output>[Example output 2]</output>
|
|
110
|
+
<note>[Optional explanation]</note>
|
|
111
|
+
</example>
|
|
112
|
+
|
|
113
|
+
<example>
|
|
114
|
+
<input>[Example input 3]</input>
|
|
115
|
+
<output>[Example output 3]</output>
|
|
116
|
+
<note>[Optional explanation]</note>
|
|
117
|
+
</example>
|
|
118
|
+
</examples>
|
|
119
|
+
|
|
120
|
+
<new_input>
|
|
121
|
+
[Your actual input]
|
|
122
|
+
</new_input>
|
|
123
|
+
</few_shot_prompt>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Real-World Examples
|
|
127
|
+
|
|
128
|
+
### Example 1: Product Feature Extraction
|
|
129
|
+
|
|
130
|
+
**Task:** Extract product features from customer reviews in structured format.
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
Task: Extract product features from reviews
|
|
134
|
+
|
|
135
|
+
Example 1:
|
|
136
|
+
Input: "This phone has amazing battery life, lasts 2 days!"
|
|
137
|
+
Output: {"feature": "battery_life", "sentiment": "positive", "detail": "2 days"}
|
|
138
|
+
|
|
139
|
+
Example 2:
|
|
140
|
+
Input: "Camera quality is terrible in low light"
|
|
141
|
+
Output: {"feature": "camera", "sentiment": "negative", "detail": "poor low light"}
|
|
142
|
+
|
|
143
|
+
Example 3:
|
|
144
|
+
Input: "Screen is gorgeous, super bright and colorful"
|
|
145
|
+
Output: {"feature": "screen", "sentiment": "positive", "detail": "bright and colorful"}
|
|
146
|
+
|
|
147
|
+
Now apply to:
|
|
148
|
+
Input: "The speaker volume is disappointing, barely audible outdoors"
|
|
149
|
+
Output:
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Expected:** `{"feature": "speaker", "sentiment": "negative", "detail": "low volume outdoors"}`
|
|
153
|
+
|
|
154
|
+
### Example 2: Email Classification
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
Task: Classify customer emails into categories
|
|
158
|
+
|
|
159
|
+
Example 1:
|
|
160
|
+
Email: "I can't log into my account, password reset doesn't work"
|
|
161
|
+
Category: technical_support
|
|
162
|
+
Priority: high
|
|
163
|
+
Reason: Account access issue
|
|
164
|
+
|
|
165
|
+
Example 2:
|
|
166
|
+
Email: "When will the new product line be available?"
|
|
167
|
+
Category: general_inquiry
|
|
168
|
+
Priority: low
|
|
169
|
+
Reason: Product information request
|
|
170
|
+
|
|
171
|
+
Example 3:
|
|
172
|
+
Email: "I was charged twice for the same order #12345"
|
|
173
|
+
Category: billing_issue
|
|
174
|
+
Priority: high
|
|
175
|
+
Reason: Payment problem
|
|
176
|
+
|
|
177
|
+
Now classify:
|
|
178
|
+
Email: "Can you send me the invoice for last month's subscription?"
|
|
179
|
+
Category:
|
|
180
|
+
Priority:
|
|
181
|
+
Reason:
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Example 3: Code Documentation Style
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
Task: Write Python docstrings following project style
|
|
188
|
+
|
|
189
|
+
Example 1:
|
|
190
|
+
def calculate_total(items, tax_rate):
|
|
191
|
+
"""Calculate total price including tax.
|
|
192
|
+
|
|
193
|
+
Args:
|
|
194
|
+
items (list): List of item prices
|
|
195
|
+
tax_rate (float): Tax rate as decimal (e.g., 0.08 for 8%)
|
|
196
|
+
|
|
197
|
+
Returns:
|
|
198
|
+
float: Total price with tax applied
|
|
199
|
+
|
|
200
|
+
Example:
|
|
201
|
+
>>> calculate_total([10, 20], 0.08)
|
|
202
|
+
32.4
|
|
203
|
+
"""
|
|
204
|
+
|
|
205
|
+
Example 2:
|
|
206
|
+
def validate_email(email):
|
|
207
|
+
"""Check if email address is valid format.
|
|
208
|
+
|
|
209
|
+
Args:
|
|
210
|
+
email (str): Email address to validate
|
|
211
|
+
|
|
212
|
+
Returns:
|
|
213
|
+
bool: True if valid format, False otherwise
|
|
214
|
+
|
|
215
|
+
Example:
|
|
216
|
+
>>> validate_email("user@example.com")
|
|
217
|
+
True
|
|
218
|
+
"""
|
|
219
|
+
|
|
220
|
+
Now document this function:
|
|
221
|
+
def merge_dicts(dict1, dict2, overwrite=True):
|
|
222
|
+
[implementation here]
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Choosing the Right Number of Examples
|
|
226
|
+
|
|
227
|
+
| Number of Examples | Best For | Trade-offs |
|
|
228
|
+
|-------------------|----------|------------|
|
|
229
|
+
| 1 example | Very simple patterns | May not capture variation |
|
|
230
|
+
| 2-3 examples | Most tasks (recommended) | Good balance of clarity vs tokens |
|
|
231
|
+
| 4-5 examples | Complex patterns with variations | Higher token cost |
|
|
232
|
+
| 6-10 examples | Domain-specific or unusual tasks | Diminishing returns, high cost |
|
|
233
|
+
| 10+ examples | Fine-tuning might be better | Token limit issues |
|
|
234
|
+
|
|
235
|
+
**Rule of thumb:** Start with 3 examples. Add more only if output quality is poor.
|
|
236
|
+
|
|
237
|
+
## Common Patterns by Domain
|
|
238
|
+
|
|
239
|
+
### Data Extraction
|
|
240
|
+
```
|
|
241
|
+
Input: [Unstructured text]
|
|
242
|
+
Output: {structured JSON}
|
|
243
|
+
```
|
|
244
|
+
Best with 3-4 examples showing different data types.
|
|
245
|
+
|
|
246
|
+
### Text Transformation
|
|
247
|
+
```
|
|
248
|
+
Input: [Text in one style]
|
|
249
|
+
Output: [Text in another style]
|
|
250
|
+
```
|
|
251
|
+
Best with 2-3 examples showing transformation pattern.
|
|
252
|
+
|
|
253
|
+
### Classification
|
|
254
|
+
```
|
|
255
|
+
Input: [Item to classify]
|
|
256
|
+
Output: Category name + confidence/reasoning
|
|
257
|
+
```
|
|
258
|
+
Best with 3-5 examples covering main categories.
|
|
259
|
+
|
|
260
|
+
### Code Generation
|
|
261
|
+
```
|
|
262
|
+
Input: [Natural language description]
|
|
263
|
+
Output: [Code implementation]
|
|
264
|
+
```
|
|
265
|
+
Best with 2-3 examples showing coding style.
|
|
266
|
+
|
|
267
|
+
## Combining Few-Shot with Other Techniques
|
|
268
|
+
|
|
269
|
+
### Few-Shot + Chain of Thought (Few-Shot CoT)
|
|
270
|
+
|
|
271
|
+
Show examples with reasoning steps:
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
Problem: If 5 apples cost $3, how much do 8 apples cost?
|
|
275
|
+
|
|
276
|
+
Example with reasoning:
|
|
277
|
+
Problem: If 3 oranges cost $2, how much do 7 oranges cost?
|
|
278
|
+
Reasoning:
|
|
279
|
+
Step 1: Cost per orange = $2 ÷ 3 = $0.67
|
|
280
|
+
Step 2: Cost of 7 oranges = $0.67 × 7 = $4.69
|
|
281
|
+
Answer: $4.69
|
|
282
|
+
|
|
283
|
+
Now solve:
|
|
284
|
+
Problem: If 5 apples cost $3, how much do 8 apples cost?
|
|
285
|
+
Reasoning:
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
See [chain-of-thought.md](chain-of-thought.md) for more details.
|
|
289
|
+
|
|
290
|
+
## Common Mistakes & Fixes
|
|
291
|
+
|
|
292
|
+
### ❌ Mistake 1: Too Many Similar Examples
|
|
293
|
+
```
|
|
294
|
+
Example 1: "Great product!" → Positive
|
|
295
|
+
Example 2: "Excellent item!" → Positive
|
|
296
|
+
Example 3: "Amazing purchase!" → Positive
|
|
297
|
+
```
|
|
298
|
+
**Problem:** All examples are too similar, doesn't show variation.
|
|
299
|
+
|
|
300
|
+
✅ **Fix:** Show diverse examples
|
|
301
|
+
```
|
|
302
|
+
Example 1: "Great product!" → Positive
|
|
303
|
+
Example 2: "Terrible quality, broke immediately" → Negative
|
|
304
|
+
Example 3: "It's okay, nothing special" → Neutral
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### ❌ Mistake 2: Inconsistent Format
|
|
308
|
+
```
|
|
309
|
+
Example 1:
|
|
310
|
+
Input: "text here"
|
|
311
|
+
Output: positive
|
|
312
|
+
|
|
313
|
+
Example 2:
|
|
314
|
+
Text: "more text"
|
|
315
|
+
Result: {"sentiment": "negative", "score": 0.8}
|
|
316
|
+
```
|
|
317
|
+
**Problem:** Format changes between examples.
|
|
318
|
+
|
|
319
|
+
✅ **Fix:** Keep consistent format
|
|
320
|
+
```
|
|
321
|
+
Example 1:
|
|
322
|
+
Input: "text here"
|
|
323
|
+
Output: {"sentiment": "positive", "score": 0.9}
|
|
324
|
+
|
|
325
|
+
Example 2:
|
|
326
|
+
Input: "more text"
|
|
327
|
+
Output: {"sentiment": "negative", "score": 0.8}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Quick Reference
|
|
331
|
+
|
|
332
|
+
| Aspect | Recommendation |
|
|
333
|
+
|--------|---------------|
|
|
334
|
+
| **Optimal number** | 2-5 examples |
|
|
335
|
+
| **Format** | Match output use (JSON for APIs, XML for Claude) |
|
|
336
|
+
| **Diversity** | Show main variations and edge cases |
|
|
337
|
+
| **Explanation** | Add if pattern is non-obvious |
|
|
338
|
+
| **Token cost** | ~200-800 tokens (3 examples) |
|
|
339
|
+
| **Best for** | Format consistency, style matching |
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
**Related:**
|
|
344
|
+
- [Zero-Shot Prompting](zero-shot.md) - When you have no examples
|
|
345
|
+
- [Chain of Thought](chain-of-thought.md) - Add reasoning to examples
|
|
346
|
+
- [Decision Matrix](decision_matrix.md) - Choosing Few-Shot vs other methods
|