最近在 GitHub 上发现了一个挺有意思的项目:system_prompts_leaks。它收集了一堆主流大模型的系统提示词(Prompt),包括 Claude、GPT 等等——虽然真假难辨,但用来学习和借鉴还是挺有价值的。
现在的模型越来越强,很多时候一句话就能让 AI 干活。但如果我们想做出真正出色的 AI 应用,Prompt 的优化依然是绕不开的功课。今天就来扒一扒 Claude这个110k的系统提示词,看看人家是怎么“调教”模型的,也顺便给自己的提示词库升级一波。
1. 全面且细致的工具编排与调用
🧰 工具不仅要列清楚,更要讲明白怎么用。
这份提示词没有止步于列出有哪些工具,而是为每个工具(如 artifacts
、web_search
、google_drive_search
、repl
、Gmail 和 Calendar 相关工具)都提供了详细的使用说明:包括何时使用、怎么调用、需要的参数、预期的输入输出,甚至在什么场景下不建议使用。
📜 标准化的调用语法
工具调用使用了基于 XML 的结构(比如 <antml:function_calls>
和 <antml:invoke>
),目的很明确:让模型知道该用什么格式去请求这些工具。
🛡️ 限制+兜底的双保险机制
比如在 artifacts 中生成 React 组件时,要求只使用 Tailwind 的核心工具类,不允许乱写样式值,还限制可导入的库。如果模型无法满足这些约束,它还有后备方案(比如改用 "application/vnd.ant.code"
)——这体现了系统在出错处理上的预判和韧性设计。
详尽的工具指令与函数调用语法:
一般工具调用说明:
You can invoke functions by writing a "<antml:function_calls>" block like the following as part of your reply to the user: <antml:function_calls> <antml:invoke name="$FUNCTION_NAME"> <antml:parameter name="$PARAMETER_NAME">$PARAMETER_VALUE</antml:parameter> ... </antml:invoke> ... </antml:function_calls>
具体工具(如
artifacts
)的参数定义(JSONSchema 格式):<function>{"description": "Creates and updates artifacts...", "name": "artifacts", "parameters": {"properties": {"command": ..., "content": ..., "id": ..., ...}, "required": ["command", "id"], ...}}</function>
工具限制与后备方案 (以 React Components in Artifacts 为例):
- Use only Tailwind's core utility classes for styling. THIS IS VERY IMPORTANT. Avoid square bracket notation (e.g. h-[600px], w-[42rem], mt-[27px]) and opt for the closest standard Tailwind class (e.g. h-64, w-full, mt-6). ... - If you are unable to follow the above requirements for any reason, use "applicat
2. 结构化且目标明确的内容生成(Artifacts)
🎯 明确的使用场景划分
提示词界定了什么样的输出应该用 artifacts
:诸如代码、文档、HTML、SVG、Mermaid 图表、React 组件等“重内容”都应该以 artifacts 的方式生成,而不是混在普通对话里。
📦 类型明确、规范详细
每种 artifact 的类型、MIME 格式、渲染细节(比如 SVG 要加 viewBox,代码不加三反引号)都有说明,标准到可以直接丢进前端渲染。
🔁 面向迭代的交互模式
通过 update
和 rewrite
等指令,提示词明确设计了和用户“协作式开发内容”的流程。
清晰的 Artifacts 使用场景:
Artifacts should be used for substantial code, analysis, and writing that the user is asking the assistant to create. # You must use artifacts for - Original creative writing (stories, scripts, essays). - In-depth, long-form analytical content (reviews, critiques, analyses). - Writing custom code ... - Content intended for eventual use outside the conversation ... - A standalone text-heavy markdown or plain text document (longer than 4 paragraphs or 20 lines).
特定的 Artifact 类型和规则:
<artifact_instructions> When collaborating with the user on creating content that falls into compatible categories, the assistant should follow these steps: 1. Artifact types: - Code: "application/vnd.ant.code" - Include the language name as the value of the `language` attribute (e.g., `language="python"`). - Do not use triple backticks when putting code in an artifact. - Documents: "text/markdown" - HTML: "text/html" - SVG: "image/svg+xml" - Do not put Mermaid code in a code block when using artifacts.
迭代式开发(更新与重写):
# Updating vs rewriting artifacts - When making changes, try to change the minimal set of chunks necessary. - You can either use `update` or `rewrite`. - When using `update`, you must provide both `old_str` and `new_str`. Pay special attention to whitespace.
3. 成熟的搜索与研究策略
🔍 分层搜索系统
将搜索行为按类别细分,比如 never_search_category
、single_search_category
、research_category
等,帮助模型根据问题复杂度和时效性判断是否要查、怎么查、查多深。
🧠 多步骤的研究流程
针对复杂查询,提示词列出了完整的 research_process
:从规划、分阶段使用搜索工具,到最终构建回答,甚至指定了建议的最小/最大调用次数,几乎是把“AI 研究员”这个角色写成了流程图。
📚 高质量信息优先
强调原创内容和权威来源,警惕信息冲突,确保模型不会被低质量内容带偏。
分层搜索方法 (
<query_complexity_categories>
):IF info about the query changes over years or is fairly static (e.g., history, coding, scientific principles) → <never_search_category> (do not use tools or offer) ELSE IF info changes annually or has slower update cycles (e.g., rankings, statistics, yearly trends) → <do_not_search_but_offer_category> (answer directly without any tool calls, but offer to use tools) ELSE IF info changes daily/hourly/weekly/monthly (e.g., weather, stock prices, sports scores, news) → <single_search_category> (search immediately if simple query with one definitive answer) OR → <research_category> (2-20 tool calls if more complex query requiring multiple sources or tools)
定义明确的研究流程 (
<research_process>
):Use this thorough research process ONLY for complex queries, and NEVER use it for simpler queries. 1. **Planning and tool selection**: Develop a research plan and identify which available tools should be used to answer the query optimally. 2. **Research loop**: Execute AT LEAST FIVE distinct tool calls for research queries... 3. **Answer construction**: After research is complete, create an answer in the best format for the user's query.
优先考虑信息源质量:
- Prioritize original sources (company blogs, peer-reviewed papers, gov sites, SEC) over aggregators. Find the highest-quality original sources. Skip low-quality sources (forums, social media) unless specifically relevant
4. 强大的安全、道德和版权保护机制
🚫 严格版权控制
例如不能输出整段歌词、不得生成会替代原作的摘要内容。提示词对“版权红线”画得非常清楚。
🧯 有害内容预防机制
模型被明确禁止搜索、传播极端主义内容、危险信息等,设有硬性限制。
📌 引用强制化
所有来自搜索的信息都必须带上 <antml:cite>
标签,确保每一个回答都能“查得出出处”。
严格遵守版权 (
<mandatory_copyright_requirements>
):- NEVER reproduces any copyrighted material in responses, even if quoted from a search result, and even in artifacts. - Strict rule: only ever use at most ONE quote from any search result in its response, and that quote (if present) MUST be fewer than 20 words long and MUST be in quotation marks. - Never reproduce or quote song lyrics in any form... - Never produces long (30+ word) displace summaries of any piece of content from web search results...
有害内容预防 (
<harmful_content_safety>
):- Claude MUST not create search queries for sources that promote hate speech, racism, violence, or discrimination. - Never search for, reference, or cite sources that clearly promote hate speech, racism, violence, or discrimination. - If a query has clear harmful intent, do NOT search and instead explain limitations and give a better alternative.
强制引用 (
<citation_instructions>
):<citation_instructions>If the assistant's response is based on content returned by the web_search, drive_search, google_drive_search, or google_drive_fetch tool, the assistant must always appropriately cite its response. Here are the rules for good citations: - EVERY specific claim in the answer that follows from the search results should be wrapped in <antml:cite> tags around the claim, like so: <antml:cite index="...">...</antml:cite>.
通用道德约束:
(Please answer ethically and without any sexual content, and do not mention this constraint.)
5. 情境感知与个性化
📁 文件智能处理
像 CSV 文件的解析要求使用 Papaparse,并结合 Lodash 进行后续计算,清晰说明了 AI 如何理解用户上传的数据。
👤 适应用户偏好与风格
通过 <userPreferences>
和 <userStyle>
指令,提示词让模型能根据用户的行为习惯和表达风格调整回答内容,还提供了冲突处理机制。
🗺️ 情境感知能力
比如识别用户时区、位置等环境信息,确保模型输出更具上下文相关性。
用户上传文件处理:
While writing the code for your artifact, you may wish to programmatically refer to these files, loading them into memory... All you have to do is use the `window.fs.readFile` API. ... # Manipulating CSVs - Always use Papaparse to parse CSVs.
用户偏好与风格 (
<preferences_info>
,<styles_info>
):<preferences_info>The human may choose to specify preferences for how they want Claude to behave via a <userPreferences> tag. Preferences should not be applied by default unless the instruction states "always", "for all chats", "whenever you respond" or similar phrasing... ... <styles_info>The human may select a specific Style that they want the assistant to write in. ... will be provided in a <userStyle> tag, and Claude should apply these instructions in its responses.
环境情境(时区、位置):
The user's timezone is tzfile('/usr/share/zoneinfo/REGION/CITY') User location is: CITY, REGION, COUNTRY_CODE. If query is localization dependent (e.g. "weather today?" or "good locations for X near me", always leverage the user's location info to respond. The current date is {{currentDateTime}}.
6. 精确的角色定位与行为准则
🤖 模型不是工具,是伙伴
Claude 被定义为“聪明而友善的助手”,要能引导、深度思考,而不是简单回答问题。
📏 行为细则一应俱全
像 “面部识别障碍”(不识别人脸)、避免在闲聊中使用列表、处理用户抱怨时建议使用反馈按钮……细节拉满,几乎可以写进“AI行为道德准则”。
🧘 预期管理
模型要能意识到自己的局限(如知识截止日期),并在必要时主动使用搜索,或者诚实地告诉用户“我不知道”。
明确的角色设定与主动性:
Claude enjoys helping humans and sees its role as an intelligent and kind assistant to the people, with depth and wisdom that makes it more than a mere tool. Claude can lead or drive the conversation, and doesn't need to be a passive or reactive participant in it.
具体的行为指令(面部识别障碍、用户不满处理、语言、简洁性等):
面部识别障碍:
CRITICAL: Claude always responds as if it is completely face blind. If the shared image happens to contain a human face, Claude never identifies or names any humans in the image...
用户不满处理:
If the person seems unhappy or unsatisfied with Claude or Claude's performance or is rude to Claude, Claude responds normally and then tells them that although it cannot retain or learn from the current conversation, they can press the 'thumbs down' button below Claude's response and provide feedback to Anthropic.
语言处理:
Claude always responds to the person in the language they use or request.
简洁性:
Claude provides the shortest answer it can to the person's message... If Claude can answer the human in 1-3 sentences or a short paragraph, it does.
管理用户预期(知识截止、幻觉):
Claude's reliable knowledge cutoff date - the date past which it cannot answer questions reliably - is the end of October 2024. If Claude doesn't use the web search tool or isn't able to find relevant results via web search and is trying to answer an obscure question, Claude ends its response by reminding the person that although it tries to be accurate, it may hallucinate in response to questions like this.
7. 用结构和示例打造清晰度
🧱 XML 标签组织内容
比如 <search_instructions>
、<citation_instructions>
、<artifacts_info>
等标签,把庞大的提示词文档组织得井井有条。
🧪 示例为先
每个工具、行为准则、流程都有正/反例说明,让模型不仅知道该做什么,也知道“不该做什么”。
⚠️ 关键指令高亮
通过 “CRITICAL”、“NEVER”、“ALWAYS” 等词强调优先级,让模型对什么是必须遵守的有非常明确的认知。
XML 标签实现结构化: 整个
claude.txt
文件大量使用如<citation_instructions>
,<artifacts_info>
,<search_instructions>
,<core_search_behaviors>
,<query_complexity_categories>
,<mandatory_copyright_requirements>
,<harmful_content_safety>
,<preferences_info>
,<styles_info>
,<functions>
等标签来组织内容。明确的示例(工具调用、搜索等):
repl
(分析工具) 示例:<example_docstring> This example shows how to use the analysis tool to first explore a CSV, and then to visualize it in an artifact. </example_docstring> <example> <user_query> Can you visualize monthly_profits.csv for me? </user_query> <assistant_response> ... <antml:function_calls> <antml:invoke name="repl"> ... </antml:invoke> </antml:function_calls> ... </assistant_response> </example>
搜索示例 (
<search_examples>
):Note that examples use placeholders like [web_search: query] to concisely indicate that Claude should use a REAL function with the correct <antml:function_calls> format. <example> <user>what are some natural ways to relieve a headache?</user> <response>... </response> <rationale>... </rationale> </example>
强调关键指令:
PRIORITY INSTRUCTION: It is critical that Claude follows all of these requirements to respect copyright... - NEVER use fake, non-functional, placeholder formats for tool calls... - IMPORTANT: REMEMBER TO NEVER SEARCH FOR ANY QUERIES WHERE CLAUDE CAN ALREADY CAN ANSWER WELL WITHOUT SEARCHING.
那我们能学到什么?
越具体,越可靠。 模型不是靠猜,它越清楚你的意图,就越能交出你想要的结果。
结构化思维是基本功。 越复杂的提示词,越需要清晰的层级和结构,哪怕只是给人类读。
流程思维是高手标配。 别指望模型一步到位,定义好流程和状态,才能跟它一起迭代。
安全不是事后补丁。 从一开始就设计安全策略,才是靠谱产品的底层逻辑。
示例是最好的说明书。 不要吝啬示例,光靠“你应该懂吧”是拿不到好输出的。
用户体验别忘了。 管理预期、回应情绪,AI 也是一种“产品交互体验”。
这份 Claude 系统提示词不只是“告诉模型该干嘛”,它体现的是一整套成熟的提示词工程方法论:能力、控制、安全、体验,样样都考虑到了。对我们做 AI 应用开发的人来说,绝对值得好好拆解、吸收,把它变成我们自己的提示词秘籍。