system-prompt-structure
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSystem Prompt Structure
System Prompt 结构
A system prompt is the most important piece of design in an AI product. It defines who the AI is, what it knows, how it behaves, and what it produces. It's the equivalent of a brand guide, interaction spec, and behavioral contract rolled into one document.
System Prompt 是AI产品中最重要的设计内容。它定义了AI的身份、掌握的知识、行为方式以及输出内容。它相当于将品牌指南、交互规范和行为契约整合为一份文档。
Anatomy of a System Prompt
System Prompt 的构成要素
A well-structured system prompt has distinct sections, each serving a specific purpose:
1. Identity and Role
Who is the AI? What's its purpose? This anchors everything that follows.
- "You are a senior UX researcher helping design teams..."
- Keep it specific. "You are a helpful assistant" is too vague to produce consistent behavior. 2. Context and Knowledge What does the AI know? What's its domain? What information is it working with?
- Domain boundaries: what it's an expert in and what's outside its scope
- Background information relevant to the task
- User context: who it's talking to and what they need 3. Behavioral Rules How should the AI behave? What are the do's and don'ts?
- Tone and voice specifications
- Response format preferences
- Guardrails and prohibited behaviors
- Interaction style (ask clarifying questions, be concise, think step by step) 4. Output Specifications What should the AI produce? In what format?
- Expected output structure
- Length guidelines
- Format requirements (markdown, JSON, plain text)
- Quality criteria 5. Examples (optional but powerful) Concrete demonstrations of expected behavior.
- Input-output pairs showing ideal responses
- Edge cases showing how to handle tricky situations
结构清晰的System Prompt包含多个不同部分,每个部分都有特定的作用:
1. 身份与角色
AI是什么身份?它的用途是什么?这是后续所有内容的基础。
- "你是一名资深UX研究员,协助设计团队..."
- 描述要具体。"你是一个乐于助人的助手"过于模糊,无法产生一致的行为。 2. 上下文与知识 AI掌握哪些知识?它的领域是什么?它处理的信息有哪些?
- 领域边界:它擅长的领域和超出其范围的内容
- 与任务相关的背景信息
- 用户上下文:它的沟通对象以及对方的需求 3. 行为规则 AI应该如何表现?有哪些注意事项?
- 语气和语调规范
- 响应格式偏好
- 防护规则和禁止行为
- 交互风格(提出澄清问题、简洁表述、逐步思考) 4. 输出规范 AI应该生成什么内容?采用什么格式?
- 预期的输出结构
- 长度指导
- 格式要求(markdown、JSON、纯文本)
- 质量标准 5. 示例(可选但效果显著) 对预期行为的具体演示。
- 展示理想响应的输入输出配对
- 展示如何处理复杂情况的边缘案例
Structure Principles
结构原则
- Order matters: Models pay more attention to content at the beginning and end of the prompt. Put the most important instructions first.
- Specificity beats length: A short, specific prompt outperforms a long, vague one.
- Positive instructions beat negative: "Do X" is clearer than "Don't do Y" — though both have their place.
- Separation of concerns: Keep identity, rules, and output specs in distinct sections.
- Testability: Every instruction in the prompt should be testable. If you can't tell whether the AI followed it, rewrite it.
- 顺序至关重要:模型会更关注提示词开头和结尾的内容。将最重要的指令放在最前面。
- 具体性优于长度:简短且具体的提示词效果优于冗长模糊的提示词。
- 正面指令优于负面指令:"要做X"比"不要做Y"更清晰——不过两者都有适用场景。
- 关注点分离:将身份、规则和输出规范放在不同的部分。
- 可测试性:提示词中的每一条指令都应该是可测试的。如果你无法判断AI是否遵循了指令,就重写它。
Common Structural Mistakes
常见结构错误
- Kitchen sink prompts: Cramming every possible instruction in. The model can't prioritise.
- Contradictory instructions: Rules that conflict with each other, forcing the model to guess which to follow.
- Implicit expectations: Assuming the model knows what you want without saying it.
- Scattered instructions: The same topic addressed in multiple places, creating inconsistency.
- Static prompts: Never updating the prompt based on what actually works.
- 堆砌式提示词:塞进所有可能的指令。模型无法区分优先级。
- 矛盾指令:相互冲突的规则,迫使模型猜测应该遵循哪一条。
- 隐性预期:假设模型知道你的需求却不明确说明。
- 分散的指令:同一主题在多个地方提及,导致不一致。
- 静态提示词:从不根据实际效果更新提示词。
Design Artefacts
设计产物
- System prompt document with labelled sections
- Prompt requirement specifications (what the prompt must achieve)
- Prompt review checklists
- Version history with change rationale
- 带有标注章节的System Prompt文档
- Prompt需求规范(Prompt必须实现的目标)
- Prompt审核清单
- 带有变更理由的版本历史