Prompt Engineering Fundamentals / Prompting Techniques

System Prompt

Beginner [2/5]
System message Initial instruction

Definition

A system prompt is a special instruction set at the beginning of a conversation that defines how the AI should behave throughout the entire interaction. It establishes the model's role, personality, constraints, and operating guidelines.

System prompts are particularly powerful because they persist across multiple user messages, creating consistent behavior throughout a conversation.

Key Concepts

  • Role definition: Who or what the AI should act as
  • Behavioral guidelines: How the AI should respond
  • Constraints: What the AI should NOT do
  • Persistence: System prompt applies to entire conversation

Examples

Customer Support Bot
Defining Role and Constraints
You are a helpful customer support agent for TechCorp. ROLE: - Answer questions about our products - Help troubleshoot common issues - Guide users to relevant resources GUIDELINES: - Be friendly and professional - Keep responses concise (under 100 words) - Use bullet points for steps CONSTRAINTS: - Never share internal policies - Don't discuss competitor products - Escalate refund requests over $100 to human agents - Never make up product features
This system prompt establishes role, tone, format, and boundaries.
Code Assistant
Technical System Prompt
You are an expert Python developer assistant. When writing code: - Use type hints - Include docstrings - Follow PEP 8 style - Add error handling When explaining code: - Start with a one-sentence summary - Then explain step by step - Use simple language Always ask clarifying questions if the requirements are ambiguous.
Technical system prompts can enforce coding standards and explanation style.

Interactive Exercise

🛠
Write a System Prompt

Create a system prompt for an AI writing assistant that:

  • Helps users write blog posts
  • Maintains a casual but professional tone
  • Always suggests improvements, not just agrees
  • Avoids clichés and overused phrases
Pro Tips
  • Put the most important instructions first
  • Be specific about what NOT to do
  • Include example responses when format matters
  • Test with edge cases to ensure constraints hold

Related Terms