prompt-optimization

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Prompt Optimization

提示词优化

This skill optimizes prompts for LLMs and AI systems, focusing on effective prompt patterns, few-shot learning, and optimal AI interactions.
本技能针对LLM和AI系统优化提示词,专注于有效的提示词模式、小样本学习(few-shot learning)以及最优AI交互方式。

When to Use This Skill

适用场景

  • When building AI features or agents
  • When improving LLM response quality
  • When crafting system prompts
  • When optimizing agent performance
  • When implementing few-shot learning
  • When designing AI workflows
  • 构建AI功能或Agent时
  • 提升LLM响应质量时
  • 编写系统提示词时
  • 优化Agent性能时
  • 实现小样本学习时
  • 设计AI工作流时

What This Skill Does

技能功能

  1. Prompt Design: Creates effective prompts with clear structure
  2. Few-Shot Learning: Implements few-shot examples for better results
  3. Chain-of-Thought: Uses reasoning patterns for complex tasks
  4. Output Formatting: Specifies clear output formats
  5. Constraint Setting: Sets boundaries and constraints
  6. Performance Optimization: Improves prompt efficiency and results
  1. 提示词设计:创建结构清晰的有效提示词
  2. 小样本学习:通过小样本示例实现更优结果
  3. 思维链(Chain-of-Thought):运用推理模式处理复杂任务
  4. 输出格式化:指定清晰的输出格式
  5. 约束设置:设定边界与约束条件
  6. 性能优化:提升提示词的效率与效果

How to Use

使用方法

Optimize Prompt

优化提示词

Optimize this prompt for better results
Create a system prompt for a code review agent
Optimize this prompt for better results
Create a system prompt for a code review agent

Specific Patterns

特定模式

Implement few-shot learning for this task
Implement few-shot learning for this task

Prompt Techniques

提示词技巧

Structure

结构

Clear Sections:
  • Role definition
  • Task description
  • Constraints and boundaries
  • Output format
  • Examples
清晰分段:
  • 角色定义
  • 任务描述
  • 约束与边界
  • 输出格式
  • 示例

Few-Shot Learning

小样本学习

Pattern:
  • Provide 2-3 examples
  • Show input-output pairs
  • Demonstrate desired style
  • Include edge cases
模式:
  • 提供2-3个示例
  • 展示输入输出配对
  • 演示期望的风格
  • 包含边缘案例

Chain-of-Thought

思维链

Approach:
  • Break down complex tasks
  • Show reasoning steps
  • Encourage step-by-step thinking
  • Verify intermediate results
方法:
  • 拆解复杂任务
  • 展示推理步骤
  • 鼓励逐步思考
  • 验证中间结果

Examples

示例

Example 1: Code Review Prompt

示例1:代码审查提示词

Input: Create optimized code review prompt
Output:
markdown
undefined
输入:创建优化的代码审查提示词
输出
markdown
undefined

Optimized Prompt: Code Review

优化后的提示词:代码审查

The Prompt

提示词内容


You are an expert code reviewer with 10+ years of experience.

Review the provided code focusing on:

1. Security vulnerabilities
2. Performance optimizations
3. Code maintainability
4. Best practices

For each issue found, provide:

- Severity level (Critical/High/Medium/Low)
- Specific line numbers
- Explanation of the issue
- Suggested fix with code example

Format your response as a structured report with clear sections.

你是拥有10年以上经验的资深代码审查专家。

请针对以下方面审查提供的代码:

1. 安全漏洞
2. 性能优化点
3. 代码可维护性
4. 最佳实践

对于发现的每个问题,请提供:

- 严重程度(Critical/High/Medium/Low)
- 具体行号
- 问题说明
- 包含代码示例的修复建议

请将你的响应格式化为结构清晰的报告,分明确的章节呈现。

Techniques Used

使用的技巧

  • Role-playing for expertise
  • Clear evaluation criteria
  • Specific output format
  • Actionable feedback requirements
undefined
  • 角色扮演以体现专业性
  • 清晰的评估标准
  • 明确的输出格式
  • 可落地的反馈要求
undefined

Best Practices

最佳实践

Prompt Design

提示词设计

  1. Be Specific: Clear, unambiguous instructions
  2. Provide Examples: Show desired output format
  3. Set Constraints: Define boundaries clearly
  4. Iterate: Test and refine prompts
  5. Document: Keep track of effective patterns
  1. 明确具体:清晰、无歧义的指令
  2. 提供示例:展示期望的输出格式
  3. 设置约束:明确定义边界
  4. 迭代优化:测试并不断完善提示词
  5. 文档记录:跟踪有效的提示词模式

Related Use Cases

相关应用场景

  • AI agent development
  • LLM optimization
  • System prompt creation
  • Few-shot learning implementation
  • AI workflow design
  • AI Agent开发
  • LLM优化
  • 系统提示词创建
  • 小样本学习实现
  • AI工作流设计