Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
While these tips apply broadly to all Claude models, you can find prompting tips specific to extended thinking models here.
使用 Claude 時,您可以通過使用 system 參數為其分配角色來大幅提升其性能。這種技術稱為角色提示,是使用 Claude 系統提示詞最強大的方式。
正確的角色可以將 Claude 從通用助手轉變為您的虛擬領域專家!
system 參數設置 Claude 的角色。將其他所有內容(如特定任務的指示)放在 user 輪次中。在 Messages API 中使用 system 參數設置 Claude 的角色:
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 可能會看到與 marketing strategist 對相同數據的不同見解。一個 data scientist specializing in customer insight analysis for Fortune 500 companies 可能會產生完全不同的結果!沒有角色的情況下,Claude 可能會遺漏關鍵問題:
使用角色的情況下,Claude 會發現可能造成數百萬美元損失的關鍵問題:
沒有角色的情況下,Claude 的分析缺乏深度:
使用角色的情況下,Claude 提供可行的見解: