While these tips apply broadly to all Claude models, you can find prompting tips specific to extended thinking models here.
When using Claude, you can dramatically improve its performance by using the system parameter to give it a role. This technique, known as role prompting, is the most powerful way to use system prompts with Claude.
The right role can turn Claude from a general assistant into your virtual domain expert!
system parameter to set Claude's role. Put everything else, like task-specific instructions, in the user turn instead.Use the system parameter in the Messages API to set Claude's role:
import anthropic
client = anthropic.Anthropic()
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": "Analyze this dataset for anomalies: <dataset>{{DATASET}}</dataset>"}
]
)
print(response.content)data scientist might see different insights than a marketing strategist for the same data. A data scientist specializing in customer insight analysis for Fortune 500 companies might yield different results still!Without a role, Claude might miss critical issues:
With a role, Claude catches critical issues that could cost millions:
Without a role, Claude's analysis lacks depth:
With a role, Claude delivers actionable insights:
Get inspired by a curated selection of prompts for various tasks and use cases.
An example-filled tutorial that covers the prompt engineering concepts found in our docs.
A lighter weight version of our prompt engineering tutorial via an interactive spreadsheet.