System Messages
The system message defines who the LLM is and how it behaves. Be specific. Vague (bad):Constraints Matter
Explicit constraints prevent the most common failure modes:Temperature Settings
Temperature controls randomness. Match it to your task:| Temperature | Use Case | Example |
|---|---|---|
0 | Judges, extraction, classification | Evaluator prompts, extracting entities, classifying leads |
0.3 | Analysis, summarization | Company research summaries, content analysis |
0.7 | General tasks, balanced creativity | Drafting emails, writing descriptions |
1.0+ | Brainstorming, creative writing | Generating variations, ideation |
judge_summary@v1.prompt
Structured Output
When you need to parse the result programmatically, usegenerateText with Output.object() and a Zod schema instead of asking for JSON in the prompt.
Unreliable (parsing JSON from text):
Keep Schemas Simple
Complex nested schemas confuse models. If your schema has more than 5-6 fields or deep nesting, split it into multiple calls. Too complex:Few-Shot Examples
Show the LLM what you want with 2-3 examples. This works better than lengthy instructions.- Classification tasks
- Formatting requirements
- Edge case handling
- Tone matching
Common Mistakes
1. No Role Definition
2. Unbounded Creativity
3. Asking for Everything at Once
Writing Style Guidelines
For prompts that generate customer-facing content, define explicit style rules:Output Shape Selection
Match theOutput.* helper to your output shape:
| Need | Output Helper | Example |
|---|---|---|
| Free-form text | (none) | Summaries, emails, explanations |
| Typed object | Output.object({ schema }) | Extracted data, evaluator judgments |
| List of items | Output.array({ element }) | Contacts, competitors, action items |
| One of N choices | Output.choice({ options }) | Lead classification, sentiment |
Further Reading
- Anthropic’s prompt engineering guide
- LLM-as-a-Judge Best Practices — Writing effective judge prompts specifically