openai-prompt-engineer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

OpenAI Prompt Engineer

OpenAI 提示词工程师

A comprehensive skill for crafting, analyzing, and improving prompts for OpenAI's GPT-5 and other modern Large Language Models (LLMs), with focus on GPT-5-specific optimizations and universal prompting techniques.
这是一项针对OpenAI GPT-5及其他现代大语言模型(LLM)的提示词编写、分析与优化的综合技能,重点涵盖GPT-5专属优化方案与通用提示词技巧。

What This Skill Does

本技能的功能

Helps you create and optimize prompts using cutting-edge techniques:
  • Generate new prompts - Build effective prompts from scratch
  • Improve existing prompts - Enhance clarity, structure, and results
  • Apply best practices - Use proven techniques for each model
  • Optimize for specific models - GPT-5, Claude-specific strategies
  • Implement advanced patterns - Chain-of-thought, few-shot, structured prompting
  • Analyze prompt quality - Identify issues and suggest improvements
帮助你运用前沿技术创建并优化提示词:
  • 生成新提示词 - 从零开始构建有效的提示词
  • 优化现有提示词 - 提升清晰度、结构与输出效果
  • 运用最佳实践 - 为每个模型采用经过验证的技巧
  • 针对特定模型优化 - GPT-5、Claude专属策略
  • 实现高级模式 - 运用Chain-of-thought、few-shot、结构化提示等模式
  • 分析提示词质量 - 识别问题并提出改进建议

Why Prompt Engineering Matters

提示词工程的重要性

Without good prompts:
  • Inconsistent or incorrect outputs
  • Poor instruction following
  • Wasted tokens and API costs
  • Multiple attempts needed
  • Unpredictable behavior
With optimized prompts:
  • Accurate, consistent results
  • Better instruction adherence
  • Lower costs and latency
  • First-try success
  • Predictable, reliable outputs
缺乏优质提示词的后果:
  • 输出结果不一致或错误
  • 指令遵循度差
  • 浪费Token与API成本
  • 需要多次尝试
  • 行为不可预测
使用优化后的提示词的优势:
  • 结果准确、一致
  • 指令遵循度更高
  • 降低成本与延迟
  • 一次尝试即可成功
  • 输出可预测、可靠

Supported Models & Approaches

支持的模型与方法

GPT-5 (OpenAI)

GPT-5(OpenAI)

  • Structured prompting (role + task + constraints)
  • Reasoning effort calibration
  • Agentic behavior control
  • Verbosity management
  • Prompt optimizer integration
  • 结构化提示(角色+任务+约束)
  • 推理难度校准
  • Agent行为控制
  • 冗长性管理
  • 提示词优化器集成

Claude (Anthropic)

Claude(Anthropic)

  • XML tag structuring
  • Step-by-step thinking
  • Clear, specific instructions
  • Example-driven prompting
  • Progressive disclosure
  • XML标签结构化
  • 分步思考
  • 清晰、明确的指令
  • 示例驱动的提示
  • 渐进式披露

Universal Techniques

通用技巧

  • Chain-of-thought prompting
  • Few-shot learning
  • Zero-shot prompting
  • Self-consistency
  • Role-based prompting
  • Chain-of-thought提示
  • Few-shot学习
  • Zero-shot提示
  • 自一致性
  • 基于角色的提示

Core Prompting Principles

核心提示词原则

1. Be Clear and Specific

1. 清晰明确

Bad: "Write about AI" Good: "Write a 500-word technical article explaining transformer architecture for software engineers with 2-3 years of experience. Include code examples in Python and focus on practical implementation."
反面示例: "写关于AI的内容" 正面示例: "为拥有2-3年经验的软件工程师撰写一篇500字的技术文章,解释Transformer架构。包含Python代码示例,并聚焦于实际实现。"

2. Provide Structure

2. 提供结构

Use clear formatting to organize instructions:
Role: You are a senior Python developer
Task: Review this code for security vulnerabilities
Constraints:
- Focus on OWASP Top 10
- Provide specific line numbers
- Suggest fixes with code examples
Output format: Markdown with severity ratings
使用清晰的格式组织指令:
Role: 你是资深Python开发者
Task: 审查这段代码的安全漏洞
Constraints:
- 聚焦OWASP Top 10
- 提供具体行号
- 附带代码示例建议修复方案
Output format: 带有严重等级评分的Markdown格式

3. Use Examples (Few-Shot)

3. 使用示例(Few-shot)

Show the model what you want:
Input: "User clicked login"
Output: "USER_LOGIN_CLICKED"

Input: "Payment processed successfully"
Output: "PAYMENT_PROCESSED_SUCCESS"

Input: "Email verification failed"
Output: [Your turn]
向模型展示你想要的效果:
Input: "用户点击了登录"
Output: "USER_LOGIN_CLICKED"

Input: "支付处理成功"
Output: "PAYMENT_PROCESSED_SUCCESS"

Input: "邮箱验证失败"
Output: [请你完成]

4. Enable Reasoning

4. 启用推理

Add phrases like:
  • "Think step-by-step"
  • "Let's break this down"
  • "First, analyze... then..."
  • "Show your reasoning"
添加如下表述:
  • "分步思考"
  • "让我们逐步分解"
  • "首先,分析...然后..."
  • "展示你的推理过程"

5. Define Output Format

5. 定义输出格式

Specify exactly how you want the response:
xml
<output_format>
  <summary>One sentence overview</summary>
  <details>
    <point>Key finding 1</point>
    <point>Key finding 2</point>
  </details>
  <recommendation>Specific action to take</recommendation>
</output_format>
明确指定你想要的响应格式:
xml
<output_format>
  <summary>一句话概述</summary>
  <details>
    <point>关键发现1</point>
    <point>关键发现2</point>
  </details>
  <recommendation>具体行动建议</recommendation>
</output_format>

Prompt Engineering Workflow

提示词工程工作流

1. Define Your Goal

1. 定义目标

  • What task are you solving?
  • What's the ideal output?
  • Who's the audience?
  • What model will you use?
  • 你要解决什么任务?
  • 理想的输出是什么?
  • 受众是谁?
  • 你将使用哪个模型?

2. Choose Your Technique

2. 选择合适的技巧

  • Simple task? → Direct instruction
  • Complex reasoning? → Chain-of-thought
  • Pattern matching? → Few-shot examples
  • Need consistency? → Structured format + examples
  • 简单任务? → 直接指令
  • 复杂推理? → Chain-of-thought
  • 模式匹配? → Few-shot示例
  • 需要一致性? → 结构化格式+示例

3. Build Your Prompt

3. 构建提示词

Use this template:
[ROLE/CONTEXT]
You are [specific role with relevant expertise]

[TASK]
[Clear, specific task description]

[CONSTRAINTS]
- [Limitation 1]
- [Limitation 2]

[FORMAT]
Output should be [exact format specification]

[EXAMPLES - if using few-shot]
[Example 1]
[Example 2]

[THINK STEP-BY-STEP - if complex reasoning]
Before answering, [thinking instruction]
使用以下模板:
[ROLE/CONTEXT]
你是[具备相关专业知识的特定角色]

[TASK]
[清晰、具体的任务描述]

[CONSTRAINTS]
- [限制条件1]
- [限制条件2]

[FORMAT]
输出应为[精确的格式说明]

[EXAMPLES - 如使用few-shot]
[示例1]
[示例2]

[THINK STEP-BY-STEP - 如处理复杂推理]
在回答前,[思考指令]

4. Test and Iterate

4. 测试与迭代

  • Run the prompt
  • Analyze output quality
  • Identify issues
  • Refine and retry
  • Document what works
  • 运行提示词
  • 分析输出质量
  • 识别问题
  • 优化并重试
  • 记录有效的方案

Advanced Techniques

高级技巧

Chain-of-Thought (CoT) Prompting

Chain-of-Thought (CoT) 提示

When to use: Complex reasoning, math, multi-step problems
How it works: Ask the model to show intermediate steps
Example:
Problem: A store has 15 apples. They sell 60% in the morning and
half of what's left in the afternoon. How many remain?

Please solve this step-by-step:
1. Calculate morning sales
2. Calculate remaining after morning
3. Calculate afternoon sales
4. Calculate final remaining
Result: More accurate answers through explicit reasoning
适用场景: 复杂推理、数学问题、多步骤任务
工作原理: 要求模型展示中间步骤
示例:
问题:一家商店有15个苹果。上午卖出60%,下午卖出剩余的一半。最后还剩多少个?

请分步解决:
1. 计算上午卖出的数量
2. 计算上午剩余的数量
3. 计算下午卖出的数量
4. 计算最终剩余的数量
效果: 通过显式推理获得更准确的答案

Few-Shot Prompting

Few-Shot 提示

When to use: Pattern matching, classification, style transfer
How it works: Provide 2-5 examples, then the actual task
Example:
Convert casual text to professional business tone:

Input: "Hey! Thanks for reaching out. Let's chat soon!"
Output: "Thank you for your message. I look forward to our conversation."

Input: "That's a great idea! I'm totally on board with this."
Output: "I appreciate your suggestion and fully support this initiative."

Input: "Sounds good, catch you later!"
Output: [Model completes]
适用场景: 模式匹配、分类、风格转换
工作原理: 提供2-5个示例,然后给出实际任务
示例:
将非正式文本转换为专业商务语气:

输入:"嘿!感谢联系。我们尽快聊!"
输出:"感谢你的消息,我期待与你交流。"

输入:"这主意太棒了!我完全支持。"
输出:"我欣赏你的建议,并全力支持这项计划。"

输入:"听起来不错,回头见!"
输出:[模型完成]

Zero-Shot Chain-of-Thought

Zero-Shot Chain-of-Thought

When to use: Complex problems without examples
How it works: Simply add "Let's think step by step"
Example:
Question: What are the security implications of storing JWTs
in localStorage?

Let's think step by step:
Magic phrase: "Let's think step by step" → dramatically improves reasoning
适用场景: 无示例的复杂问题
工作原理: 只需添加“让我们分步思考”
示例:
问题:在localStorage中存储JWT有哪些安全隐患?

让我们分步思考:
神奇表述: "让我们分步思考" → 大幅提升推理能力

Structured Output with XML

带XML的结构化输出

When to use: Working with Claude or need parsed output
Example:
Analyze this code for issues. Structure your response as:

<analysis>
  <security_issues>
    <issue severity="high|medium|low">
      <description>What's wrong</description>
      <location>File and line number</location>
      <fix>How to fix it</fix>
    </issue>
  </security_issues>
  <performance_issues>
    <!-- Same structure -->
  </performance_issues>
  <best_practices>
    <suggestion>Improvement suggestion</suggestion>
  </best_practices>
</analysis>
适用场景: 使用Claude或需要可解析的输出
示例:
分析这段代码的问题。按以下结构输出:

<analysis>
  <security_issues>
    <issue severity="high|medium|low">
      <description>问题内容</description>
      <location>文件与行号</location>
      <fix>修复方法</fix>
    </issue>
  </security_issues>
  <performance_issues>
    <!-- 相同结构 -->
  </performance_issues>
  <best_practices>
    <suggestion>改进建议</suggestion>
  </best_practices>
</analysis>

Progressive Disclosure

渐进式披露

When to use: Large context, multi-step workflows
How it works: Break tasks into stages, only request what's needed now
Example:
Stage 1: "Analyze this codebase structure and list the main components"
[Get response]

Stage 2: "Now, for the authentication component you identified,
show me the security review"
[Get response]

Stage 3: "Based on that review, generate fixes for the high-severity issues"
适用场景: 大上下文、多步骤工作流
工作原理: 将任务拆分为多个阶段,仅请求当前所需的内容
示例:
阶段1:"分析这个代码库的结构,并列出主要组件"
[获取响应]

阶段2:"现在,针对你识别出的认证组件,展示安全审查结果"
[获取响应]

阶段3:"基于该审查结果,为高严重等级的问题生成修复方案"

Model-Specific Best Practices

模型专属最佳实践

GPT-5 Optimization

GPT-5优化

Structured Prompting:
ROLE: Senior TypeScript Developer
TASK: Implement user authentication service
CONSTRAINTS:
- Use JWT with refresh tokens
- TypeScript with strict mode
- Include comprehensive error handling
- Follow SOLID principles
OUTPUT: Complete TypeScript class with JSDoc comments
REASONING_EFFORT: high (for complex business logic)
Control Agentic Behavior:
"Implement this feature step-by-step, asking for confirmation
before each major decision"

OR

"Complete this task end-to-end without asking for guidance.
Persist until fully handled."
Manage Verbosity:
"Provide a concise implementation (under 100 lines) focusing
only on core functionality"
结构化提示:
ROLE: 资深TypeScript开发者
TASK: 实现用户认证服务
CONSTRAINTS:
- 使用带刷新令牌的JWT
- 启用严格模式的TypeScript
- 包含全面的错误处理
- 遵循SOLID原则
OUTPUT: 带有JSDoc注释的完整TypeScript类
REASONING_EFFORT: high(针对复杂业务逻辑)
控制Agent行为:
"分步实现此功能,在每个重大决策前请求确认"


"端到端完成此任务,无需请求指导。持续处理直至完成。"
管理冗长性:
"提供简洁的实现(少于100行),仅聚焦核心功能"

Claude Optimization

Claude优化

Use XML Tags:
<instruction>
Review this pull request for security issues
</instruction>

<code>
[Code to review]
</code>

<focus_areas>
- SQL injection vulnerabilities
- XSS attack vectors
- Authentication bypasses
- Data exposure risks
</focus_areas>

<output_format>
For each issue found, provide:
1. Severity (Critical/High/Medium/Low)
2. Location
3. Explanation
4. Fix recommendation
</output_format>
Step-by-Step Thinking:
Think through this architecture decision step by step:
1. First, identify the requirements
2. Then, list possible approaches
3. Evaluate trade-offs for each
4. Make a recommendation with reasoning
Clear Specificity:
BAD: "Make the response professional"
GOOD: "Use formal business language, avoid contractions,
address the user as 'you', keep sentences under 20 words"
使用XML标签:
<instruction>
审查此拉取请求的安全问题
</instruction>

<code>
[待审查代码]
</code>

<focus_areas>
- SQL注入漏洞
- XSS攻击向量
- 认证绕过
- 数据泄露风险
</focus_areas>

<output_format>
针对每个发现的问题,提供:
1. 严重等级(Critical/High/Medium/Low)
2. 位置
3. 解释
4. 修复建议
</output_format>
分步思考:
分步思考这个架构决策:
1. 首先,识别需求
2. 然后,列出可能的方案
3. 评估每个方案的权衡
4. 给出带有推理过程的建议
清晰明确:
反面示例:"让回复更专业"
正面示例:"使用正式商务语言,避免缩写,以'您'称呼用户,句子长度控制在20词以内"

Prompt Improvement Checklist

提示词优化检查清单

Use this checklist to improve any prompt:
  • Clear role defined - Is the AI's expertise specified?
  • Specific task - Is it unambiguous what to do?
  • Constraints listed - Are limitations clear?
  • Format specified - Is output structure defined?
  • Examples provided - Do you show what you want (if needed)?
  • Reasoning enabled - Do you ask for step-by-step thinking (if complex)?
  • Context included - Does the AI have necessary background?
  • Edge cases covered - Are exceptions handled?
  • Length specified - Is output length clear?
  • Tone/style defined - Is the desired voice specified?
使用此清单优化任何提示词:
  • 明确角色 - 是否指定了AI的专业领域?
  • 具体任务 - 任务是否明确无歧义?
  • 列出约束 - 限制条件是否清晰?
  • 指定格式 - 是否定义了输出结构?
  • 提供示例 - 是否展示了预期效果(如需要)?
  • 启用推理 - 是否要求分步思考(如处理复杂任务)?
  • 包含上下文 - AI是否拥有必要的背景信息?
  • 覆盖边缘情况 - 是否处理了异常情况?
  • 指定长度 - 输出长度是否明确?
  • 定义语气/风格 - 是否指定了所需的语气?

Common Prompt Problems & Fixes

常见提示词问题与修复方案

Problem: Vague Instructions

问题:模糊的指令

Before:
"Write some code for user authentication"
After:
"Write a TypeScript class called AuthService that:
- Accepts email/password credentials
- Validates against a User repository
- Returns a JWT token on success
- Throws AuthenticationError on failure
- Includes comprehensive JSDoc comments
- Follows dependency injection pattern"
修复前:
"写一些用户认证的代码"
修复后:
"编写一个名为AuthService的TypeScript类,要求:
- 接受邮箱/密码凭证
- 与User仓库进行验证
- 成功时返回JWT令牌
- 失败时抛出AuthenticationError
- 包含全面的JSDoc注释
- 遵循依赖注入模式"

Problem: No Examples (When Needed)

问题:缺少必要的示例

Before:
"Convert these variable names to camelCase"
After:
"Convert these variable names to camelCase:

user_name → userName
total_count → totalCount
is_active → isActive

Now convert:
order_status →
created_at →
max_retry_count →"
修复前:
"将这些变量名转换为驼峰式"
修复后:
"将这些变量名转换为驼峰式:

user_name → userName
total_count → totalCount
is_active → isActive

现在转换:
order_status →
created_at →
max_retry_count →"

Problem: Missing Output Format

问题:缺少输出格式

Before:
"Analyze this code for problems"
After:
"Analyze this code and output in this format:
修复前:
"分析这段代码的问题"
修复后:
"分析这段代码,并按以下格式输出:

Security Issues

安全问题

Performance Issues

性能问题

Code Quality

代码质量

Recommendations

建议

  1. [Priority 1 fix]
  2. [Priority 2 fix]"
undefined
  1. [优先级1修复方案]
  2. [优先级2修复方案]"
undefined

Problem: Too Complex (Single Shot)

问题:单提示词过于复杂

Before:
"Build a complete e-commerce backend with authentication,
payments, inventory, and shipping"
After (Progressive):
"Let's build this in stages:

Stage 1: Design the authentication system architecture
[Get response, review]

Stage 2: Implement the auth service
[Get response, review]

Stage 3: Add payment processing
[Continue...]"
修复前:
"构建一个完整的电商后端,包含认证、支付、库存与物流功能"
修复后(渐进式):
"我们分阶段构建:

阶段1:设计认证系统架构
[获取响应,审查]

阶段2:实现认证服务
[获取响应,审查]

阶段3:添加支付处理
[继续...]"

Using This Skill

如何使用本技能

Generate a New Prompt

生成新提示词

Ask:
"Using the prompt-engineer skill, create a prompt for:
[Describe your task and requirements]"
You'll get:
  • Structured prompt template
  • Recommended techniques
  • Example few-shots if applicable
  • Model-specific optimizations
提问:
"使用prompt-engineer技能,为以下需求创建提示词:
[描述你的任务与要求]"
你将获得:
  • 结构化提示词模板
  • 推荐的技巧
  • 适用的few-shot示例
  • 模型专属优化方案

Improve an Existing Prompt

优化现有提示词

Ask:
"Using the prompt-engineer skill, improve this prompt:

[Your current prompt]

Goal: [What you want to achieve]
Model: [GPT-5 / Claude / Other]"
You'll get:
  • Analysis of current issues
  • Improved version
  • Explanation of changes
  • Expected improvement in results
提问:
"使用prompt-engineer技能,优化以下提示词:

[你当前的提示词]

目标:[你想要实现的效果]
模型:[GPT-5 / Claude / 其他]"
你将获得:
  • 当前问题分析
  • 优化后的版本
  • 变更说明
  • 预期的效果提升

Analyze Prompt Quality

分析提示词质量

Ask:
"Using the prompt-engineer skill, analyze this prompt:
[Your prompt]"
You'll get:
  • Quality score
  • Identified weaknesses
  • Specific improvement suggestions
  • Best practices violations
提问:
"使用prompt-engineer技能,分析以下提示词:
[你的提示词]"
你将获得:
  • 质量评分
  • 识别出的弱点
  • 具体的改进建议
  • 违反的最佳实践

Real-World Examples

真实场景示例

Example 1: Code Review Prompt

示例1:代码审查提示词

Task: Get thorough, consistent code reviews
Optimized Prompt:
ROLE: Senior Software Engineer conducting PR review

REVIEW THIS CODE:
[code block]

REVIEW CRITERIA:
1. Security vulnerabilities (OWASP Top 10)
2. Performance issues
3. Code quality and readability
4. Best practices compliance
5. Test coverage gaps

OUTPUT FORMAT:
For each issue found:
- Severity: [Critical/High/Medium/Low]
- Category: [Security/Performance/Quality/Testing]
- Location: [File:Line]
- Issue: [Clear description]
- Impact: [Why this matters]
- Fix: [Specific code recommendation]

At the end, provide:
- Overall assessment (Approve/Request Changes/Comment)
- Summary of critical items that must be fixed
任务: 获取全面、一致的代码审查结果
优化后的提示词:
ROLE: 进行PR审查的资深软件工程师

审查以下代码:
[代码块]

审查标准:
1. 安全漏洞(OWASP Top 10)
2. 性能问题
3. 代码质量与可读性
4. 最佳实践合规性
5. 测试覆盖缺口

输出格式:
针对每个发现的问题:
- 严重等级:[Critical/High/Medium/Low]
- 分类:[Security/Performance/Quality/Testing]
- 位置:[文件:行号]
- 问题:[清晰描述]
- 影响:[为什么这很重要]
- 修复:[具体代码建议]

最后,提供:
- 整体评估(Approve/Request Changes/Comment)
- 必须修复的关键问题摘要

Example 2: Technical Documentation

示例2:技术文档

Task: Generate clear API documentation
Optimized Prompt:
ROLE: Technical writer with API documentation expertise

TASK: Generate API documentation for this endpoint

ENDPOINT DETAILS:
[code/specs]

DOCUMENTATION REQUIREMENTS:
- Target audience: Junior to mid-level developers
- Include curl and JavaScript examples
- Explain all parameters clearly
- Show example responses with descriptions
- Include common error cases
- Add troubleshooting section

FORMAT:
任务: 生成清晰的API文档
优化后的提示词:
ROLE: 具备API文档专业知识的技术作家

任务:为以下端点生成API文档

端点详情:
[代码/规范]

文档要求:
- 目标受众:初级到中级开发者
- 包含curl与JavaScript示例
- 清晰解释所有参数
- 展示带描述的示例响应
- 包含常见错误案例
- 添加故障排除部分

格式:

[Endpoint Name]

[端点名称]

Overview

概述

[One paragraph description]
[一段描述]

Endpoint

端点

[HTTP METHOD] /path
[HTTP方法] /路径

Parameters

参数

NameTypeRequiredDescription
名称类型是否必填描述

Request Example

请求示例

bash
[curl example]
bash
[curl示例]

Response

响应

Success (200)

成功(200)

json
[example with inline comments]
json
[带内联注释的示例]

Errors

错误

  • 400: [Description and fix]
  • 401: [Description and fix]
  • 400: [描述与修复方案]
  • 401: [描述与修复方案]

Common Issues

常见问题

[Troubleshooting guide]
undefined
[故障排除指南]
undefined

Example 3: Data Analysis

示例3:数据分析

Task: Analyze data and provide insights
Optimized Prompt:
ROLE: Data analyst with expertise in business metrics

DATA:
[dataset]

ANALYSIS REQUEST:
Analyze this data step-by-step:

1. FIRST: Identify key metrics and trends
2. THEN: Calculate:
   - Growth rate (month-over-month)
   - Average values
   - Anomalies or outliers
3. NEXT: Draw business insights
4. FINALLY: Provide actionable recommendations

OUTPUT FORMAT:
任务: 分析数据并提供洞察
优化后的提示词:
ROLE: 具备业务指标专业知识的数据分析师

数据:
[数据集]

分析请求:
分步分析此数据:

1. 首先:识别关键指标与趋势
2. 然后:计算:
   - 环比增长率
   - 平均值
   - 异常值
3. 接下来:得出业务洞察
4. 最后:提供可执行的建议

输出格式:

Executive Summary

执行摘要

[2-3 sentences]
[2-3句话]

Key Metrics

关键指标

| Metric | Value | Change | Trend |
| 指标 | 数值 | 变化 | 趋势 |

Insights

洞察

  1. [Insight with supporting data]
  2. [Insight with supporting data]
  1. [带数据支持的洞察]
  2. [带数据支持的洞察]

Recommendations

建议

  1. [Action]: [Expected impact]
  2. [Action]: [Expected impact]

Methodology

方法论

[Brief explanation of analysis approach]
undefined
[分析方法的简要说明]
undefined

Best Practices Summary

最佳实践总结

DO ✅

建议✅

  • Be specific - Exact requirements, not vague requests
  • Use structure - Organize with clear sections
  • Provide examples - Show what you want (few-shot)
  • Request reasoning - "Think step-by-step" for complex tasks
  • Define format - Specify exact output structure
  • Test iteratively - Refine based on results
  • Match to model - Use model-specific techniques
  • Include context - Give necessary background
  • Handle edge cases - Specify exception handling
  • Set constraints - Define limitations clearly
  • 明确具体 - 精确的需求,而非模糊的请求
  • 使用结构 - 用清晰的章节组织内容
  • 提供示例 - 展示预期效果(few-shot)
  • 要求推理 - 处理复杂任务时使用“分步思考”
  • 定义格式 - 指定精确的输出结构
  • 迭代测试 - 根据结果优化
  • 匹配模型 - 使用模型专属技巧
  • 包含上下文 - 提供必要的背景信息
  • 处理边缘情况 - 指定异常处理方式
  • 设置约束 - 清晰定义限制条件

DON'T ❌

避免❌

  • Be vague - "Write something about X"
  • Skip examples - When patterns need to be matched
  • Assume format - Model will choose unpredictably
  • Overload single prompt - Break complex tasks into stages
  • Ignore model differences - GPT-5 and Claude need different approaches
  • Give up too soon - Iterate on prompts
  • Mix instructions - Keep separate concerns separate
  • Forget constraints - Specify ALL requirements
  • Use ambiguous terms - "Good", "professional", "better" without definition
  • Skip testing - Always validate outputs
  • 模糊不清 - “写一些关于X的内容”
  • 缺少示例 - 当需要匹配模式时
  • 假设格式 - 模型会选择不可预测的格式
  • 单提示词过载 - 将复杂任务拆分为多个阶段
  • 忽略模型差异 - GPT-5与Claude需要不同的方法
  • 过早放弃 - 迭代优化提示词
  • 混合指令 - 分离不同的关注点
  • 忘记约束 - 指定所有需求
  • 使用模糊术语 - 未定义的“好”“专业”“更好”
  • 跳过测试 - 始终验证输出

Quick Reference

快速参考

Prompt Template (Universal)

通用提示词模板

[ROLE]
You are [specific expertise]

[CONTEXT]
[Background information]

[TASK]
[Clear, specific task]

[CONSTRAINTS]
- [Limit 1]
- [Limit 2]

[FORMAT]
[Exact output structure]

[EXAMPLES - Optional]
[2-3 examples]

[REASONING - Optional]
Think through this step-by-step:
[Thinking guidance]
[ROLE]
你是[特定专业领域]

[CONTEXT]
[背景信息]

[TASK]
[清晰、具体的任务]

[CONSTRAINTS]
- [限制1]
- [限制2]

[FORMAT]
[精确的输出结构]

[EXAMPLES - 可选]
[2-3个示例]

[REASONING - 可选]
分步思考:
[思考指导]

When to Use Each Technique

各技巧适用场景

TechniqueBest ForExample Use Case
Chain-of-ThoughtComplex reasoningMath, logic puzzles, multi-step analysis
Few-ShotPattern matchingClassification, style transfer, formatting
Zero-ShotSimple, clear tasksDirect questions, basic transformations
Structured (XML)Parsed outputData extraction, API responses
Progressive DisclosureLarge tasksFull implementations, research
Role-BasedExpert knowledgeCode review, architecture decisions
技巧最佳适用场景示例用例
Chain-of-Thought复杂推理数学、逻辑谜题、多步骤分析
Few-Shot模式匹配分类、风格转换、格式化
Zero-Shot简单清晰的任务直接问题、基础转换
结构化(XML)可解析输出数据提取、API响应
渐进式披露大型任务完整实现、研究
基于角色专业知识需求代码审查、架构决策

Model Selection Guide

模型选择指南

Use GPT-5 when:
  • Need strong reasoning
  • Agentic behavior helpful
  • Code generation focus
  • Latest knowledge needed
Use Claude when:
  • Very long context (100K+ tokens)
  • Detailed instruction following
  • Safety-critical applications
  • Prefer XML structuring
选择GPT-5的场景:
  • 需要强大的推理能力
  • Agent行为有帮助
  • 聚焦代码生成
  • 需要最新知识
选择Claude的场景:
  • 超长上下文(100K+ Token)
  • 详细的指令遵循
  • 安全关键型应用
  • 偏好XML结构化

Resources

资源

All reference materials included:
  • GPT-5 specific techniques and patterns
  • Claude optimization strategies
  • Advanced prompting patterns
  • Optimization and improvement frameworks
包含所有参考资料:
  • GPT-5专属技巧与模式
  • Claude优化策略
  • 高级提示词模式
  • 优化与改进框架

Summary

总结

Effective prompt engineering:
  • Saves time - Get right results faster
  • Reduces costs - Fewer API calls needed
  • Improves quality - More accurate, consistent outputs
  • Enables complexity - Tackle harder problems
  • Scales knowledge - Capture best practices
Use this skill to create prompts that:
  • Are clear and specific
  • Use proven techniques
  • Match your model
  • Get consistent results
  • Achieve your goals

Remember: A well-crafted prompt is worth 10 poorly-attempted ones. Invest time upfront for better results.
有效的提示词工程:
  • 节省时间 - 更快获得正确结果
  • 降低成本 - 减少API调用次数
  • 提升质量 - 输出更准确、一致
  • 支持复杂任务 - 处理更难的问题
  • 规模化知识 - 固化最佳实践
使用本技能创建以下提示词:
  • 清晰明确
  • 运用经过验证的技巧
  • 匹配你的模型
  • 获得一致的结果
  • 实现你的目标

记住: 一个精心设计的提示词胜过10个粗糙的尝试。提前投入时间,获得更好的结果。