System Prompts
Gen AI · Prompt Engineering
Theory
A system prompt is a set of instructions the application sends at the start of every request, separate from the user's messages. It sets the assistant's role ("You are the support assistant for a course website"), tone, scope, rules for tricky cases and any required output format. Users usually never see it, but the model treats it as higher-priority guidance for the whole conversation.
Because it applies to every turn, the system prompt is what makes an AI product behave consistently across users. Keep it clear and free of contradictions, test it like code, and version it when it changes. It is not a security boundary: users can often get a model to reveal or ignore parts of it, so never put secrets in it, and enforce real permissions in your code.
Why we use it
Without it you would repeat the same role, rules and format in every user message. One stable system prompt gives every user the same scope, tone and safety rules automatically.
When to use it
Use one in every app or assistant you build. Put stable rules there and per-request data (retrieved documents, the user's question) in the messages. Do not rely on it alone for access control or to hide confidential logic.
How it works
- Developer writes the system prompt once
- App adds the system prompt to every request
- User message and history are appended after it
- Model reads the system prompt first and follows its rules
- Is the request out of scope? Yes: Politely redirect as instructed. No: Answer in the required format.
- Consistent behaviour across all users
Example
System prompt:
"You are TechTown Support Bot. Only answer questions about TechTown courses (SQL, Python, DSA, Power BI, Snowflake, Databricks and Gen AI) and practice problems. If asked anything else, politely redirect the user to techtown.in/contact. Always respond in under 80 words."Key points
- Typically holds role, tone, scope, guardrails and output-format rules
- Applies to every turn of the conversation unless the app changes it
- A stable, tested system prompt makes behaviour predictable
- Not a secret: assume users can extract it, so no credentials inside
- Enforce permissions in code, not just in prompt wording