Loading...
    • 开发者指南
    • API 参考
    • MCP
    • 资源
    • 发布说明
    Search...
    ⌘K

    第一步

    Claude 简介快速开始

    模型与定价

    模型概览选择模型Claude 4.5 的新功能迁移到 Claude 4.5模型弃用定价

    使用 Claude 构建

    功能概览使用 Messages API上下文窗口提示词最佳实践

    功能

    提示词缓存上下文编辑扩展思考流式消息批处理引用多语言支持Token 计数嵌入向量视觉PDF 支持Files API搜索结果Google Sheets 插件

    工具

    概述如何实现工具使用令牌高效的工具使用细粒度工具流式传输Bash 工具代码执行工具计算机使用工具文本编辑器工具Web fetch 工具网络搜索工具记忆工具

    代理技能

    概述在 API 中开始使用 Agent Skills技能创作最佳实践通过 API 使用 Agent Skills

    Agent SDK

    概览TypeScript SDKPython SDK

    指南

    流式输入处理权限会话管理托管 Agent SDK修改系统提示词SDK 中的 MCP自定义工具SDK 中的子代理SDK 中的斜杠命令SDK 中的代理技能跟踪成本和使用情况待办事项列表SDK 中的插件

    API 中的 MCP

    MCP 连接器远程 MCP 服务器

    Claude 在第三方平台上

    Amazon BedrockVertex AI

    提示词工程

    概述提示词生成器使用提示模板提示词改进器保持清晰和直接使用示例(多示例提示)让 Claude 思考(思维链)使用XML标签给Claude分配角色(系统提示)预填充 Claude 的响应链式复杂提示长文本技巧扩展思考技巧

    测试与评估

    定义成功标准开发测试用例使用评估工具减少延迟

    加强防护措施

    减少幻觉提高输出一致性缓解越狱handle-streaming-refusals减少提示词泄露保持Claude的角色特征

    管理和监控

    Admin API 概述使用量和成本 APIClaude Code 分析 API
    Console
    提示词工程

    让 Claude 思考(思维链提示)以提高性能

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

    在面对研究、分析或问题解决等复杂任务时,给 Claude 思考的空间可以显著提高其表现。这种被称为思维链(CoT)提示的技术,鼓励 Claude 逐步分解问题,从而产生更准确和细致的输出。

    实施思维链之前

    为什么要让 Claude 思考?

    • 准确性: 逐步解决问题可以减少错误,尤其是在数学、逻辑、分析或一般复杂任务中。
    • 连贯性: 结构化思维可以产生更连贯、组织更完善的回答。
    • 调试: 查看 Claude 的思维过程有助于你找出提示可能不清晰的地方。

    为什么不让 Claude 思考?

    • 增加输出长度可能影响延迟。
    • 并非所有任务都需要深入思考。明智地使用思维链以确保性能和延迟的适当平衡。
    对于人类需要思考的任务,如复杂数学、多步骤分析、编写复杂文档或涉及多个因素的决策,请使用思维链。

    如何提示思考

    下面的思维链技术按从简单到复杂的顺序排列。较简单的方法在上下文窗口中占用较少空间,但通常功能也较弱。

    思维链提示: 始终让 Claude 输出其思考过程。如果不输出思维过程,就不会发生思考!
    • 基本提示: 在提示中包含"逐步思考"。
      • 缺乏关于如何思考的指导(如果任务特别针对你的应用、用例或组织,这尤其不理想)

    • 引导式提示: 概述 Claude 在思考过程中要遵循的具体步骤。
      • 缺乏结构化,难以剥离和分离答案与思考过程。

    • 结构化提示: 使用像 <thinking> 和 <answer> 这样的 XML 标签来分离推理和最终答案。

    示例


    提示库

    从精选的各种任务和用例提示中获取灵感。

    GitHub 提示教程

    一个包含丰富示例的教程,涵盖了我们文档中的提示工程概念。

    Google Sheets 提示教程

    通过交互式电子表格提供的我们提示工程教程的轻量级版本。

    • 为什么要让 Claude 思考?
    • 为什么不让 Claude 思考?
    © 2025 ANTHROPIC PBC

    Products

    • Claude
    • Claude Code
    • Max plan
    • Team plan
    • Enterprise plan
    • Download app
    • Pricing
    • Log in

    Features

    • Claude and Slack
    • Claude in Excel

    Models

    • Opus
    • Sonnet
    • Haiku

    Solutions

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

    Claude Developer Platform

    • Overview
    • Developer docs
    • Pricing
    • Amazon Bedrock
    • Google Cloud’s Vertex AI
    • Console login

    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

    Help and security

    • Availability
    • Status
    • Support center

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy

    Products

    • Claude
    • Claude Code
    • Max plan
    • Team plan
    • Enterprise plan
    • Download app
    • Pricing
    • Log in

    Features

    • Claude and Slack
    • Claude in Excel

    Models

    • Opus
    • Sonnet
    • Haiku

    Solutions

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

    Claude Developer Platform

    • Overview
    • Developer docs
    • Pricing
    • Amazon Bedrock
    • Google Cloud’s Vertex AI
    • Console login

    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

    Help and security

    • Availability
    • Status
    • Support center

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy
    © 2025 ANTHROPIC PBC