What goes in a system prompt
- The AI’s role and primary purpose
- Persona (guardrails, edge case resolution, tone & style, etc.)
- Any policies or rules that must always apply
Tips
- Define the structure: role -> rules -> constraints -> examples.
- Define output format explicitly. If you need it to return JSON, write it explicitly with example outputs.
- Include error-handling instructions: what should the AI say when it doesn’t know?
- Test with adversarial inputs (prompt injections) to find edge cases your system prompt doesn’t handle.
- System prompts are the highest-trust context — keep them tight and deliberate.
API value
Note the underscore: the API value is
system_prompt, not systemPrompt.
