prompt-refinement

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Prompt Refinement Skill

提示词优化Skill

Critical Importance

关键重要性

Proper prompt refinement is critical for achieving optimal AI response quality. Vague or ambiguous prompts lead to inconsistent results, wasted iterations, and frustration. A well-structured prompt with clear task definition, rich context, explicit requirements, and specific output format dramatically improves AI performance. Each refinement iteration compounds the quality improvement—investing time upfront saves countless back-and-forth cycles later. Poor prompt quality is the #1 cause of unsatisfactory AI interactions.
恰当的提示词优化对于获得最佳AI响应质量至关重要。 模糊或歧义的提示词会导致结果不一致、迭代浪费和使用挫败感。一个具备清晰任务定义、丰富上下文、明确要求和特定输出格式的结构化提示词,能大幅提升AI的表现。每一次优化迭代都会积累质量提升效果——前期投入时间能节省后续无数的反复沟通。提示词质量不佳是AI交互结果不达预期的首要原因。

Systematic Approach

系统化方法

** approach prompt refinement systematically.** Prompt refinement requires active listening, clarifying questions, and structured thinking. Don't assume understanding—ask targeted questions to uncover implicit requirements, constraints, and expectations. Use the TCRO framework as your organizing principle: Task (what), Context (why), Requirements (how), Output (what it looks like). Iterate until all four elements are clear, specific, and actionable. Patience in refinement pays off in execution.
采用系统化方式进行提示词优化。 提示词优化需要主动倾听、澄清疑问和结构化思考。不要假设自己已经理解——提出针对性问题,挖掘隐含的需求、约束和期望。以TCRO框架作为组织原则:Task(任务内容)、Context(背景信息)、Requirements(要求约束)、Output(输出形式)。反复迭代,直到这四个要素都清晰、具体且可执行。优化阶段的耐心会在执行阶段得到回报。

The Challenge

挑战

The transform vague user input into perfectly structured prompts without over-constraining creativity or missing the true intent, but if you can:
  • Your AI responses will be consistently excellent
  • Users will get what they actually want
  • Iteration cycles will shrink dramatically
  • You'll establish trust in AI-assisted workflows
The challenge is extracting enough detail to guide the AI without boxing in the solution or asking too many exhausting questions. Can you find the sweet spot between clarity and efficiency?
将模糊的用户输入转换为结构完美的提示词,同时不过度限制创造力或偏离用户真实意图,若能做到:
  • 你的AI响应会始终保持高质量
  • 用户能获得真正需要的结果
  • 迭代周期会大幅缩短
  • 你将在AI辅助工作流中建立信任
挑战在于提取足够的细节来引导AI,同时不限制解决方案的可能性,也不会提出过多让用户疲惫的问题。你能在清晰度和效率之间找到平衡点吗?

Prompt Refinement Confidence Assessment

提示词优化信心评估

After refining a prompt, rate your confidence from 0.0 to 1.0:
  • 0.8-1.0: Prompt perfectly structured, all ambiguities resolved, constraints explicit, output format clear
  • 0.5-0.8: Prompt well-structured but minor uncertainties remain, some assumptions documented
  • 0.2-0.5: Prompt partially structured, several ambiguities, risk of misalignment with user intent
  • 0.0-0.2: Prompt still vague, missing critical information, high likelihood of poor results
Identify uncertainty areas: What aspects of the task are still unclear? Which requirements are assumed rather than explicit? What could go wrong based on the current prompt structure?
优化提示词后,从0.0到1.0为你的信心评分:
  • 0.8-1.0:提示词结构完美,所有歧义已解决,约束条件明确,输出格式清晰
  • 0.5-0.8:提示词结构良好,但仍存在少量不确定因素,部分假设已记录
  • 0.2-0.5:提示词结构不完整,存在多处歧义,有偏离用户意图的风险
  • 0.0-0.2:提示词仍模糊不清,缺少关键信息,极可能产生不佳结果
识别不确定区域:任务的哪些方面仍不清晰?哪些要求是假设而非明确提出的?基于当前提示词结构,可能会出现哪些问题?

Purpose

目的

Transform messy, incomplete prompts into well-structured specifications using the TCRO framework (Task, Context, Requirements, Output) with phase-specific clarifying questions. This skill ensures all user prompts to ai-eng-system commands are properly structured before execution, reducing ambiguity, increasing reproducibility, and improving AI response quality.
通过TCRO框架(Task、Context、Requirements、Output)结合阶段专属的澄清问题,将杂乱、不完整的提示词转换为结构清晰的规范。该技能确保所有发送至ai-eng-system命令的用户提示词在执行前都经过恰当梳理,减少歧义、提升可重复性并改善AI响应质量。

When This Skill is Invoked

技能触发时机

This skill is ALWAYS invoked at the start of:
  • /ai-eng/research
  • /ai-eng/specify
  • /ai-eng/plan
  • /ai-eng/work
Commands should include this directive:
markdown
Use skill: prompt-refinement
Phase: [research|specify|plan|work]
该技能始终会在以下命令启动时触发:
  • /ai-eng/research
  • /ai-eng/specify
  • /ai-eng/plan
  • /ai-eng/work
命令中应包含以下指令:
markdown
Use skill: prompt-refinement
Phase: [research|specify|plan|work]

The TCRO Framework

TCRO框架

ElementPurposeKey Question
TaskWhat's the job to be done?"What specific outcome do you need?"
ContextWhy does this matter?"What's the broader system/goal?"
RequirementsWhat are the constraints?"What are the must-haves vs nice-to-haves?"
OutputWhat format is needed?"What should the deliverable look like?"
要素目的核心问题
Task需要完成的具体工作是什么?"你需要的具体成果是什么?"
Context这件事的重要性体现在哪里?"更广泛的系统/目标是什么?"
Requirements有哪些约束条件?"哪些是必备要求,哪些是锦上添花的需求?"
Output需要什么格式?"交付成果应该是什么样的?"

Process

流程

Step 1: Read Project Context

步骤1:读取项目背景

Load
CLAUDE.md
from the project root to understand:
  • Project philosophy and core principles
  • Tech stack preferences
  • Quality standards and conventions
  • Naming conventions
  • Architectural patterns
加载项目根目录下的
CLAUDE.md
文件,了解:
  • 项目理念和核心原则
  • 技术栈偏好
  • 质量标准和约定
  • 命名规范
  • 架构模式

Step 2: Detect Phase

步骤2:检测阶段

Determine which phase based on:
  • The command being invoked
  • Keywords in the prompt (research, learn, investigate → research)
  • Explicit phase markers in user input
根据以下信息确定当前阶段:
  • 触发的命令
  • 提示词中的关键词(research、learn、investigate → 研究阶段)
  • 用户输入中的明确阶段标记

Step 3: Load Phase Template

步骤3:加载阶段模板

Based on detected phase, load the appropriate template:
  • templates/research.md
    for
    /ai-eng/research
  • templates/specify.md
    for
    /ai-eng/specify
  • templates/plan.md
    for
    /ai-eng/plan
  • templates/work.md
    for
    /ai-eng/work
根据检测到的阶段,加载对应的模板:
  • /ai-eng/research
    对应
    templates/research.md
  • /ai-eng/specify
    对应
    templates/specify.md
  • /ai-eng/plan
    对应
    templates/plan.md
  • /ai-eng/work
    对应
    templates/work.md

Step 4: Ask Clarifying Questions

步骤4:提出澄清问题

Use phase-specific questions from the loaded template.
Minimum required questions:
  • 1 Task question
  • 1 Context question
  • 1-2 Requirements questions
  • 1 Output question
Present questions interactively:
  1. Display original user prompt
  2. Ask clarifying questions one at a time or in small groups
  3. Collect user responses
  4. Use responses to structure refined prompt
使用加载模板中的阶段专属问题。
最低要求的问题:
  • 1个Task相关问题
  • 1个Context相关问题
  • 1-2个Requirements相关问题
  • 1个Output相关问题
交互式呈现问题:
  1. 展示原始用户提示词
  2. 逐个或成组提出澄清问题
  3. 收集用户回复
  4. 使用回复内容梳理优化后的提示词

Step 5: Structure into TCRO

步骤5:整理为TCRO结构

Format the refined prompt using the TCRO structure:
text
Task: [Specific, actionable task statement]
Context: [Broader system, goals, constraints from CLAUDE.md]
Requirements:
  - [Must-have requirement 1]
  - [Must-have requirement 2]
  - [Nice-to-have if mentioned]
Output: [Expected deliverable format and location]
使用TCRO结构格式化优化后的提示词:
text
Task: [具体、可执行的任务陈述]
Context: [来自CLAUDE.md的更广泛系统、目标、约束条件]
Requirements:
  - [必备要求1]
  - [必备要求2]
  - [若提及则添加锦上添花的需求]
Output: [预期交付成果的格式和位置]

Step 6: Apply Incentive Prompting

步骤6:应用激励式提示词技术

Enhance the TCRO-structured prompt with techniques from the
incentive-prompting
skill:
  • Expert Persona: Assign appropriate role based on task
  • Stakes Language: Add "This is critical..." for high-importance tasks
  • Step-by-Step Reasoning: Add " solve step by step"
  • Self-Evaluation: Add "Rate your confidence 0-1" request
使用
incentive-prompting
技能中的技术增强TCRO结构的提示词:
  • 专家角色:根据任务分配合适的角色
  • 重要性表述:对高优先级任务添加“这至关重要...”等表述
  • 分步推理:添加“逐步解决问题”的要求
  • 自我评估:添加“请从0-1为你的信心评分”的请求

Step 7: Confirm with User

步骤7:与用户确认

Display the refined prompt and ask for confirmation:
markdown
undefined
展示优化后的提示词并请求确认:
markdown
undefined

Refined Prompt

优化后的提示词

[The TCRO-structured, incentive-enhanced prompt]
Proceed with this refined prompt? (y/n/edit)

- **y**: Proceed with refined prompt
- **n**: Ask more clarifying questions
- **edit**: Allow user to manually refine the prompt
[经过TCRO结构化、激励式增强的提示词]
是否使用此优化后的提示词继续?(y/n/edit)

- **y**:使用优化后的提示词继续
- **n**:提出更多澄清问题
- **edit**:允许用户手动优化提示词

Integration with Commands

与命令的集成

Commands should reference this skill with:
markdown
---
name: ai-eng/[command-name]
description: [Description]
agent: [agent]
---

Use skill: prompt-refinement
Phase: [research|specify|plan|work]
命令应通过以下方式引用此技能:
markdown
---
name: ai-eng/[command-name]
description: [描述]
agent: [agent]
---

Use skill: prompt-refinement
Phase: [research|specify|plan|work]

[Command Name]

[命令名称]

[Rest of command definition...]
undefined
[命令定义的其余部分...]
undefined

Template Structure

模板结构

Phase-specific templates are located in
templates/
:
skills/prompt-refinement/
├── SKILL.md
└── templates/
    ├── research.md
    ├── specify.md
    ├── plan.md
    └── work.md
Each template includes:
  • Phase-specific clarifying questions
  • TCRO structure for that phase
  • Examples of vague → refined transformations
  • Phase-specific requirements and considerations
阶段专属模板位于
templates/
目录下:
skills/prompt-refinement/
├── SKILL.md
└── templates/
    ├── research.md
    ├── specify.md
    ├── plan.md
    └── work.md
每个模板包含:
  • 阶段专属的澄清问题
  • 适用于该阶段的TCRO结构
  • 模糊提示词→优化后提示词的示例
  • 阶段专属的要求和注意事项

Example Transformation

转换示例

Input (Vague)

输入(模糊)

"need auth"
"需要认证功能"

Phase Detection

阶段检测

Detected phase:
specify
(feature request)
检测到阶段:
specify
(功能需求)

Clarifying Questions

澄清问题

  1. Task: What type of authentication capability do you need?
    • User login/logout
    • OAuth/SSO integration
    • API key management
    • Multi-factor authentication (MFA)
    • Other: _________
  2. Context: What's the broader system this fits into?
    • New greenfield project or adding to existing codebase?
    • What's the tech stack?
    • Are there existing authentication patterns to follow?
  3. Requirements: What are the must-have requirements?
    • Security/compliance needs (SOC2, GDPR, etc.)?
    • User experience expectations?
    • Rate limiting requirements?
  4. Output: What should the specification include?
    • User stories only
    • Full spec with acceptance criteria
    • Include non-functional requirements
    • Include UI/UX considerations
  1. Task:你需要哪种类型的认证能力?
    • 用户登录/登出
    • OAuth/SSO集成
    • API密钥管理
    • 多因素认证(MFA)
    • 其他:_________
  2. Context:该功能将融入哪个更广泛的系统?
    • 全新项目还是添加到现有代码库?
    • 技术栈是什么?
    • 是否有可遵循的现有认证模式?
  3. Requirements:必备要求有哪些?
    • 安全/合规需求(SOC2、GDPR等)?
    • 用户体验预期?
    • 请求频率限制要求?
  4. Output:规范文档应包含哪些内容?
    • 仅用户故事
    • 包含验收标准的完整规范
    • 包含非功能性需求
    • 包含UI/UX考量

Refined TCRO

优化后的TCRO

text
Task: Create specification for JWT-based user authentication system
Context:
  Adding to existing Next.js application with PostgreSQL database.
  Project follows CLAUDE.md philosophy of simplicity and pragmatism.
  Existing authentication middleware pattern in src/lib/auth/ can be extended.
Requirements:
  Must-have:
  - Email/password login with secure password hashing (bcrypt, cost factor 12)
  - JWT token-based session management with configurable expiry
  - Password reset flow via email delivery
  - Rate limiting on authentication endpoints (5 attempts/minute)
  Nice-to-have:
  - Email verification for new accounts
  - Session persistence across device reboots
  Non-functional:
  - Security: Tokens must be cryptographically secure, single-use for reset flows
  - Performance: Authentication requests should complete within 200ms (p95)
  - Compliance: GDPR-compliant data handling, no passwords in logs
Output:
  Full specification with user stories, acceptance criteria, and non-functional
  requirements saved to specs/auth/spec.md in Spec Kit compatible format.
text
Task: 为基于JWT的用户认证系统创建规范文档
Context:
  添加到现有的Next.js应用中,该应用使用PostgreSQL数据库。
  项目遵循CLAUDE.md中简洁务实的理念。
  可扩展src/lib/auth/目录下现有的认证中间件模式。
Requirements:
  必备:
  - 邮箱/密码登录,使用安全的密码哈希算法(bcrypt,成本因子12)
  - 基于JWT令牌的会话管理,支持可配置的过期时间
  - 通过邮件发送的密码重置流程
  - 认证端点的请求频率限制(每分钟5次尝试)
  锦上添花:
  - 新账户的邮箱验证
  - 跨设备重启的会话持久化
  非功能性:
  - 安全性:令牌必须具备加密安全性,重置流程使用一次性令牌
  - 性能:认证请求应在200ms内完成(p95)
  - 合规性:符合GDPR的数据处理规范,日志中不记录密码
Output:
  包含用户故事、验收标准和非功能性需求的完整规范文档,保存为specs/auth/spec.md,格式兼容Spec Kit。

Incentive-Enhanced Prompt

激励式增强后的提示词

text
You are a senior security engineer and product owner with 15+ years of experience
building production authentication systems at companies like Stripe and Auth0.

Task: Create a comprehensive specification for JWT-based user authentication system
Context:
  Adding to existing Next.js application with PostgreSQL database.
  Project follows CLAUDE.md philosophy of simplicity and pragmatism.
  Existing authentication middleware pattern in src/lib/auth/ can be extended.

Requirements:
  Must-have:
  - Email/password login with secure password hashing (bcrypt, cost factor 12)
  - JWT token-based session management with configurable expiry
  - Password reset flow via email delivery
  - Rate limiting on authentication endpoints (5 attempts/minute)
  Nice-to-have:
  - Email verification for new accounts
  - Session persistence across device reboots
  Non-functional:
  - Security: Tokens must be cryptographically secure, single-use for reset flows
  - Performance: Authentication requests should complete within 200ms (p95)
  - Compliance: GDPR-compliant data handling, no passwords in logs

Output:
  Full specification with user stories, acceptance criteria, and non-functional
  requirements saved to specs/auth/spec.md in Spec Kit compatible format.

 think through this specification systematically. Consider all
security implications, edge cases, and user experience flows before finalizing.

Rate your confidence in this specification from 0-1 after completion.
text
你是一名拥有15年以上经验的资深安全工程师和产品负责人,曾在Stripe和Auth0等公司构建生产级认证系统。

Task: 为基于JWT的用户认证系统创建全面的规范文档
Context:
  添加到现有的Next.js应用中,该应用使用PostgreSQL数据库。
  项目遵循CLAUDE.md中简洁务实的理念。
  可扩展src/lib/auth/目录下现有的认证中间件模式。

Requirements:
  必备:
  - 邮箱/密码登录,使用安全的密码哈希算法(bcrypt,成本因子12)
  - 基于JWT令牌的会话管理,支持可配置的过期时间
  - 通过邮件发送的密码重置流程
  - 认证端点的请求频率限制(每分钟5次尝试)
  锦上添花:
  - 新账户的邮箱验证
  - 跨设备重启的会话持久化
  非功能性:
  - 安全性:令牌必须具备加密安全性,重置流程使用一次性令牌
  - 性能:认证请求应在200ms内完成(p95)
  - 合规性:符合GDPR的数据处理规范,日志中不记录密码

Output:
  包含用户故事、验收标准和非功能性需求的完整规范文档,保存为specs/auth/spec.md,格式兼容Spec Kit。

  请系统地梳理这份规范文档。在最终确定前,考虑所有安全影响、边缘情况和用户体验流程。

  完成后请从0-1为你对这份规范的信心评分。

Handling Edge Cases

边缘情况处理

Prompt Already Structured

提示词已结构化

If user input is already well-structured:
  1. Analyze prompt for TCRO elements
  2. Identify any missing elements
  3. Ask targeted questions to fill gaps (not full re-clarification)
  4. Confirm if structure is sufficient or needs refinement
如果用户输入已经结构清晰:
  1. 分析提示词中的TCRO要素
  2. 识别缺失的要素
  3. 提出针对性问题填补空白(无需完整的重新澄清)
  4. 确认当前结构是否足够或需要进一步优化

User Refuses Clarification

用户拒绝澄清

If user declines clarifying questions:
  1. Proceed with best-effort TCRO structure
  2. Use
    [NEEDS CLARIFICATION: ...]
    markers for ambiguous items
  3. Note which elements were assumed vs explicitly specified
如果用户拒绝回答澄清问题:
  1. 基于最佳实践构建TCRO结构
  2. 对模糊项使用
    [NEEDS CLARIFICATION: ...]
    标记
  3. 记录哪些要素是假设的,哪些是明确指定的

Incomplete Context

背景信息不完整

If CLAUDE.md doesn't exist or is incomplete:
  1. Proceed without project-specific context
  2. Ask basic context questions (tech stack, goals)
  3. Note in refined prompt: "No project constitution found, using generic defaults"
如果CLAUDE.md不存在或内容不完整:
  1. 不使用项目专属背景信息继续
  2. 提出基础的背景问题(技术栈、目标)
  3. 在优化后的提示词中注明:“未找到项目章程,使用通用默认设置”

Quality Checklist

质量检查清单

Before finalizing refined prompt, verify:
  • Task is specific and actionable
  • Context includes relevant project information
  • Requirements distinguish must-have vs nice-to-have
  • Output format is clearly specified
  • Appropriate expert persona assigned
  • Stakes language added for important tasks
  • Clarification markers used for ambiguities
在最终确定优化后的提示词前,验证:
  • 任务具体且可执行
  • 背景包含相关项目信息
  • 需求区分了必备和锦上添花的内容
  • 输出格式明确指定
  • 分配了合适的专家角色
  • 为重要任务添加了重要性表述
  • 对模糊内容使用了澄清标记

Integration with incentive-prompting Skill

与incentive-prompting技能的集成

This skill builds on the
incentive-prompting
skill. Always load both skills together when refining prompts:
markdown
Use skill: incentive-prompting
Use skill: prompt-refinement
The
incentive-prompting
skill provides the enhancement techniques (Expert Persona, Stakes Language, Step-by-Step, Self-Evaluation).
This skill provides the structuring framework (TCRO) and phase-specific clarification questions.
Together they produce prompts that are both well-structured and enhanced for maximum AI response quality.
该技能基于
incentive-prompting
技能构建。优化提示词时请始终同时加载这两个技能:
markdown
Use skill: incentive-prompting
Use skill: prompt-refinement
incentive-prompting
技能提供增强技术 (专家角色、重要性表述、分步推理、自我评估)。
本技能提供结构化框架(TCRO)和阶段专属 的澄清问题。
两者结合可生成既结构清晰又经过增强的提示词,以获得最佳AI响应质量。