How do I write a good system prompt?
A good system prompt states the assistant's role, what it should and should not do, its tone, the output format, and what to do when it is unsure. Write it like instructions for a capable new colleague.
A simple structure:
- Role and audience
- Scope: what is in and out
- Style: tone and length
- Rules, with short reasons
- Format: headings, fields or JSON
- Fallbacks: ask a question, say "I don't know", or point to a human
Add one or two example exchanges. Then test with 10 to 20 inputs, including awkward and off-topic ones, and edit in small steps. Do not put secrets in it, and enforce critical limits in your code, since a prompt is guidance, not security. See our guide on writing system prompts for a template.
Related answers
Are AI-written phishing emails harder to spot, and what should I look for now?
Yes, AI can write clean, convincing phishing emails without the spelling mistakes people used to rely on, so judge the request and the sender, not the grammar.
privacy-safety
Can AI analyze my Excel or CSV data and can I trust the results?
Often yes, especially with assistants that can run code on uploaded files, but you should verify the results.
accuracy
Can an AI assistant be tricked by hidden instructions in emails or web pages?
Yes. If an assistant reads emails, web pages or documents, hidden text in them can try to give it new instructions, which is called prompt injection.
privacy-safety