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

  1. Developer writes the system prompt once
  2. App adds the system prompt to every request
  3. User message and history are appended after it
  4. Model reads the system prompt first and follows its rules
  5. Is the request out of scope? Yes: Politely redirect as instructed. No: Answer in the required format.
  6. 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

Gen AI topics

Foundations of Generative AI

Prompt Engineering

Retrieval & Embeddings

Customizing Model Behavior

AI Agents & Tool Use

Multimodal & Applied AI

Ethics, Cost & Careers

T
Tech Town
Log InSign Up Free
Home SQL Python DSA Power BI Snowflake Databricks Spark Gen AI Practice Problems Contest Blog

Generative AI for the Data Stack

LLMs, prompt engineering, RAG, embeddings, agents and the tools shaping modern AI products — explained practically. Click any topic in the sidebar to open it right here.

{{ sectionCount }}
Sections
{{ topicCount }}
Topics
Free
Forever
Section {{ sec.num }}

{{ sec.label }}

Gen AI  /  {{ current.sectionLabel }}  /  {{ current.name }}

{{ current.name }}

💡

{{ current.tldr }}

Explained

{{ para }}

Why we use it

{{ rich.why }}

When to use it

{{ rich.when }}

Diagram

{{ rich.dg.caption }}

{{ tb.title }}
{{ c.v }}
{{ rich.dg.op }}
➜
{{ rich.dg.output.title }}
{{ c.v }}
{{ nd.label }}
{{ nd.sub }}
{{ nd.label }}
{{ nd.sub }}
{{ rich.dg.left.title }}
{{ it }}
{{ rich.dg.right.title }}
{{ it }}
Flowchart — how it works
{{ nd.text }}
{{ nd.text }}
◇ {{ nd.text }}
Yes → {{ nd.yes }}
No → {{ nd.no }}
See It In Action
{{ current.example }}
Key Takeaways — click to check off
{{ pt.mark }} {{ pt.text }}

Share this topic