Back to Glossary
Prompting

System Prompt Best Practices

Definition

System prompt best practices are guidelines for writing effective system-level instructions that define an LLM's behavior, persona, constraints, and output format for consistent, high-quality responses.

Why It Matters

The system prompt is the foundation of your AI application’s behavior. A well-crafted system prompt ensures consistent outputs, appropriate tone, proper handling of edge cases, and safe responses. Poor system prompts lead to unpredictable behavior and user frustration.

Key Best Practices

Structure:

  • Start with role/identity definition
  • Specify core behaviors and constraints
  • Define output format requirements
  • Include error handling instructions
  • Add safety guardrails

Writing Style:

  • Be explicit rather than implicit
  • Use positive instructions (“do X”) over prohibitions
  • Order instructions by priority
  • Include examples for complex formats

Common Patterns

You are [role] that helps users with [task].

Core behaviors:
- Always [key behavior]
- Never [prohibited behavior]

Output format:
- [Format requirements]

If unsure, [fallback behavior].

Test your system prompt with edge cases and adversarial inputs before production deployment.