Loading...
    • 開發者指南
    • API 參考
    • MCP
    • 資源
    • 發行說明
    Search...
    ⌘K
    開始使用
    Claude 簡介快速開始
    模型與定價
    模型概覽選擇模型Claude 4.5 新功能遷移至 Claude 4.5模型棄用定價
    使用 Claude 構建
    功能概覽使用 Messages API上下文窗口提示詞最佳實踐
    功能
    提示詞快取上下文編輯擴展思考努力串流消息批次處理引用多語言支援Token 計數嵌入視覺PDF 支援Files API搜尋結果結構化輸出Google Sheets 附加元件
    工具
    概覽如何實現工具使用Token 高效工具使用細粒度工具串流Bash 工具代碼執行工具程式化工具調用計算機使用工具文字編輯器工具Web 獲取工具Web 搜尋工具記憶體工具工具搜尋工具
    Agent 技能
    概覽快速開始最佳實踐使用 API 的技能
    Agent SDK
    概覽TypeScript SDKPython SDK遷移指南
    指南
    串流輸入處理權限會話管理SDK 中的結構化輸出託管 Agent SDK修改系統提示詞SDK 中的 MCP自訂工具SDK 中的子 AgentSDK 中的斜線命令SDK 中的 Agent 技能追蹤成本和使用情況待辦事項清單SDK 中的外掛程式
    API 中的 MCP
    MCP 連接器遠端 MCP 伺服器
    第三方平台上的 Claude
    Amazon BedrockMicrosoft FoundryVertex AI
    提示詞工程
    概覽提示詞生成器使用提示詞範本提示詞改進器清晰直接使用範例(多次提示)讓 Claude 思考(CoT)使用 XML 標籤給 Claude 一個角色(系統提示詞)預填 Claude 的回應鏈接複雜提示詞長上下文提示擴展思考提示
    測試與評估
    定義成功標準開發測試案例使用評估工具降低延遲
    加強防護欄
    減少幻覺增加輸出一致性緩解越獄串流拒絕減少提示詞洩露保持 Claude 的角色
    管理和監控
    Admin API 概覽使用和成本 APIClaude Code Analytics API
    Console
    Log in
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Partners

    • Amazon Bedrock
    • Google Cloud's Vertex AI

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Help and security

    • Availability
    • Status
    • Support
    • Discord

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy
    提示詞工程

    長文本提示技巧

    While these tips apply broadly to all Claude models, you can find prompting tips specific to extended thinking models here.

    Claude 的擴展上下文視窗(Claude 3 模型可達 200K tokens)使其能夠處理複雜且資料豐富的任務。本指南將幫助您有效地運用這種能力。

    長文本提示的基本技巧

    • 將長格式資料放在頂部:將您的長文件和輸入(約 20K+ tokens)放在提示的頂部,位於查詢、指令和範例之上。這可以顯著提升 Claude 在所有模型中的表現。

      測試顯示,將查詢放在末尾可以將回應品質提升高達 30%,尤其是在處理複雜的多文件輸入時。
    • 使用 XML 標籤來組織文件內容和元數據:當使用多個文件時,用 <document> 標籤包裹每個文件,並使用 <document_content> 和 <source>(以及其他元數據)子標籤以提高清晰度。

    • 以引用為基礎進行回應:對於長文件任務,請要求 Claude 在執行任務之前先引用文件中的相關部分。這有助於 Claude 在文件內容的「雜訊」中找到重點。


    提示庫

    從精心策劃的各種任務和使用案例的提示中獲得靈感。

    GitHub 提示教程

    一個包含豐富示例的教程,涵蓋了我們文檔中的提示工程概念。

    Google Sheets 提示教程

    通過互動式試算表提供的輕量級版本提示工程教程。