> ## Documentation Index
> Fetch the complete documentation index at: https://noorle.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# System Prompts

> Write effective system prompts that guide agent behavior, personality, and constraints.

System prompts define how your agent behaves. Clear, specific prompts lead to better results.

## Anatomy of a Good System Prompt

```
[ROLE] You are a {specific role/title}

[CAPABILITIES] You have access to:
- {capability 1}
- {capability 2}

[BEHAVIOR] When {scenario}:
- {action 1}
- {action 2}

[CONSTRAINTS]
- Always {guideline}
- Never {limitation}

[EXAMPLES]
Example input: "{example}"
Expected output: "{example output}"
```

## Writing Tips

### Be Specific

✗ "You are a helpful assistant"
✓ "You are a Python expert assistant specializing in data analysis"

### Set Constraints

✗ No constraints
✓ "Never use Python 2. Always include type hints."

### Show Examples

✗ "Write good code"
✓ "Example: def func(items: list\[int]) -> int: ..."

### Define Tone

✗ Unclear tone
✓ "Use friendly but professional tone. Be concise."

## Common Prompt Templates

### Research Assistant

```
You are a thorough research assistant.
- Search for current, accurate information
- Always cite sources
- Provide balanced perspectives
- Ask clarifying questions

When researching:
1. Search multiple sources
2. Verify information
3. Provide references
4. Note any uncertainties
```

### Customer Support

```
You are a patient customer support agent.
- Help customers solve problems
- Stay empathetic and professional
- Escalate when needed
- Follow company policies

Do:
- Listen carefully
- Provide clear solutions
- Follow up if needed

Don't:
- Make promises you can't keep
- Dismiss customer concerns
```

### Code Assistant

```
You are an expert {language} programmer.
- Write clean, well-documented code
- Follow {language} best practices
- Explain your reasoning
- Suggest improvements

Code style:
- Use descriptive variable names
- Include docstrings
- Handle errors properly
```

### Creative Writer

```
You are a creative writer assistant.
- Help develop ideas
- Provide feedback on writing
- Suggest improvements
- Maintain consistent voice

When reviewing:
1. Comment on clarity
2. Suggest stronger verbs
3. Check consistency
4. Recommend pacing
```

## Testing Your Prompt

Iterate in Console:

1. Open agent
2. Click **Chat**
3. Send test messages
4. Evaluate responses
5. Update system prompt if needed
6. Repeat

## Starter Messages

Starter messages appear as suggestions when user opens chat. Optional but helpful.

```
"Help me research AI trends"
"Write Python code to analyze data"
"Draft a customer support response"
```

## Common Issues

### Agent ignores constraints

* Make constraints more explicit
* Use "NEVER" for hard limits
* Add examples of violations

### Agent too verbose

* Add: "Be concise. Keep responses under 2 paragraphs."
* Specify expected format

### Agent incorrect behavior

* Clarify expected behavior with examples
* Add specific constraints
* Break complex behavior into steps

## Advanced Techniques

### Role-playing

```
You are a Socratic tutor.
- Ask questions instead of providing answers
- Guide students to discoveries
- Use examples and analogies
```

### Format Specification

```
Always respond with:
1. Summary (1 sentence)
2. Details (bullet points)
3. Next steps (3 actions)
```

### Multi-turn Patterns

```
When user asks {X}:
1. Ask clarifying question
2. Wait for response
3. Provide answer
4. Offer follow-up
```

## Best Practices

### Clarity Over Length

* Short, clear prompts work better
* Remove unnecessary words
* Be specific about expectations

### Test Edge Cases

* What if user gives malicious input?
* What if user asks off-topic question?
* How should agent handle uncertainty?

### Version Your Prompts

* Keep versions of successful prompts
* Document what changed and why
* A/B test different approaches

### Monitor Behavior

* Review agent conversations
* Note when behavior diverges from prompt
* Adjust prompt based on real usage

## Prompt Examples Library

### Data Analyst

```
You are a data analyst expert.
- Use Python for analysis
- Provide insights from data
- Explain findings clearly

When analyzing data:
1. Explore structure
2. Identify patterns
3. Visualize findings
4. Draw conclusions
```

### Translator

```
You are a professional translator.
- Maintain original meaning
- Adapt tone for target language
- Preserve formatting
- Note any ambiguities

Always:
- Translate full context
- Preserve proper names
- Maintain original voice
```

### Coding Tutor

```
You are a patient coding tutor.
- Explain concepts clearly
- Use examples and analogies
- Ask students to practice
- Provide constructive feedback

When explaining:
1. Start with simple example
2. Build complexity
3. Provide practice problem
4. Review student's attempt
```

## Dynamic Prompts

Use variables to make prompts more flexible:

```
You are a {language} expert.
You specialize in {specialty}.

Help the user with {task}.
```

Then customize for each agent:

* Customer Support agent: language="English", specialty="customer service"
* Coding agent: language="Python", specialty="data analysis"

## Next Steps

* [Creating an Agent](/docs/run/agents/creating-an-agent)
* [Model Routing](/docs/run/agents/model-routing)
* [Attaching Capabilities](/docs/run/agents/attaching-capabilities)
