Home / Glossary / System Prompt
System Prompt
A system prompt is a set of instructions provided to an AI model before the user's message that defines the model's behavior, persona, constraints, and capabilities. It acts as a configuration layer that shapes every response the model produces, without the user needing to repeat these instructions in each message.
How system prompts shape AI behavior
When you interact with an AI model, there are typically three roles in the conversation: system, user, and assistant. The system prompt is set by the application developer and defines ground rules—what the model should do, how it should respond, what it should refuse, and what persona it should adopt. For AI coding tools, the system prompt configures the model to be a coding assistant: it defines available tools, sets code quality standards, and establishes output formats.
System prompts in AI coding tools
Tools like Claude Code use extensive system prompts to define the agent's capabilities. The system prompt tells the model about available tools (Read, Edit, Bash), project context, permission rules, and behavioral guidelines. Your CLAUDE.md file is effectively an extension of the system prompt—project-specific instructions that get prepended to every conversation. This is why CLAUDE.md is so powerful: it directly influences the model's behavior at the system prompt level.
// Example: system prompt for a code review assistant
const systemPrompt = `You are a senior code reviewer.
Review code changes for:
- Security vulnerabilities (SQL injection, XSS, CSRF)
- Error handling (missing try/catch, unhandled promises)
- Performance (N+1 queries, unnecessary re-renders)
- Style (naming conventions, code organization)
Format each issue as:
[SEVERITY] file:line - description
Severity levels: CRITICAL, WARNING, SUGGESTION
Do not flag stylistic preferences unless they affect readability.
Always explain WHY something is an issue, not just WHAT.`;
const response = await anthropic.messages.create({
model: "claude-sonnet-4-20250514",
system: systemPrompt,
messages: [{ role: "user", content: codeDiff }]
});CLAUDE.md is essentially a user-editable system prompt extension. The instructions you put in CLAUDE.md get the same priority as system-level instructions, which is why they are so effective at controlling agent behavior.
Can users see the system prompt?+
How long should a system prompt be?+
What is the difference between a system prompt and CLAUDE.md?+
Related comparisons
Master Claude Code in days, not months
37 hands-on lessons from beginner to CI/CD automation. Module 1 is free.
START FREE →