Core Principles
Be Specific
Tell the model exactly what you want, step by step
Show, Don't Tell
Include examples of desired output
Constrain Output
Specify exact format, length, and structure
Handle Edge Cases
Tell the model what to do when things go wrong
Prompt Structure
A well-structured prompt typically includes:Techniques
Few-Shot Learning
Provide examples to show the model what you want:Chain of Thought
Ask the model to reason step-by-step:Role Assignment
Give the model a specific persona:Negative Instructions
Tell the model what NOT to do:JSON Output Patterns
Explicit Structure
Error Handling in Output
Common Patterns
Classification
Extraction
Generation with Constraints
Transformation
Temperature Guidelines
Testing Your Prompts
Run Multiple Times
Test the same input 5-10 times to check consistency:- With temperature 0, outputs should be nearly identical
- Higher temperatures should vary within acceptable bounds
Test Edge Cases
Always test with:- Empty optional fields
- Very long inputs
- Unusual characters (emoji, unicode)
- Inputs in different languages
- Adversarial inputs (attempts to break the prompt)
Compare Models
Test with different models to find the best balance of:- Quality
- Speed
- Cost
Common Mistakes
Vague instructions
Vague instructions
❌ “Summarize the text”
✅ “Write a 3-sentence summary covering the main argument, key evidence, and conclusion”
No output format
No output format
❌ “Analyze the sentiment”
✅
Return JSON: {"sentiment": "positive"|"negative"|"neutral", "score": 0-1}Missing edge cases
Missing edge cases
❌ “Extract the email address”
✅
Extract the email address. If none found, return {"email": null}Too many instructions
Too many instructions
❌ 50 bullet points of instructions
✅ Clear, numbered steps with examples
Next Steps
Use Cases
See real-world prompt examples
Liquid Templating
Make prompts dynamic

