AI / LLM
prompt-engineering
Systematic prompt engineering: structured prompt design, few-shot examples, chain-of-thought, and output format control.
Install
clawhub install prompt-engineering
Cross-tool: Claude Code ~/.claude/skills/ · Qoder ~/.qoder/skills/ · TRAE ~/.trae/skills/
When to Use
Trigger this skill when designing high-quality prompts for LLMs, optimizing existing prompts, or building prompt template systems.
Core Methods
Prompt Structure
[Role] You are a {domain} expert
[Context] {background information}
[Task] {specific instruction}
[Constraints] {format/length/style requirements}
[Examples] {input → output pairs}
[Output Format] {JSON / Markdown / custom template}
Few-shot Examples
- 2-5 examples optimal, too many causes interference
- Cover edge cases, not just simple scenarios
- Consistent output format is more effective than diverse examples
Chain-of-Thought (CoT)
- Add “Let’s think step by step” or explicitly request step-by-step reasoning
- Break complex tasks into sub-problems, reason sequentially
- Require analysis before conclusion to reduce hallucination
Output Control
- Strict format: use JSON Schema constraints
- Multi-step tasks: ReAct pattern (Reason → Act → Observe)
- Add “If uncertain, say ‘I am not sure’” to reduce fabrication