Core Principles
- Be Clear & Detailed - Treat Claude like a new intern; explicit instructions always win
- Show Your Work - Use scratchpads/thinking tags (hidden from users but improves accuracy)
- Structure Everything - XML tags are your friend (Claude was trained on them)
- Test & Iterate - Scientific approach: test prompts repeatedly, refine constantly
Key Techniques
Few-Shot Prompting
- Provide realistic examples of input → ideal output
- Show 2-5 examples before your actual task
- Use concrete, specific examples (not generic ones)
Chain-of-Thought
- Add "Think step by step" after instructions
- Use
<thinking> tags to show reasoning
- Breaks complex tasks into manageable steps
XML Formatting
<instructions>Your task here</instructions>
<examples>Your examples</examples>
<input>Actual content</input>
- Clear separation of prompt sections
- Trained specifically for this format
Role Assignment
- "You are an expert [X]..." at the start
- Sets context and tone
- Helps shape response style
System Prompt Structure
-
Role/Persona - Who is Claude?
-
Task Description - What should it do?
-
Context - Background information
-
Examples - Show don't tell
-
Instructions - Step-by-step guidance
-
Output Format - Specify format needed
Production Best Practices
✅ DO:
- Use scratchpads for complex reasoning
- Provide grounding data (RAG)
- Give clear success criteria
- Repeat critical instructions
- Version and A/B test prompts
❌ DON'T:
- Use vague instructions
- Skip examples for complex tasks
- Forget to specify output format
- Leave edge cases undefined
Collaboration Model
Prompt Engineers + Subject Matter Experts = Best Results
- Engineers handle structure/optimization
- SMEs provide domain knowledge/examples
- Iterate together until success criteria met
Quick Wins
- Add "Think step by step in
<thinking> tags"
- Provide 3 concrete examples
- Use XML to structure your prompt
- Specify exact output format wanted
- Give Claude a relevant role/persona