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-opus-4-6",
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)資料科學家可能會看到與行銷策略師不同的洞察。而專精於財富 500 強企業客戶洞察分析的資料科學家可能會產生更不一樣的結果!沒有角色時,Claude 可能會遺漏關鍵問題:
有了角色後,Claude 能捕捉到可能造成數百萬損失的關鍵問題:
沒有角色時,Claude 的分析缺乏深度:
有了角色後,Claude 能提供可執行的洞察:
從精選的各種任務和使用案例提示詞中獲取靈感。
一個包含豐富範例的教學,涵蓋我們文件中的提示工程概念。
透過互動式試算表提供的輕量版提示工程教學。
Was this page helpful?