openai-prompt-engineer by jamesrochabrun/skills
npx skills add https://github.com/jamesrochabrun/skills --skill openai-prompt-engineer一个全面的技能,用于为 OpenAI 的 GPT-5 和其他现代大型语言模型(LLMs)设计、分析和改进提示词,重点关注 GPT-5 特定优化和通用提示技术。
帮助您使用尖端技术创建和优化提示词:
没有好的提示词会导致:
使用优化后的提示词:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
差: "写关于 AI 的内容" 好: "为具有 2-3 年经验的软件工程师撰写一篇 500 字的技术文章,解释 Transformer 架构。包含 Python 代码示例,并专注于实际实现。"
使用清晰的格式来组织指令:
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
向模型展示你想要什么:
Input: "User clicked login"
Output: "USER_LOGIN_CLICKED"
Input: "Payment processed successfully"
Output: "PAYMENT_PROCESSED_SUCCESS"
Input: "Email verification failed"
Output: [Your turn]
添加类似短语:
精确指定你想要的响应格式:
<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>
使用此模板:
[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]
何时使用: 复杂推理、数学、多步骤问题
工作原理: 要求模型展示中间步骤
示例:
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
结果: 通过显式推理获得更准确的答案
何时使用: 模式匹配、分类、风格转换
工作原理: 提供 2-5 个示例,然后是实际任务
示例:
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]
何时使用: 没有示例的复杂问题
工作原理: 只需添加 "让我们逐步思考"
示例:
Question: What are the security implications of storing JWTs
in localStorage?
Let's think step by step:
魔法短语: "让我们逐步思考" → 显著改善推理能力
何时使用: 与 Claude 协作或需要解析输出时
示例:
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>
何时使用: 大上下文、多步骤工作流
工作原理: 将任务分解为阶段,只请求当前需要的内容
示例:
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"
结构化提示:
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)
控制代理行为:
"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."
管理冗长度:
"Provide a concise implementation (under 100 lines) focusing
only on core functionality"
使用 XML 标签:
<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>
逐步思考:
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
清晰具体:
BAD: "Make the response professional"
GOOD: "Use formal business language, avoid contractions,
address the user as 'you', keep sentences under 20 words"
使用此清单改进任何提示词:
修复前:
"Write some code for user authentication"
修复后:
"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"
修复前:
"Convert these variable names to camelCase"
修复后:
"Convert these variable names to camelCase:
user_name → userName
total_count → totalCount
is_active → isActive
Now convert:
order_status →
created_at →
max_retry_count →"
修复前:
"Analyze this code for problems"
修复后:
"Analyze this code and output in this format:
## Security Issues
- [Issue]: [Description] (Line X)
## Performance Issues
- [Issue]: [Description] (Line X)
## Code Quality
- [Issue]: [Description] (Line X)
## Recommendations
1. [Priority 1 fix]
2. [Priority 2 fix]"
修复前:
"Build a complete e-commerce backend with authentication,
payments, inventory, and shipping"
修复后(渐进式):
"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...]"
询问:
"Using the prompt-engineer skill, create a prompt for:
[Describe your task and requirements]"
你将获得:
询问:
"Using the prompt-engineer skill, improve this prompt:
[Your current prompt]
Goal: [What you want to achieve]
Model: [GPT-5 / Claude / Other]"
你将获得:
询问:
"Using the prompt-engineer skill, analyze this prompt:
[Your 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
任务: 生成清晰的 API 文档
优化后的提示词:
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:
# [Endpoint Name]
## Overview
[One paragraph description]
## Endpoint
`[HTTP METHOD] /path`
## Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
## Request Example
```bash
[curl example]
[example with inline comments]
[故障排除指南]
### 示例 3:数据分析
**任务:** 分析数据并提供见解
**优化后的提示词:**
ROLE: Data analyst with expertise in business metrics
DATA: [dataset]
ANALYSIS REQUEST: Analyze this data step-by-step:
OUTPUT FORMAT:
[2-3 句话]
| 指标 | 数值 | 变化 | 趋势 |
[分析方法的简要说明]
## 最佳实践总结
### 应该做 ✅
- **具体** - 精确的要求,而非模糊的请求
- **使用结构** - 用清晰的章节组织
- **提供示例** - 展示你想要的内容(少样本)
- **请求推理** - 复杂任务使用"逐步思考"
- **定义格式** - 指定确切的输出结构
- **迭代测试** - 根据结果进行优化
- **匹配模型** - 使用模型特定技术
- **包含上下文** - 提供必要的背景信息
- **处理边缘情况** - 指定异常处理
- **设置约束** - 明确定义限制条件
### 不要做 ❌
- **模糊** - "写点关于 X 的东西"
- **跳过示例** - 当需要匹配模式时
- **假设格式** - 模型会选择不可预测的格式
- **单次提示过载** - 将复杂任务分解为阶段
- **忽略模型差异** - GPT-5 和 Claude 需要不同的方法
- **过早放弃** - 对提示词进行迭代
- **混合指令** - 保持关注点分离
- **忘记约束** - 指定所有要求
- **使用模糊术语** - 未定义的"好"、"专业"、"更好"
- **跳过测试** - 始终验证输出
## 快速参考
### 提示词模板(通用)
[ROLE] You are [specific expertise]
[CONTEXT] [Background information]
[TASK] [Clear, specific task]
[CONSTRAINTS]
[FORMAT] [Exact output structure]
[EXAMPLES - Optional] [2-3 examples]
[REASONING - Optional] Think through this step-by-step: [Thinking guidance]
### 何时使用每种技术
| 技术 | 最适合 | 示例用例 |
|-----------|----------|------------------|
| Chain-of-Thought | 复杂推理 | 数学、逻辑谜题、多步骤分析 |
| Few-Shot | 模式匹配 | 分类、风格转换、格式化 |
| Zero-Shot | 简单、清晰的任务 | 直接问题、基本转换 |
| Structured (XML) | 解析输出 | 数据提取、API 响应 |
| Progressive Disclosure | 大型任务 | 完整实现、研究 |
| Role-Based | 专业知识 | 代码审查、架构决策 |
### 模型选择指南
**在以下情况使用 GPT-5:**
- 需要强大的推理能力
- 代理行为有帮助
- 专注于代码生成
- 需要最新知识
**在以下情况使用 Claude:**
- 非常长的上下文(100K+ 令牌)
- 详细的指令遵循
- 安全关键型应用
- 偏好 XML 结构化
## 资源
包含所有参考资料:
- GPT-5 特定技术和模式
- Claude 优化策略
- 高级提示模式
- 优化和改进框架
## 总结
有效的提示词工程:
- **节省时间** - 更快获得正确结果
- **降低成本** - 减少 API 调用次数
- **提高质量** - 输出更准确、一致
- **实现复杂性** - 解决更难的问题
- **扩展知识** - 捕捉最佳实践
使用此技能创建提示词,使其:
- 清晰且具体
- 使用经过验证的技术
- 匹配你的模型
- 获得一致的结果
- 实现你的目标
---
**记住:** 一个精心设计的提示词抵得上 10 个糟糕的尝试。前期投入时间以获得更好的结果。
每周安装数
79
代码仓库
GitHub 星标数
102
首次出现
2026 年 1 月 20 日
安全审计
安装于
codex63
opencode63
gemini-cli59
claude-code58
github-copilot54
cursor54
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.
Helps you create and optimize prompts using cutting-edge techniques:
Without good prompts:
With optimized prompts:
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."
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
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]
Add phrases like:
Specify exactly how you want the response:
<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>
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]
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
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]
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
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>
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"
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"
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"
Use this checklist to improve any prompt:
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"
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 →"
Before:
"Analyze this code for problems"
After:
"Analyze this code and output in this format:
## Security Issues
- [Issue]: [Description] (Line X)
## Performance Issues
- [Issue]: [Description] (Line X)
## Code Quality
- [Issue]: [Description] (Line X)
## Recommendations
1. [Priority 1 fix]
2. [Priority 2 fix]"
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...]"
Ask:
"Using the prompt-engineer skill, create a prompt for:
[Describe your task and requirements]"
You'll get:
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:
Ask:
"Using the prompt-engineer skill, analyze this prompt:
[Your prompt]"
You'll get:
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
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:
# [Endpoint Name]
## Overview
[One paragraph description]
## Endpoint
`[HTTP METHOD] /path`
## Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
## Request Example
```bash
[curl example]
[example with inline comments]
[Troubleshooting guide]
### Example 3: Data Analysis
**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:
OUTPUT FORMAT:
[2-3 sentences]
| Metric | Value | Change | Trend |
[Brief explanation of analysis approach]
## 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
### 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
## Quick Reference
### Prompt Template (Universal)
[ROLE] You are [specific expertise]
[CONTEXT] [Background information]
[TASK] [Clear, specific task]
[CONSTRAINTS]
[FORMAT] [Exact output structure]
[EXAMPLES - Optional] [2-3 examples]
[REASONING - Optional] Think through this step-by-step: [Thinking guidance]
### When to Use Each Technique
| Technique | Best For | Example Use Case |
|-----------|----------|------------------|
| Chain-of-Thought | Complex reasoning | Math, logic puzzles, multi-step analysis |
| Few-Shot | Pattern matching | Classification, style transfer, formatting |
| Zero-Shot | Simple, clear tasks | Direct questions, basic transformations |
| Structured (XML) | Parsed output | Data extraction, API responses |
| Progressive Disclosure | Large tasks | Full implementations, research |
| Role-Based | Expert knowledge | Code review, architecture decisions |
### 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
## Resources
All reference materials included:
- GPT-5 specific techniques and patterns
- Claude optimization strategies
- Advanced prompting patterns
- Optimization and improvement frameworks
## 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.
Weekly Installs
79
Repository
GitHub Stars
102
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex63
opencode63
gemini-cli59
claude-code58
github-copilot54
cursor54
AI 代码实施计划编写技能 | 自动化开发任务分解与 TDD 流程规划工具
50,900 周安装