prompt-optimizer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Prompt Optimizer

提示词优化器

Overview

概述

Evaluate prompt quality, provide targeted improvement suggestions, and generate optimized versions using 58 proven prompting techniques. This skill systematically analyzes prompts across multiple quality dimensions and applies evidence-based optimization patterns.
评估提示词质量,提供针对性改进建议,并使用58种经过验证的提示词技术生成优化版本。本Skill会从多个质量维度系统性地分析提示词,并应用基于实证的优化模式。

Quick Start

快速开始

For most optimization tasks, follow this workflow:
  1. Analyze the current prompt - Read and understand what the user wants to achieve
  2. Evaluate quality - Assess across clarity, specificity, structure, completeness
  3. Load relevant techniques - Read references/prompt-techniques.md for applicable methods
  4. Generate suggestions - Use evaluation results and techniques to propose improvements
  5. Create optimized version - Apply chosen techniques to produce an enhanced prompt
对于大多数优化任务,请遵循以下工作流程:
  1. 分析当前提示词 - 阅读并理解用户的目标需求
  2. 评估质量 - 从清晰度、明确性、结构、完整性等维度进行评估
  3. 加载相关技术 - 阅读references/prompt-techniques.md获取适用方法
  4. 生成改进建议 - 结合评估结果和相关技术提出改进方案
  5. 创建优化版本 - 应用选定的技术生成改进后的提示词

Evaluation Workflow

评估工作流程

When a user asks to optimize or evaluate a prompt:
当用户要求优化或评估提示词时:

Step 1: Load Quality Framework

步骤1:加载质量框架

Read references/quality-framework.md to understand evaluation dimensions:
  • Clarity - Is the prompt unambiguous and easy to understand?
  • Specificity - Are requirements and constraints clearly defined?
  • Structure - Does it follow logical organization?
  • Completeness - Does it include all necessary context and instructions?
  • Tone - Is the voice appropriate for the task?
  • Constraints - Are boundaries and limitations clear?
阅读references/quality-framework.md了解评估维度:
  • 清晰度 - 提示词是否明确无歧义、易于理解?
  • 明确性 - 需求和约束是否清晰定义?
  • 结构 - 是否遵循逻辑化的组织方式?
  • 完整性 - 是否包含所有必要的上下文和指令?
  • 语气 - 表述语气是否符合任务场景?
  • 约束条件 - 边界和限制是否明确?

Step 2: Perform Quality Assessment

步骤2:执行质量评估

Evaluate the prompt against each dimension:
For each quality dimension:
1. Identify strengths (what works well)
2. Identify weaknesses (what's missing or unclear)
3. Rate quality (Poor/Fair/Good/Excellent)
4. Note specific improvement opportunities
针对每个维度评估提示词:
对于每个质量维度:
1. 识别优势(表现良好的部分)
2. 识别不足(缺失或模糊的部分)
3. 评定质量等级(差/一般/良好/优秀)
4. 记录具体的改进方向

Step 3: Identify Applicable Techniques

步骤3:确定适用技术

Load references/prompt-techniques.md and identify techniques that address the identified weaknesses.
Example mapping:
  • Weak: "Be creative" → Apply: Role-play or Creative Persona
  • Weak: "Write an essay" → Apply: Chain of Thought or Step-by-Step
  • Weak: "Summarize this" → Apply: Few-shot Learning with examples
加载references/prompt-techniques.md,确定能够解决已识别问题的技术。
示例映射:
  • 问题:“要有创意” → 应用:角色扮演创意角色设定
  • 问题:“写一篇文章” → 应用:思维链(CoT)分步引导
  • 问题:“总结这段内容” → 应用:带示例的少样本学习

Step 4: Generate Optimization Plan

步骤4:生成优化方案

Create a structured optimization plan:
  1. Priority improvements - High-impact changes that address multiple weaknesses
  2. Optional enhancements - Nice-to-have techniques that boost performance
  3. Technique combinations - Suggest technique pairings for specific use cases
制定结构化的优化方案:
  1. 优先级改进 - 能够解决多个问题的高影响力修改
  2. 可选增强 - 可提升效果的锦上添花型技术
  3. 技术组合 - 针对特定场景建议技术搭配方案

Step 5: Generate Optimized Prompt

步骤5:生成优化后的提示词

Apply the selected techniques to create an improved version:
  • Preserve original intent and requirements
  • Add structure and clarity where missing
  • Embed examples, constraints, or guidance as needed
  • Maintain appropriate tone and voice
应用选定的技术创建改进版本:
  • 保留原始意图和需求
  • 在缺失的地方补充结构和清晰度
  • 根据需要嵌入示例、约束条件或指导内容
  • 保持合适的语调和语气

Optimization Patterns

优化模式

For common optimization scenarios, use these proven patterns:
针对常见优化场景,使用以下经过验证的模式:

Ambiguous Requests → Structured Breakdown

模糊请求 → 结构化拆解

When prompt lacks clarity:
  1. Add explicit task definition
  2. Break into sub-tasks with numbered steps
  3. Include output format specification
  4. Add completion criteria
当提示词缺乏清晰度时:
  1. 添加明确的任务定义
  2. 将任务拆解为带编号的子步骤
  3. 明确输出格式要求
  4. 补充完成标准

Generic Tasks → Technique Enhancement

通用任务 → 技术增强

When prompt is too broad:
  1. Apply relevant technique from references/prompt-techniques.md
  2. Add examples (few-shot) or reasoning steps (CoT)
  3. Include role or persona guidance
  4. Specify evaluation criteria
当提示词过于宽泛时:
  1. 应用references/prompt-techniques.md中的相关技术
  2. 添加示例(少样本)或推理步骤(CoT)
  3. 包含角色或人设指导
  4. 明确评估标准

Missing Context → Scenario Framing

缺失上下文 → 场景构建

When prompt lacks background:
  1. Add user intent/goal statement
  2. Include target audience specification
  3. Define success metrics
  4. Add relevant constraints or boundaries
当提示词缺乏背景信息时:
  1. 添加用户意图/目标说明
  2. 明确目标受众
  3. 定义成功指标
  4. 补充相关约束或边界

Weak Instructions → Actionable Steps

模糊指令 → 可执行步骤

When prompt provides vague guidance:
  1. Convert abstract concepts to concrete actions
  2. Add step-by-step instructions
  3. Include quality checkpoints
  4. Specify expected output format
当提示词提供的指导模糊时:
  1. 将抽象概念转化为具体动作
  2. 添加分步指令
  3. 包含质量检查点
  4. 明确预期输出格式

Script Usage

脚本使用

Quality Evaluation

质量评估

For consistent, repeatable evaluation:
bash
python3 scripts/evaluate.py "Your prompt here"
This provides:
  • Dimension scores (clarity, specificity, structure, completeness)
  • Overall quality rating
  • Detailed weakness analysis
  • Suggested improvement areas
为了实现一致、可重复的评估:
bash
python3 scripts/evaluate.py "Your prompt here"
该脚本会输出:
  • 维度得分(清晰度、明确性、结构、完整性)
  • 整体质量评级
  • 详细的问题分析
  • 建议的改进方向

Prompt Optimization

提示词优化

For automatic optimization generation:
bash
python3 scripts/optimize.py "Your prompt here" --techniques "few-shot,coT"
This generates:
  • Multiple optimized prompt versions
  • Explanation of applied techniques
  • Comparison with original prompt
Note: Scripts should be used for automation or when you need deterministic results. For complex optimization tasks, use the manual workflow for more nuanced analysis.
用于自动生成优化版本:
bash
python3 scripts/optimize.py "Your prompt here" --techniques "few-shot,coT"
该脚本会生成:
  • 多个优化后的提示词版本
  • 所应用技术的说明
  • 与原始提示词的对比
注意: 脚本适用于自动化场景或需要确定性结果的情况。对于复杂的优化任务,建议使用手动工作流程以获得更细致的分析。

Reference Files

参考文件

references/prompt-techniques.md

references/prompt-techniques.md

Complete catalog of 58 prompting techniques including:
  • Reasoning techniques (CoT, Tree of Thoughts, Decomposition)
  • Context techniques (Few-shot, Self-Consistency, Reflection)
  • Creative techniques (Role-play, Scenario, Persona)
  • Structural techniques (Template, Framework, Checklists)
  • And 50+ more with usage examples
Load this when you need to identify applicable techniques for a specific optimization task.
包含58种提示词技术的完整目录,包括:
  • 推理技术(CoT、思维树、分解法)
  • 上下文技术(少样本、自洽性、反思法)
  • 创意技术(角色扮演、场景设定、人设)
  • 结构化技术(模板、框架、检查清单)
  • 以及50余种其他技术及使用示例
当你需要为特定优化任务确定适用技术时,请查阅此文件。

references/quality-framework.md

references/quality-framework.md

Detailed evaluation framework with:
  • Dimension-specific criteria and rubrics
  • Scoring guidelines
  • Common anti-patterns to avoid
  • Quality benchmarks for different prompt types
Load this before any evaluation task to ensure consistent assessment.
详细的评估框架,包含:
  • 各维度的具体标准和评分细则
  • 评分指南
  • 需要避免的常见反模式
  • 不同类型提示词的质量基准
在执行任何评估任务前,请先查阅此文件以确保评估的一致性。

references/optimization-patterns.md

references/optimization-patterns.md

Collection of proven optimization patterns including:
  • Pattern → Technique mappings
  • Before/after examples
  • Technique combination guidelines
  • Use-case specific templates
Load this when optimizing common prompt types (essays, code generation, analysis, etc.).
经过验证的优化模式集合,包括:
  • 模式→技术映射
  • 优化前后示例
  • 技术组合指南
  • 特定场景模板
当优化常见类型的提示词(如文章、代码生成、分析等)时,请查阅此文件。

Best Practices

最佳实践

  1. Preserve user intent - Never change what the user wants, only how they ask for it
  2. Add incrementally - Apply one technique at a time and evaluate impact
  3. Test iteratively - After optimization, test the prompt and refine further if needed
  4. Document choices - Explain which techniques you applied and why
  5. Provide options - Offer multiple optimization versions when appropriate
  1. 保留用户意图 - 永远不要改变用户的需求,只优化表述方式
  2. 增量式改进 - 一次应用一种技术并评估效果
  3. 迭代测试 - 优化后测试提示词,如有需要进一步完善
  4. 记录选择 - 说明你应用了哪些技术及原因
  5. 提供选项 - 适当时提供多个优化版本

When This Skill Should Trigger

本Skill的触发场景

This skill should be activated when:
  • User explicitly asks to "optimize," "improve," or "evaluate" a prompt
  • User asks if a prompt is "good" or "clear"
  • User wants to "fix" or "enhance" a prompt that isn't working well
  • User requests "better versions" of a prompt
  • User asks about prompt engineering techniques or best practices
  • User wants to analyze why a prompt is producing poor results
在以下场景下应激活本Skill:
  • 用户明确要求“优化”“改进”或“评估”提示词
  • 用户询问某个提示词是否“好”或“清晰”
  • 用户想要“修复”或“增强”效果不佳的提示词
  • 用户请求提示词的“更好版本”
  • 用户询问提示词工程技术或最佳实践
  • 用户想要分析提示词效果不佳的原因