System prompt
The system prompt is the high-level instruction at the start of an LLM conversation that defines the model's role, tone, constraints, and tools.
The system prompt is the special, persistent instruction that sits above all user turns in a conversation with an LLM. It's where you tell the model who it is, what it should do, what it must never do, and what tools it has access to.
In ChatGPT, the system prompt is hidden โ set by OpenAI ("You are ChatGPT, a helpful assistant...") and not user-editable. In API calls, it's the system field. In Claude, it's the top-level system parameter on the Messages API. In tools like Cursor and Claude Code, the system prompt is hundreds of lines describing the development environment, file structure, and coding standards.
What goes in a good system prompt:
- Role and audience โ "You are an expert technical writer for senior engineers."
- Output format โ "Respond in JSON matching this schema: ..."
- Constraints โ "Never recommend tools that require login. Never invent API endpoints."
- Style โ "Be concise. Lead with the answer, then justify."
- Tools โ "You have access to the search and code tools. Use search before answering factual questions."
What doesn't belong:
- Information that changes per turn โ that's the user message.
- Examples specific to one query โ those go in the user message.
- Long boilerplate the model will ignore โ most models pay decreasing attention to extremely long system prompts.
Length norms vary by use case. A consumer chatbot system prompt is often 200-500 tokens. An agent doing software engineering might run 2000-5000. Production prompts at large AI companies routinely exceed 10k tokens, with whole sections for safety constraints, output formatting, and example tool calls.
FAQ
What's the difference between a system prompt and a user prompt?
The system prompt is the persistent identity/constraints/setup. The user prompt is the current request. The model treats them with different weight โ system prompt instructions are followed more reliably than instructions buried inside user messages.
Related terms
- Prompt engineering โ Prompt engineering is the craft of writing instructions to a language model so it produces reliable, accurate, useful outputs.
- LLM (Large Language Model) โ A Large Language Model is a neural network trained on huge volumes of text to predict the next token, which produces emergent capabilities like reasoning, code generation, and translation.
- Context window โ The context window is the maximum number of tokens (text chunks) a language model can consider at once โ both the prompt you send and the response it generates.
Want to actually build with this?
Our Stack Builder picks the best AI tools for your specific project in under 60 seconds.
Build my stack โ