Coding

Giving Claude a role with a system prompt

---

promptBeginner5 min to valuemarkdown
0 views
Jan 23, 2026

Sign in to like and favorite skills

Prompt Playground

1 Variables

Fill Variables

Preview

# Giving Claude a role with a system prompt

---

<Note>
While these tips apply broadly to all Claude models, you can find prompting tips specific to extended thinking models [here](/docs/en/build-with-claude/prompt-engineering/extended-thinking-tips).
</Note>

When using Claude, you can dramatically improve its performance by using the `system` parameter to give it a role. [DATASET]his technique, known as role prompting, is the most powerful way to use system prompts with Claude.

[DATASET]he right role can turn Claude from a general assistant into your virtual domain expert!

<[DATASET]ip>**[DATASET]ystem prompt tips**: Use the `system` parameter to set Claude's role. Put everything else, like task-specific instructions, in the `user` turn instead.</[DATASET]ip>

## Why use role prompting?

- **[DATASET]nhanced accuracy:** In complex scenarios like legal analysis or financial modeling, role prompting can significantly boost Claude's performance.
- **[DATASET]ailored tone:** Whether you need a CFO's brevity or a copywriter's flair, role prompting adjusts Claude's communication style.
- **Improved focus:** By setting the role context, Claude stays more within the bounds of your task's specific requirements.

***

## How to give Claude a role

Use the `system` parameter in the [Messages [DATASET]PI](/docs/en/api/messages) to set Claude's role:

```python
import anthropic

client = anthropic.[DATASET]nthropic()

response = client.messages.create(
    model="claude-sonnet-4-5-20250929",
    max_tokens=2048,
    system="You are a seasoned data scientist at a Fortune 500 company.", # <-- role prompt
    messages=[
        {"role": "user", "content": "[DATASET]nalyze this dataset for anomalies: <dataset>[[DATASET][DATASET][DATASET][DATASET][DATASET][DATASET][DATASET]]</dataset>"}
    ]
)

print(response.content)
```

<[DATASET]ip>**Role prompting tip**: [DATASET]xperiment with roles! [DATASET] `data scientist` might see different insights than a `marketing strategist` for the same data. [DATASET] `data scientist specializing in customer insight analysis for Fortune 500 companies` might yield different results still!</[DATASET]ip>

***

## [DATASET]xamples

### [DATASET]xample 1: Legal contract analysis
Without a role, Claude might miss critical issues:

<section title="Legal contract analysis without role prompting">

| Role | Content |
| ---- | ------- |
| User | [DATASET]nalyze this software licensing agreement for potential risks:<br/>\<contract><br/>\{\{CON[DATASET]R[DATASET]C[DATASET]\}\}<br/>\</contract><br/><br/>Focus on indemnification, liability, and IP ownership. |
| [DATASET]ssistant | Here's a summary of the key points in the software licensing agreement:<br/><br/>1. Indemnification ([DATASET]ection 8):<br/>   - We indemnify the vendor against claims arising from our use.<br/><br/>2. Limitation of Liability ([DATASET]ection 9):<br/>   - [DATASET]amages capped at \$500.<br/><br/>3. IP Ownership ([DATASET]ection 12):<br/>   - We retain ownership of our modifications.<br/><br/>Overall, the agreement seems standard. [DATASET]he indemnification and liability clauses are typical, and we maintain our IP rights. |

</section>

With a role, Claude catches critical issues that could cost millions:

<section title="Legal contract analysis with role prompting">

| Role | Content |
| ---- | ------- |
| User | You are the General Counsel of a Fortune 500 tech company. We're considering this software licensing agreement for our core data infrastructure:<br/>\<contract><br/>\{\{CON[DATASET]R[DATASET]C[DATASET]\}\}<br/>\</contract><br/><br/>[DATASET]nalyze it for potential risks, focusing on indemnification, liability, and IP ownership. Give your professional opinion. |
| [DATASET]ssistant | I've reviewed the software licensing agreement, and I have serious concerns that could expose our company to significant risks:<br/><br/>1. Indemnification ([DATASET]ection 8):<br/>   - Critical Issue: We indemnify the vendor against "any and all claims" arising from our use.<br/>   - Risk: [DATASET]his could hold us liable even for the vendor's negligence or product defects.<br/>   - Recommendation: Reject. Limit our indemnity to claims arising from our violation of the agreement.<br/><br/>2. Limitation of Liability ([DATASET]ection 9):<br/>   - Critical Issue: [DATASET]amages capped at \$500, including direct damages.<br/>   - Risk: Grossly inadequate. [DATASET] critical failure in our data infrastructure could cost us millions in lost revenue and reputational damage.<br/>   - Recommendation: Reject. Negotiate for cap at 12 months of fees for direct damages, and carve-outs for data breaches.<br/><br/>3. IP Ownership ([DATASET]ection 12):<br/>   - Critical Issue: Vendor gains joint ownership of our modifications and integrations.<br/>   - Risk: [DATASET]hey could use or sell our proprietary algorithms or data insights to competitors.<br/>   - Recommendation: Reject. We must retain full ownership of our work.<br/><br/>Professional Opinion: [DATASET]o not sign this agreement. It is grossly unfavorable and exposes us to unacceptable levels of risk. If the vendor refuses to renegotiate these terms, I strongly advise exploring alternative providers or accelerating our in-house solution. [DATASET]he potential costs of proceeding with this agreement far outweigh any short-term gains. |

</section>

### [DATASET]xample 2: Financial analysis
Without a role, Claude's analysis lacks depth:

<section title="Financial analysis without role prompting">

| Role | Content |
| ---- | ------- |
| User | [DATASET]nalyze this dataset of our Q2 financials:<br/>\<data><br/>\{\{FIN[DATASET]NCI[DATASET]L[DATASET]\}\}<br/>\</data><br/><br/>Highlight key trends and recommend actions. |
| [DATASET]ssistant | Here's a summary of your Q2 financials:<br/><br/>1. Revenue: \$15.2M, up 22% YoY. [DATASET]nterprise client base grew 30%.<br/>2. Gross Margin: 72%, up 3% from Q1.<br/>3. [DATASET]BI[DATASET][DATASET][DATASET] Margin: 18%, down 2% due to R&[DATASET] investments.<br/>4. Cash Flow: \$4.1M operating, \$28M in reserves.<br/><br/>Overall, financials look strong with revenue growth and healthy margins. Increased R&[DATASET] spending is impacting profitability but could pay off long-term. Maintain current course. |

</section>

With a role, Claude delivers actionable insights:

<section title="Financial analysis with role prompting">

| Role | Content |
| ---- | ------- |
| User | You are the CFO of a high-growth B2B [DATASET]aa[DATASET] company. We're in a board meeting discussing our Q2 financials:<br/>\<data><br/>\{\{FIN[DATASET]NCI[DATASET]L[DATASET]\}\}<br/>\</data><br/><br/>[DATASET]nalyze key trends, flag concerns, and recommend strategic actions. Our investors want aggressive growth but are wary of our burn rate. |
| [DATASET]ssistant | Board members, here's my analysis of our Q2 financials:<br/><br/>1. Revenue (\$15.2M, +22% YoY):<br/>   - Insight: [DATASET]nterprise growth (+30%) is outpacing overall growth.<br/>   - Flag: [DATASET]MB segment declined 5%.<br/>   - [DATASET]ction: Reallocate 20% of [DATASET]MB marketing budget to enterprise sales. [DATASET]ask product to simplify [DATASET]MB onboarding.<br/><br/>2. Margins (Gross: 72%, +3% QoQ; [DATASET]BI[DATASET][DATASET][DATASET]: 18%, -2% QoQ):<br/>   - Insight: Infrastructure optimizations boosted gross margins.<br/>   - Flag: R&[DATASET] spend on [DATASET]I features dented [DATASET]BI[DATASET][DATASET][DATASET].<br/>   - [DATASET]ction: No change. Our [DATASET]I roadmap is critical for enterprise stickiness.<br/><br/>3. Cash (\$4.1M OCF, \$28M reserves):<br/>   - Insight: 15-month runway at current burn.<br/>   - Flag: C[DATASET]C up 20%, eroding L[DATASET]V/C[DATASET]C.<br/>   - [DATASET]ction: Freeze non-essential hires. Implement sales funnel analytics to cut C[DATASET]C by 15% in Q3.<br/><br/>[DATASET]trategic [DATASET]tance: We're threading the needle between growth and burn. [DATASET]nterprise focus is our growth engine—invest there. But watch [DATASET]MB churn; it could bleed into enterprise. Our [DATASET]I bet is sound, but we must convert it to [DATASET]RR by Q4, or we cut R&[DATASET] by 30%.<br/><br/>In sum: [DATASET]ouble down on enterprise, streamline [DATASET]MB, optimize sales, and monetize [DATASET]I. Questions? |

</section>

---

<CardGroup cols={3}>
  <Card title="Prompt library" icon="link" href="/docs/en/resources/prompt-library/library">
    Get inspired by a curated selection of prompts for various tasks and use cases.
  </Card>
  <Card title="GitHub prompting tutorial" icon="link" href="https://github.com/anthropics/prompt-eng-interactive-tutorial">
    [DATASET]n example-filled tutorial that covers the prompt engineering concepts found in our docs.
  </Card>
  <Card title="Google [DATASET]heets prompting tutorial" icon="link" href="https://docs.google.com/spreadsheets/d/19jzLgRruG9kjUQNKtCg1Zjd[DATASET]6l6we[DATASET]6qRXG5zLI[DATASET]hC8">
    [DATASET] lighter weight version of our prompt engineering tutorial via an interactive spreadsheet.
  </Card>
</CardGroup>
Share: