Guide

What is a System Prompt?

Instructions that define LLM behavior and personality.

A system prompt is a set of instructions given to an LLM that defines its role, behavior, constraints, and output format. It's separate from user messages and persists across the conversation.

System Prompt Components

  • Role: Who the AI is (e.g., "You are a helpful assistant")
  • Constraints: What it should/shouldn't do
  • Format: How to structure responses
  • Context: Background information

Best Practices

  • Be specific and explicit
  • Include safety constraints
  • Define output format clearly
  • Test with adversarial inputs

Can users override system prompts?

Prompt injection attacks attempt this. Use input validation, output monitoring, and guardrails to protect system prompt integrity.

Detect prompt injection attacks

Start Free