prompt-optimizer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Prompt Optimizer

提示词优化器

This skill analyzes user prompts and provides optimized versions that are clearer, more specific, and more actionable.
该Skill可分析用户提示词,并提供更清晰、具体且可执行的优化版本。

Purpose

用途

Transform vague, incomplete, or ambiguous user requests into well-structured prompts that lead to better outcomes. By analyzing prompts against quality criteria and providing optimized versions, this skill helps users communicate their needs more effectively.
将模糊、不完整或存在歧义的用户请求转化为结构合理的提示词,以获得更优结果。通过对照质量标准分析提示词并提供优化版本,该Skill能帮助用户更有效地传达需求。

When to Use This Skill

何时使用该Skill

Use this skill when user prompts exhibit one or more of these issues:
当用户提示词存在以下一种或多种问题时,可使用该Skill:

Clarity Issues

清晰度问题

  • Vague language: "something", "thing", "stuff", "it", "this"
  • Ambiguous pronouns without clear referents
  • Multiple possible interpretations
  • Unclear desired outcome
  • 模糊词汇:"something"、"thing"、"stuff"、"it"、"this"
  • 指代不明的代词
  • 存在多种可能的解读
  • 期望结果不明确

Specificity Issues

具体性问题

  • Missing context about the problem domain
  • No technical specifications (language, framework, version)
  • Lack of examples when examples would help
  • Undefined scope or boundaries
  • 缺少问题领域的上下文
  • 无技术规格(语言、框架、版本)
  • 需示例但未提供
  • 范围或边界未定义

Completeness Issues

完整性问题

  • Missing required information or inputs
  • No success criteria defined
  • Undefined behavior for edge cases
  • Missing constraints or requirements
  • 缺少必要信息或输入
  • 未定义成功标准
  • 未说明边缘情况的处理方式
  • 缺少约束条件或要求

Structure Issues

结构问题

  • Disorganized information
  • Complex requests without clear structure
  • Mixing context with requests
  • No logical flow
  • 信息组织混乱
  • 复杂请求无清晰结构
  • 上下文与任务混合
  • 逻辑流程不清晰

Actionability Issues

可执行性问题

  • No clear action verb or request
  • Passive voice making intent unclear
  • Confusing or conflicting instructions
  • Missing output format specification
  • 无明确的动作动词或请求
  • 被动语态导致意图模糊
  • 指令混淆或冲突
  • 未指定输出格式

Activation Triggers

触发条件

Activate this skill when detecting:
  • Vague words: "something", "thing", "stuff", "it", "this", "that"
  • Quality indicators: "better", "good", "nice" (without criteria)
  • Incomplete requests: "help with...", "can you...", "fix..." (without details)
  • Overly broad requests: "build an app", "create a system"
  • Missing specifications in technical requests
  • Requests without clear success criteria
检测到以下情况时激活该Skill:
  • 模糊词汇:"something"、"thing"、"stuff"、"it"、"this"、"that"
  • 模糊质量表述:"better"、"good"、"nice"(无具体标准)
  • 不完整请求:"help with..."、"can you..."、"fix..."(无细节)
  • 过于宽泛的请求:"build an app"、"create a system"
  • 技术请求缺少规格说明
  • 请求无明确成功标准

Analysis Workflow

分析流程

Two modes available:
支持两种模式:

Mode 1: Interactive Questionnaire (Recommended for Complex Requests)

模式1:交互式问卷(推荐用于复杂请求)

Use the AskUserQuestion tool to guide users through structured questions. This collaborative approach helps users clarify their needs step-by-step.
When to use: Medium to complex requests, or when user prefers guided interaction.
使用AskUserQuestion工具引导用户完成结构化问题。这种协作方式可帮助用户逐步明确需求。
适用场景:中等至复杂请求,或用户偏好引导式交互时。

Mode 2: Direct Analysis (Fast)

模式2:直接分析(快速)

Analyze the prompt and provide suggested improvements in one response.
When to use: Simple optimization needs, or when user wants quick results.
Default: Start with Mode 2 (Direct Analysis). If user requests interactive mode or if the request is very complex, switch to Mode 1.

分析提示词并在一次响应中提供改进建议。
适用场景:简单优化需求,或用户希望快速获得结果时。
默认规则:先使用模式2(直接分析)。若用户请求交互式模式,或请求存在大量复杂问题,则切换至模式1。

Mode 2: Direct Analysis Workflow

模式2:直接分析流程

Step 1: Receive and Read the Prompt

步骤1:接收并阅读提示词

Carefully read the user's original prompt to understand their intent.
仔细阅读用户的原始提示词,理解其意图。

Step 2: Identify Issues

步骤2:识别问题

Systematically check for issues using
references/optimization-principles.md
:
Clarity Check:
  • Is the language specific and concrete?
  • Are all terms clearly defined?
  • Is there only one reasonable interpretation?
Specificity Check:
  • Is sufficient context provided?
  • Are technical requirements specified?
  • Are examples included when helpful?
Completeness Check:
  • Is all necessary information present?
  • Are success criteria defined?
  • Are edge cases considered?
Structure Check:
  • Is information organized logically?
  • Is the request easy to parse?
  • Is context separated from the task?
Actionability Check:
  • Is there a clear action requested?
  • Is the output format specified?
  • Are instructions unambiguous?
对照
references/optimization-principles.md
系统检查问题:
清晰度检查
  • 语言是否具体、明确?
  • 所有术语是否都有清晰定义?
  • 是否只有一种合理的解读?
具体性检查
  • 是否提供了足够的上下文?
  • 是否指定了技术要求?
  • 必要时是否包含示例?
完整性检查
  • 所有必要信息是否齐全?
  • 是否定义了成功标准?
  • 是否考虑了边缘情况?
结构检查
  • 信息是否逻辑清晰地组织?
  • 请求是否易于解析?
  • 上下文与任务是否分离?
可执行性检查
  • 是否有明确的请求动作?
  • 是否指定了输出格式?
  • 指令是否明确无歧义?

Step 3: Categorize Issues

步骤3:分类问题

List all identified issues by category:
  • Clarity problems: [list]
  • Specificity gaps: [list]
  • Completeness deficiencies: [list]
  • Structure issues: [list]
  • Actionability concerns: [list]
按类别列出所有识别出的问题:
  • 清晰度问题:[列表]
  • 具体性缺失:[列表]
  • 完整性不足:[列表]
  • 结构问题:[列表]
  • 可执行性问题:[列表]

Step 4: Generate Optimized Prompt

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

Create an improved version following these principles:
Add Specificity:
  • Replace vague terms with concrete descriptions
  • Add missing technical specifications
  • Include relevant context
Improve Clarity:
  • Use clear, unambiguous language
  • Define all terms
  • Eliminate multiple interpretations
Ensure Completeness:
  • Add missing requirements
  • Define success criteria
  • Specify constraints
Enhance Structure:
  • Organize information logically
  • Use bullet points and sections
  • Separate context from task
Make Actionable:
  • Start with clear action verb
  • Specify output format
  • Provide concrete deliverables
Reference
references/optimization-principles.md
for patterns and examples.
遵循以下原则创建改进版本:
增强具体性
  • 用具体描述替换模糊术语
  • 补充缺失的技术规格
  • 添加相关上下文
提升清晰度
  • 使用清晰、无歧义的语言
  • 定义所有术语
  • 消除多种解读可能
确保完整性
  • 补充缺失的要求
  • 定义成功标准
  • 指定约束条件
优化结构
  • 逻辑清晰地组织信息
  • 使用项目符号和分段
  • 分离上下文与任务
提升可执行性
  • 以清晰的动作动词开头
  • 指定输出格式
  • 提供具体的交付内容
参考
references/optimization-principles.md
中的模式和示例。

Step 5: Present Analysis

步骤5:呈现分析结果

Provide a structured response:
  1. Original Prompt: Show the user's original request
  2. Identified Issues: List specific problems found
    • Categorized by type
    • Brief explanation of each
  3. Optimized Prompt: Provide improved version
    • Well-structured
    • Complete
    • Actionable
  4. Key Improvements: Highlight main changes
    • What was added
    • What was clarified
    • Why it's better
  5. Optional: Offer to refine further or proceed with the optimized prompt

提供结构化响应:
  1. 原始提示词:展示用户的原始请求
  2. 识别出的问题:列出发现的具体问题
    • 按类型分类
    • 对每个问题进行简要说明
  3. 优化后的提示词:提供改进版本
    • 结构合理
    • 信息完整
    • 可执行
  4. 关键改进点:突出主要变更
    • 添加了什么内容
    • 澄清了什么信息
    • 优化后的优势
  5. 可选内容:提供进一步优化或基于优化后提示词继续执行的选项

Mode 1: Interactive Questionnaire Workflow

模式1:交互式问卷流程

When User Requests Interactive Mode

当用户请求交互式模式时

If the user explicitly asks for interactive/questionnaire mode, or if the prompt has multiple complex issues, use this workflow.
若用户明确要求使用交互式/问卷模式,或提示词存在多个复杂问题,则使用该流程。

Step 1: Quick Initial Analysis

步骤1:快速初步分析

Quickly identify the main categories of missing information:
  • Technical specifications needed?
  • Functional requirements unclear?
  • Design/styling preferences missing?
  • Scope or constraints undefined?
快速识别缺失信息的主要类别:
  • 是否需要技术规格?
  • 功能需求是否不明确?
  • 是否缺少设计/样式偏好?
  • 范围或约束是否未定义?

Step 2: Design Question Set

步骤2:设计问题集

Based on the analysis, prepare 1-4 targeted questions using AskUserQuestion tool.
Question Structure:
  • Each question should have a clear header (max 12 chars)
  • Provide 2-4 specific options
  • Include descriptions explaining each option
  • Allow "Other" for custom input (automatically provided)
Question Categories:
For Code Requests:
  1. Technology Stack (React, Vue, vanilla JS, etc.)
  2. Type System (TypeScript, JavaScript)
  3. Styling Approach (Tailwind, CSS Modules, styled-components, etc.)
  4. Feature Requirements (specific functionality needed)
For Component Requests:
  1. Component Type (Button, Form, Card, Modal, etc.)
  2. Variants Needed (primary/secondary, sizes, states)
  3. Props/API (what should it accept?)
  4. Use Cases (how will it be used?)
For UI/Design Requests:
  1. Platform (Web, Mobile, Desktop app)
  2. Design Style (Modern, Minimal, Colorful, Corporate)
  3. Responsive Needs (Mobile-first, Desktop-only, Adaptive)
  4. Key Features (what must be included?)
基于分析结果,使用AskUserQuestion工具准备1-4个针对性问题。
问题结构
  • 每个问题应有清晰的标题(最多12个字符)
  • 提供2-4个具体选项
  • 包含每个选项的说明
  • 允许“其他”自定义输入(自动提供)
问题类别
针对代码请求
  1. 技术栈(React、Vue、vanilla JS等)
  2. 类型系统(TypeScript、JavaScript)
  3. 样式方案(Tailwind、CSS Modules、styled-components等)
  4. 功能需求(所需具体功能)
针对组件请求
  1. 组件类型(Button、Form、Card、Modal等)
  2. 所需变体(primary/secondary、尺寸、状态)
  3. Props/API(应支持的参数)
  4. 使用场景(如何使用该组件)
针对UI/设计请求
  1. 平台(Web、Mobile、Desktop app)
  2. 设计风格(Modern、Minimal、Colorful、Corporate)
  3. 响应式需求(Mobile-first、Desktop-only、Adaptive)
  4. 核心功能(必须包含的内容)

Step 3: Use AskUserQuestion Tool

步骤3:使用AskUserQuestion工具

Call the AskUserQuestion tool with structured questions.
Important: Always include a final open-ended question that allows users to add custom requirements using the "Other" option.
typescript
AskUserQuestion({
  questions: [
    {
      question: "What technology stack should this use?",
      header: "Tech Stack",
      multiSelect: false,
      options: [
        {
          label: "React + TypeScript",
          description: "Modern React with full type safety"
        },
        {
          label: "React + JavaScript",
          description: "React without TypeScript"
        },
        {
          label: "Vue 3",
          description: "Vue 3 Composition API"
        },
        {
          label: "Vanilla JavaScript",
          description: "Plain JS without frameworks"
        }
      ]
    },
    {
      question: "What styling approach would you like?",
      header: "Styling",
      multiSelect: false,
      options: [
        {
          label: "Tailwind CSS",
          description: "Utility-first CSS framework"
        },
        {
          label: "CSS Modules",
          description: "Scoped CSS with modules"
        },
        {
          label: "styled-components",
          description: "CSS-in-JS solution"
        }
      ]
    },
    {
      question: "Which features are needed?",
      header: "Features",
      multiSelect: true,
      options: [
        {
          label: "Multiple variants",
          description: "Different color/style variants (primary, secondary, etc.)"
        },
        {
          label: "Size options",
          description: "Different sizes (sm, md, lg)"
        },
        {
          label: "Loading state",
          description: "Show spinner during async operations"
        },
        {
          label: "Disabled state",
          description: "Disabled/inactive state"
        }
      ]
    },
    {
      question: "Any additional requirements or constraints?",
      header: "Extra Needs",
      multiSelect: false,
      options: [
        {
          label: "No, that's all",
          description: "I don't need anything else"
        },
        {
          label: "Yes, let me specify",
          description: "I have additional requirements (use 'Other' to describe)"
        }
      ]
    }
  ]
})
Note: The "Other" option is automatically provided by AskUserQuestion tool, allowing users to input custom text for any question.
调用AskUserQuestion工具并传入结构化问题。
重要提示:始终添加一个开放式问题,允许用户通过“其他”选项添加自定义需求。
typescript
AskUserQuestion({
  questions: [
    {
      question: "What technology stack should this use?",
      header: "Tech Stack",
      multiSelect: false,
      options: [
        {
          label: "React + TypeScript",
          description: "Modern React with full type safety"
        },
        {
          label: "React + JavaScript",
          description: "React without TypeScript"
        },
        {
          label: "Vue 3",
          description: "Vue 3 Composition API"
        },
        {
          label: "Vanilla JavaScript",
          description: "Plain JS without frameworks"
        }
      ]
    },
    {
      question: "What styling approach would you like?",
      header: "Styling",
      multiSelect: false,
      options: [
        {
          label: "Tailwind CSS",
          description: "Utility-first CSS framework"
        },
        {
          label: "CSS Modules",
          description: "Scoped CSS with modules"
        },
        {
          label: "styled-components",
          description: "CSS-in-JS solution"
        }
      ]
    },
    {
      question: "Which features are needed?",
      header: "Features",
      multiSelect: true,
      options: [
        {
          label: "Multiple variants",
          description: "Different color/style variants (primary, secondary, etc.)"
        },
        {
          label: "Size options",
          description: "Different sizes (sm, md, lg)"
        },
        {
          label: "Loading state",
          description: "Show spinner during async operations"
        },
        {
          label: "Disabled state",
          description: "Disabled/inactive state"
        }
      ]
    },
    {
      question: "Any additional requirements or constraints?",
      header: "Extra Needs",
      multiSelect: false,
      options: [
        {
          label: "No, that's all",
          description: "I don't need anything else"
        },
        {
          label: "Yes, let me specify",
          description: "I have additional requirements (use 'Other' to describe)"
        }
      ]
    }
  ]
})
注意:“其他”选项由AskUserQuestion工具自动提供,允许用户为任意问题输入自定义文本。

Step 4: Process Answers

步骤4:处理答案

After receiving user's answers:
  1. Extract all selected options from each question
  2. Handle "Other" responses if user provided custom input
  3. Pay special attention to the "Extra Needs" question:
    • If user selected "Yes, let me specify" and provided text in "Other", include those requirements
    • If user selected "No, that's all", proceed without additional requirements
  4. Combine all answers with original request
收到用户答案后:
  1. 提取每个问题的所有选中选项
  2. 若用户提供了“其他”自定义输入,则进行处理
  3. 特别关注“额外需求”问题:
    • 若用户选择“需要,让我补充”并在“其他”中输入内容,则包含这些需求
    • 若用户选择“不需要,就这些”,则无需添加额外需求
  4. 将所有答案与原始请求结合

Step 5: Generate Optimized Prompt

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

Using the gathered information, create a complete, well-structured prompt:
markdown
undefined
结合收集到的信息,创建完整、结构合理的提示词:
markdown
undefined

Optimized Prompt (Based on Your Answers)

优化后的提示词(基于你的答案)

[Combine original intent + user's answers into structured prompt]
Technology: [Answer 1] Styling: [Answer 2] Features: [Answer 3, Answer 4, ...]
[Full detailed requirements...]
undefined
[将原始意图与用户答案结合为结构化提示词]
技术栈:[答案1] 样式方案:[答案2] 功能:[答案3, 答案4, ...]
[详细需求说明...]
undefined

Step 6: Confirm and Proceed

步骤6:确认并执行

Ask user if the optimized prompt looks good, or if they want to adjust anything:
markdown
undefined
询问用户优化后的提示词是否合适,或是否需要调整:
markdown
undefined

Does this look good?

这个版本是否符合要求?

  1. ✅ Yes, proceed with this specification
  2. 🔄 Let me adjust some details
  3. ➕ Add more requirements
undefined
  1. ✅ 是,按此规格执行
  2. 🔄 我想调整一些细节
  3. ➕ 添加更多需求
undefined

Example Interactive Flow

交互式流程示例

User: "生成个按钮"
Prompt Optimizer (Interactive Mode):
我会通过几个问题来帮你明确需求。

[Calls AskUserQuestion with 4 targeted questions]

Question 1: 使用什么技术栈?
- React + TypeScript
- React + JavaScript
- Vue 3
- Other

Question 2: 使用什么样式方案?
- Tailwind CSS
- CSS Modules
- styled-components
- Other

Question 3: 需要哪些功能?(可多选)
- 多种变体 (primary, secondary, danger等)
- 多种尺寸 (sm, md, lg)
- Loading 状态
- Disabled 状态

Question 4: 还有其他需求或约束吗?
- 不需要,就这些
- 需要,让我补充 (可以在 "Other" 中输入)
Example 1 - User without extra needs: User selects: React + TypeScript, Tailwind CSS, [多种变体, Loading 状态], "不需要,就这些"
Prompt Optimizer:
undefined
用户:"生成个按钮"
提示词优化器(交互式模式)
我会通过几个问题来帮你明确需求。

[调用AskUserQuestion工具,传入4个针对性问题]

问题1:使用什么技术栈?
- React + TypeScript
- React + JavaScript
- Vue 3
- 其他

问题2:使用什么样式方案?
- Tailwind CSS
- CSS Modules
- styled-components
- 其他

问题3:需要哪些功能?(可多选)
- 多种变体 (primary, secondary, danger等)
- 多种尺寸 (sm, md, lg)
- Loading 状态
- Disabled 状态

问题4:还有其他需求或约束吗?
- 不需要,就这些
- 需要,让我补充 (可以在 "其他" 中输入)
示例1 - 用户无额外需求: 用户选择:React + TypeScript、Tailwind CSS、[多种变体, Loading 状态]、"不需要,就这些"
提示词优化器
undefined

优化后的需求

优化后的需求

基于你的选择,这是完整的需求规格:
创建一个 React Button 组件,使用 TypeScript 和 Tailwind CSS。
技术栈:
  • React + TypeScript
  • Tailwind CSS 样式
功能需求:
  • 支持多种变体:primary (蓝色), secondary (灰色), danger (红色)
  • 支持 loading 状态(显示 spinner)
  • Props 定义:
    • variant: 'primary' | 'secondary' | 'danger'
    • loading?: boolean
    • onClick?: () => void
    • children: React.ReactNode
    • className?: string
这样可以吗?
  1. ✅ 可以,开始生成
  2. 🔄 我想调整一下

**Example 2 - User with extra needs**:
User selects: React + TypeScript, Tailwind CSS, [多种变体, Loading 状态], "Other: 需要支持图标,并且要有 fullWidth 选项让按钮占满整行"

**Prompt Optimizer**:
基于你的选择,这是完整的需求规格:
创建一个 React Button 组件,使用 TypeScript 和 Tailwind CSS。
技术栈:
  • React + TypeScript
  • Tailwind CSS 样式
功能需求:
  • 支持多种变体:primary (蓝色), secondary (灰色), danger (红色)
  • 支持 loading 状态(显示 spinner)
  • Props 定义:
    • variant: 'primary' | 'secondary' | 'danger'
    • loading?: boolean
    • onClick?: () => void
    • children: React.ReactNode
    • className?: string
这样可以吗?
  1. ✅ 可以,开始生成
  2. 🔄 我想调整一下

**示例2 - 用户有额外需求**:
用户选择:React + TypeScript、Tailwind CSS、[多种变体, Loading 状态]、"其他: 需要支持图标,并且要有 fullWidth 选项让按钮占满整行"

**提示词优化器**:

优化后的需求

优化后的需求

基于你的选择,这是完整的需求规格:
创建一个 React Button 组件,使用 TypeScript 和 Tailwind CSS。
技术栈:
  • React + TypeScript
  • Tailwind CSS 样式
功能需求:
  • 支持多种变体:primary (蓝色), secondary (灰色), danger (红色)
  • 支持 loading 状态(显示 spinner)
  • ✨ 支持图标显示(用户补充)
  • ✨ 支持 fullWidth 选项让按钮占满整行(用户补充)
Props 定义:
  • variant: 'primary' | 'secondary' | 'danger'
  • loading?: boolean
  • icon?: React.ReactNode
  • iconPosition?: 'left' | 'right'
  • fullWidth?: boolean
  • onClick?: () => void
  • children: React.ReactNode
  • className?: string
这样可以吗?
  1. ✅ 可以,开始生成
  2. 🔄 我想调整一下

---
基于你的选择,这是完整的需求规格:
创建一个 React Button 组件,使用 TypeScript 和 Tailwind CSS。
技术栈:
  • React + TypeScript
  • Tailwind CSS 样式
功能需求:
  • 支持多种变体:primary (蓝色), secondary (灰色), danger (红色)
  • 支持 loading 状态(显示 spinner)
  • ✨ 支持图标显示(用户补充)
  • ✨ 支持 fullWidth 选项让按钮占满整行(用户补充)
Props 定义:
  • variant: 'primary' | 'secondary' | 'danger'
  • loading?: boolean
  • icon?: React.ReactNode
  • iconPosition?: 'left' | 'right'
  • fullWidth?: boolean
  • onClick?: () => void
  • children: React.ReactNode
  • className?: string
这样可以吗?
  1. ✅ 可以,开始生成
  2. 🔄 我想调整一下

---

Output Format

输出格式

Structure the output as follows:
markdown
undefined
按以下结构组织输出:
markdown
undefined

Prompt Analysis

提示词分析

Original Prompt

原始提示词

[User's original request]
[用户的原始请求]

Identified Issues

识别出的问题

Clarity:
  • [Issue 1]
  • [Issue 2]
Specificity:
  • [Issue 1]
  • [Issue 2]
Completeness:
  • [Issue 1]
[Other categories as applicable]
清晰度
  • [问题1]
  • [问题2]
具体性
  • [问题1]
  • [问题2]
完整性
  • [问题1]
[其他适用类别]

Optimized Prompt

优化后的提示词

[Improved, well-structured version]
[改进后的结构合理版本]

Key Improvements

关键改进点

  • ✅ [Improvement 1]
  • ✅ [Improvement 2]
  • ✅ [Improvement 3]
  • ✅ [改进点1]
  • ✅ [改进点2]
  • ✅ [改进点3]

Next Steps

下一步

Would you like me to:
  1. Proceed with the optimized prompt?
  2. Refine it further based on your feedback?
  3. Focus on a specific aspect?
undefined
你希望我:
  1. 按优化后的提示词执行?
  2. 根据你的反馈进一步优化?
  3. 专注于特定方面?
undefined

Example Workflows

流程示例

Example 1: Vague Code Request

示例1:模糊代码请求

User: "Make a button"
Analysis:
  • Missing: language/framework
  • Missing: styling requirements
  • Missing: functionality details
  • Missing: props/API
Optimized:
Create a reusable Button component in React with TypeScript and Tailwind CSS.

Requirements:
- Support variants: primary, secondary, danger
- Support sizes: sm, md, lg
- Accept onClick handler and children
- Include loading and disabled states
- Proper TypeScript types for all props

Example usage:
<Button variant="primary" size="md" onClick={handleClick}>
  Click me
</Button>
用户:"Make a button"
分析
  • 缺失:语言/框架
  • 缺失:样式需求
  • 缺失:功能细节
  • 缺失:props/API
优化后
Create a reusable Button component in React with TypeScript and Tailwind CSS.

Requirements:
- Support variants: primary, secondary, danger
- Support sizes: sm, md, lg
- Accept onClick handler and children
- Include loading and disabled states
- Proper TypeScript types for all props

Example usage:
<Button variant="primary" size="md" onClick={handleClick}>
  Click me
</Button>

Example 2: Incomplete Bug Report

示例2:不完整的Bug报告

User: "The app crashes"
Analysis:
  • Missing: where/when it crashes
  • Missing: error message
  • Missing: reproduction steps
  • Missing: expected behavior
Optimized:
Debug and fix the crash in the Shopping Cart component.

Current behavior:
- App crashes when clicking "Checkout" button
- Only when cart has more than 5 items
- Console error: "Cannot read property 'price' of undefined"

Location:
- File: src/components/ShoppingCart.tsx
- Started after recent pricing logic refactor

Expected behavior:
- Checkout button should work regardless of cart size
- Should navigate to checkout page

Steps to reproduce:
1. Add 6+ items to cart
2. Click "Checkout" button
3. Observe crash
用户:"The app crashes"
分析
  • 缺失:崩溃的时间/场景
  • 缺失:错误信息
  • 缺失:复现步骤
  • 缺失:预期行为
优化后
Debug and fix the crash in the Shopping Cart component.

Current behavior:
- App crashes when clicking "Checkout" button
- Only when cart has more than 5 items
- Console error: "Cannot read property 'price' of undefined"

Location:
- File: src/components/ShoppingCart.tsx
- Started after recent pricing logic refactor

Expected behavior:
- Checkout button should work regardless of cart size
- Should navigate to checkout page

Steps to reproduce:
1. Add 6+ items to cart
2. Click "Checkout" button
3. Observe crash

Example 3: Broad Request

示例3:宽泛请求

User: "Build a dashboard"
Analysis:
  • Too broad, no scope
  • Missing: what data to display
  • Missing: technical requirements
  • Missing: design requirements
Optimized:
Create a responsive analytics dashboard with the following requirements:

Data to Display:
- User statistics (total users, active users, new signups)
- Revenue metrics (daily, weekly, monthly)
- Traffic sources (chart showing breakdown)
- Recent activity feed

Technical Requirements:
- React with TypeScript
- Chart library: Chart.js or Recharts
- State management: Zustand
- Styling: Tailwind CSS
- Responsive design (mobile, tablet, desktop)

Features:
- Date range filter
- Data refresh button
- CSV export functionality
- Loading states for data fetching

Layout:
- Grid layout with stat cards at top
- Charts in middle section
- Activity feed on the side or bottom
用户:"Build a dashboard"
分析
  • 范围过于宽泛
  • 缺失:需展示的数据
  • 缺失:技术需求
  • 缺失:设计需求
优化后
Create a responsive analytics dashboard with the following requirements:

Data to Display:
- User statistics (total users, active users, new signups)
- Revenue metrics (daily, weekly, monthly)
- Traffic sources (chart showing breakdown)
- Recent activity feed

Technical Requirements:
- React with TypeScript
- Chart library: Chart.js or Recharts
- State management: Zustand
- Styling: Tailwind CSS
- Responsive design (mobile, tablet, desktop)

Features:
- Date range filter
- Data refresh button
- CSV export functionality
- Loading states for data fetching

Layout:
- Grid layout with stat cards at top
- Charts in middle section
- Activity feed on the side or bottom

Quality Criteria Reference

质量标准参考

Consult
references/optimization-principles.md
for:
  • Prompt Quality Checklist - Systematic evaluation criteria
  • Common Prompt Patterns - Templates for different request types
  • Red Flags - Indicators of poor prompt quality
  • Optimization Strategies - Techniques by problem type
  • Full Examples - Before/after optimization examples
查阅
references/optimization-principles.md
获取以下内容:
  • 提示词质量检查表 - 系统评估标准
  • 常见提示词模式 - 不同请求类型的模板
  • 警示信号 - 提示词质量差的指标
  • 优化策略 - 按问题类型分类的技巧
  • 完整示例 - 优化前后的对比示例

Special Cases

特殊情况处理

When the Prompt is Already Good

当提示词已符合要求时

If the user's prompt is already clear, specific, and complete:
  1. Acknowledge the quality of the prompt
  2. Note what makes it effective
  3. Proceed directly with the task
  4. Don't over-optimize
若用户的提示词已清晰、具体且完整:
  1. 认可提示词的质量
  2. 说明其有效的原因
  3. 直接执行任务
  4. 无需过度优化

When Clarification is Needed

当需要澄清信息时

If critical information is missing and cannot be reasonably assumed:
  1. Identify what's missing
  2. Ask targeted clarifying questions
  3. Provide options when applicable
  4. Suggest a framework for their answer
若缺失关键信息且无法合理假设:
  1. 识别缺失内容
  2. 提出针对性的澄清问题
  3. 适用时提供选项
  4. 为用户的回答提供框架建议

When Multiple Interpretations Exist

当存在多种解读时

If the prompt is ambiguous:
  1. Identify the different possible interpretations
  2. Present them clearly to the user
  3. Ask which interpretation is correct
  4. Or suggest the most likely interpretation and ask for confirmation
若提示词存在歧义:
  1. 识别不同的可能解读
  2. 清晰地呈现给用户
  3. 询问用户正确的解读
  4. 或建议最可能的解读并请求确认

When the Request is Too Broad

当请求范围过宽时

If the scope is unrealistic:
  1. Break it down into phases or components
  2. Suggest starting with a specific part
  3. Provide a prioritized list
  4. Recommend an MVP approach
若范围不切实际:
  1. 将其拆分为多个阶段或组件
  2. 建议从特定部分开始
  3. 提供优先级列表
  4. 推荐MVP(最小可行产品)方法

Integration with Other Skills

与其他Skill的集成

Before Other Skills Activate

在其他Skill激活前

This skill can serve as a "pre-processor":
  1. Optimize the prompt first
  2. The optimized prompt then triggers appropriate skills
  3. Other skills work with clearer requirements
该Skill可作为“预处理器”:
  1. 先优化提示词
  2. 优化后的提示词触发相应的Skill
  3. 其他Skill基于更清晰的需求工作

Working with request-analyzer

与request-analyzer协作

When
request-analyzer
skill is available:
  • request-analyzer
    identifies when optimization is needed
  • prompt-optimizer
    performs the optimization
  • request-analyzer
    can then re-analyze the optimized prompt
request-analyzer
Skill可用时:
  • request-analyzer
    识别是否需要优化
  • prompt-optimizer
    执行优化操作
  • request-analyzer
    可重新分析优化后的提示词

Best Practices

最佳实践

  1. Be helpful, not pedantic - Focus on meaningful improvements
  2. Maintain user intent - Don't change what they're asking for
  3. Add value - Only optimize when it genuinely helps
  4. Be concise - Don't over-explain obvious changes
  5. Stay respectful - Frame as helpful enhancement, not criticism
  6. Offer options - When multiple valid interpretations exist
  7. Know when to skip - If prompt is already good, proceed directly
  1. 提供帮助而非挑剔 - 专注于有意义的改进
  2. 保留用户意图 - 不要改变用户的核心请求
  3. 创造价值 - 仅在真正有帮助时进行优化
  4. 简洁明了 - 不要过度解释明显的变更
  5. 保持尊重 - 将优化表述为有用的增强,而非批评
  6. 提供选项 - 当存在多种有效解读时
  7. 懂得适时跳过 - 若提示词已符合要求,直接执行

Important Notes

重要提示

  • Always preserve the user's core intent and goals
  • Don't make assumptions about technical choices unless necessary
  • Clearly mark assumptions when made
  • Offer to refine based on user feedback
  • Sometimes asking a clarifying question is better than assuming
  • Balance between thoroughness and practicality
  • The goal is better outcomes, not perfect prompts
  • 始终保留用户的核心意图和目标
  • 除非必要,不要对技术选择做出假设
  • 若做出假设,需明确标记
  • 提供基于用户反馈的优化选项
  • 有时提出澄清问题比假设更好
  • 在全面性与实用性之间取得平衡
  • 目标是获得更好的结果,而非追求完美的提示词