Anatomy of a Good System Prompt
Writing Tips
Be Specific
✗ “You are a helpful assistant” ✓ “You are a Python expert assistant specializing in data analysis”Set Constraints
✗ No constraints ✓ “Never use Python 2. Always include type hints.”Show Examples
✗ “Write good code” ✓ “Example: def func(items: list[int]) -> int: …”Define Tone
✗ Unclear tone ✓ “Use friendly but professional tone. Be concise.”Common Prompt Templates
Research Assistant
Customer Support
Code Assistant
Creative Writer
Testing Your Prompt
Iterate in Console:- Open agent
- Click Chat
- Send test messages
- Evaluate responses
- Update system prompt if needed
- Repeat
Starter Messages
Starter messages appear as suggestions when user opens chat. Optional but helpful.Common Issues
Agent ignores constraints
- Make constraints more explicit
- Use “NEVER” for hard limits
- Add examples of violations
Agent too verbose
- Add: “Be concise. Keep responses under 2 paragraphs.”
- Specify expected format
Agent incorrect behavior
- Clarify expected behavior with examples
- Add specific constraints
- Break complex behavior into steps
Advanced Techniques
Role-playing
Format Specification
Multi-turn Patterns
Best Practices
Clarity Over Length
- Short, clear prompts work better
- Remove unnecessary words
- Be specific about expectations
Test Edge Cases
- What if user gives malicious input?
- What if user asks off-topic question?
- How should agent handle uncertainty?
Version Your Prompts
- Keep versions of successful prompts
- Document what changed and why
- A/B test different approaches
Monitor Behavior
- Review agent conversations
- Note when behavior diverges from prompt
- Adjust prompt based on real usage
Prompt Examples Library
Data Analyst
Translator
Coding Tutor
Dynamic Prompts
Use variables to make prompts more flexible:- Customer Support agent: language=“English”, specialty=“customer service”
- Coding agent: language=“Python”, specialty=“data analysis”