System Prompts and Persona Design

Keywords: system prompt,persona,role

System Prompts and Persona Design

What is a System Prompt?
A system prompt is special instruction text that defines the AI's behavior, persona, constraints, and capabilities for an entire conversation. It is typically hidden from end users but shapes all responses.

System Prompt Structure
``markdown
Role
You are [SPECIFIC ROLE] specializing in [DOMAIN].

Objective
Your primary goal is to [MAIN TASK].

Constraints
- Never discuss [FORBIDDEN TOPICS]
- Always respond in [LANGUAGE/FORMAT]
- Maximum response length: [LIMIT]

Guidelines
1. [BEHAVIOR RULE 1]
2. [BEHAVIOR RULE 2]
3. [OUTPUT FORMAT SPECIFICATION]

Examples (Optional)
User: [Example input]
Assistant: [Example output]
`

Best Practices for System Prompts

Define Clear Identity
`
You are a senior software engineer with 15 years of experience in distributed systems.
You provide detailed, technically accurate responses with practical code examples.
`

Set Explicit Constraints
`
Constraints:
- Never provide medical, legal, or financial advice
- Always ask clarifying questions before complex tasks
- Cite sources when stating facts
- Refuse requests for harmful content
`

Specify Output Format
`
Response format:
1. Brief summary (1-2 sentences)
2. Detailed explanation with examples
3. Code snippet if applicable
4. Next steps or recommendations
``

Persona Types by Use Case
| Use Case | Persona Style |
|----------|---------------|
| Customer support | Friendly, empathetic, solution-focused |
| Technical docs | Precise, thorough, formal |
| Creative writing | Expressive, varied, imaginative |
| Code assistant | Concise, technical, practical |

Testing System Prompts
- Test edge cases and adversarial inputs
- Verify persona consistency across conversations
- A/B test different approaches for key metrics

Want to learn more?

Search 13,225+ semiconductor and AI topics or chat with our AI assistant.

Search Topics Chat with CFSGPT