Preface Protocol
Mandatory Trigger Rules
Trigger Timing: After creating a goal-oriented goal (mandatory)
Trigger Conditions(triggered if any one is met):
- ✅ User requirements are vague (single-sentence request, missing context)
- ✅ User requirements are incomplete (missing key dimensions)
- ✅ User requirements are ambiguous (multiple possible interpretations)
- ✅ User requirements lack success criteria
- ✅ Complex task (involving multiple modules/systems)
Exceptions:
- User explicitly states "execute according to your understanding"
- Requirements are already very clear and explicit
- User is adjusting an existing goal
Overview
prompt-enhancer is a mandatory prerequisite skill, responsible forrequirements refinementandsolution exploration. Through structured questioning, ensure full understanding of user requirements, explore multiple feasible solutions, and avoid misunderstanding and rework.
Core Capabilities:
- Requirements Refinement: Clarify vague points, discover hidden requirements, define scope boundaries
- Solution Exploration: Brainstorm multiple solutions, analyze pros and cons, risk assessment
- Confirmation Mechanism: Ask the user 3-4 questions at each key point to confirm understanding
Core Principle: Clarify first, act later. Guessing is a waste, asking is efficient.
Key Value:
- Avoid misunderstanding, reduce rework
- Fully validate solutions, choose the optimal one
- Discover hidden requirements, avoid omissions
- Save tokens and time
When to Use
Mandatory Usage Scenarios:
- User requirements are vague or incomplete
- Complex task (involving multiple modules/systems)
- Requirements are ambiguous or have multiple possible interpretations
- Lack success criteria or constraints
Non-Usage Scenarios:
- User explicitly states "execute according to your understanding"
- Requirements are already very clear and explicit
- User is adjusting an existing clear goal
- Simple clarifying questions themselves
The Process
digraph prompt_enhancer {
rankdir=TB;
"接收用户需求" [shape=box, style=filled, fillcolor="#c8e6c9"];
"识别需求类型" [shape=box, style=filled, fillcolor="#bbdefb"];
"需求细化(3-4问题)" [shape=box, style=filled, fillcolor="#fff9c4"];
"用户确认需求" [shape=diamond, style=filled, fillcolor="#e1bee7"];
"方案探索(头脑风暴)" [shape=box, style=filled, fillcolor="#ff9800"];
"多方案对比分析" [shape=box, style=filled, fillcolor="#ff9800"];
"用户选择方案" [shape=diamond, style=filled, fillcolor="#e1bee7"];
"生成需求方案工件" [shape=box, style=filled, fillcolor="#81c784"];
"传递给后续技能" [shape=doublecircle, style=filled, fillcolor="#81c784"];
"接收用户需求" -> "识别需求类型";
"识别需求类型" -> "需求细化(3-4问题)";
"需求细化(3-4问题)" -> "用户确认需求";
"用户确认需求" -> "方案探索(头脑风暴)" [label="确认"];
"用户确认需求" -> "需求细化(3-4问题)" [label="调整"];
"方案探索(头脑风暴)" -> "多方案对比分析";
"多方案对比分析" -> "用户选择方案";
"用户选择方案" -> "生成需求方案工件" [label="选择"];
"用户选择方案" -> "方案探索(头脑风暴)" [label="重新探索"];
"生成需求方案工件" -> "传递给后续技能";
}
Step 1: Identify Requirement Type
Quickly identify the request type and apply the corresponding refinement framework:
| Requirement Type | Keywords | Mandatory Questions/Dimensions |
|---|---|---|
| Feature Development | "Build a feature", "Implement XX" | Platform, tech stack, users, data, authentication |
| Architecture Design | "Design a system", "Refactor architecture" | Scale, performance, scalability, technology selection |
| Performance Optimization | "Optimize performance", "Increase speed" | Target metrics, optimization scope, priority |
| Bug Fix | "Fix bug", "Resolve error" | Reproduction steps, impact scope, priority |
| UI/Interface | "Design interface", "Build a page" | Device, style, users, interaction |
| Data Analysis | "Analyze data", "Generate report" | Data sources, analysis dimensions, output format |
Step 2: Requirement refinement (3-4 question confirmation)
Core principle: Ask 3-4 questions for each key point to ensure full understanding
Example: Feature development requirement refinement
User requirement: "Build a user authentication feature"
Question group 1: Users and scenarios
Q1: 谁会使用这个认证功能?(用户类型)
Q2: 在什么场景下使用?(使用场景)
Q3: 期望的用户体验是什么?(体验目标)
Q4: 有多少用户量级?(规模预估)
Question group 2: Technical constraints
Q1: 需要支持哪些认证方式?(密码、OAuth、SSO?)
Q2: 部署在什么平台?(Web、移动端、小程序?)
Q3: 使用什么技术栈?(前端、后端框架?)
Q4: 有现成的用户系统吗?(是否需要集成)
Question group 3: Feature scope
Q1: 需要哪些核心功能?(注册、登录、找回密码?)
Q2: 是否需要权限管理?(角色、权限控制?)
Q3: 是否需要记住登录状态?(Token、Session?)
Q4: 是否需要多设备登录?(单点登录?)
Question group 4: Success criteria
Q1: 如何判断功能完成?(验收标准)
Q2: 有性能要求吗?(响应时间、并发量?)
Q3: 有安全要求吗?(加密、防护?)
Q4: 什么时候需要完成?(时间约束)
Step 3: User confirms requirements
Present the refined requirement summary; the user confirms or adjusts:
## 📋 需求确认
### 核心需求
- 功能:用户认证系统
- 用户:普通用户(移动端)
- 认证方式:手机号+验证码、微信OAuth
- 核心功能:注册、登录、找回密码、记住登录
### 技术约束
- 平台:微信小程序
- 技术栈:小程序原生 + Node.js + MySQL
- 集成:需要对接现有用户系统
### 成功标准
- 功能完整:注册、登录、找回密码流程完整
- 性能:登录响应 < 2秒
- 安全:密码加密、Token 7天有效
- 时间:2周内完成
### 范围边界
- ✅ 包含:注册、登录、找回密码
- ✅ 包含:微信OAuth
- ❌ 不包含:权限管理、多角色
- ❌ 不包含:单点登录
---
**是否确认这个需求?**
- A) 确认,继续方案探索
- B) 需要调整(请说明)
Step 4: Solution exploration (brainstorming)
Core principle: Explore 3-5 solutions and fully evaluate them
Solution exploration template
## 🎨 方案探索
### 方案1:自定义认证系统
**实现方式**:
- 后端:Node.js + JWT
- 数据库:MySQL存储用户信息
- 认证:手机验证码(阿里云短信服务)
**优势**:
- ✅ 完全可控,灵活定制
- ✅ 无第三方依赖
**劣势**:
- ❌ 开发周期长(2周)
- ❌ 需要购买短信服务
- ❌ 需要自己维护安全性
**风险**:
- ⚠️ 短信服务可能被滥用
- ⚠️ 需要处理验证码过期、重发等问题
---
### 方案2:使用云开发(推荐)
**实现方式**:
- 微信云开发
- 云函数处理认证逻辑
- 云数据库存储用户信息
**优势**:
- ✅ 快速开发(1周)
- ✅ 微信原生集成
- ✅ 无需服务器维护
**劣势**:
- ❌ 依赖微信生态
- ❌ 扩展性受限
**风险**:
- ⚠️ 云开发限制(并发、存储)
---
### 方案3:第三方认证服务
**实现方式**:
- Authing、Firebase Auth
- SDK集成
**优势**:
- ✅ 最快上线(3天)
- ✅ 功能完整
- ✅ 安全性高
**劣势**:
- ❌ 有成本(按用户数收费)
- ❌ 数据不在自己手中
**风险**:
- ⚠️ 服务稳定性依赖第三方
---
### 方案对比
| 维度 | 方案1 自定义 | 方案2 云开发 | 方案3 第三方 |
|------|-------------|-------------|-------------|
| 开发周期 | 2周 | 1周 | 3天 |
| 灵活性 | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐ |
| 成本 | 低 | 中 | 中-高 |
| 维护成本 | 高 | 低 | 低 |
| 安全性 | 需自己保证 | 中 | 高 |
---
### 推荐方案
**推荐方案2:云开发**
理由:
1. 时间紧迫(2周),云开发最快
2. 小程序原生支持,集成方便
3. 无需服务器维护,降低运维成本
4. 微信生态,用户体验最佳
Step 5: User selects a solution
The user confirms the solution, or explores again:
## ✅ 方案确认
**选定方案**:微信云开发
**实施步骤预览**:
1. 配置云开发环境
2. 实现手机验证码登录
3. 实现微信OAuth
4. 实现找回密码
5. 测试与优化
**是否确认此方案?**
- A) 确认,继续实施规划
- B) 选择其他方案
- C) 重新探索方案
Step 6: Generate the requirement solution artifact
Create an artifact file and pass it to subsequent skills:
{
"skill": "prompt-enhancer",
"version": "2.0.0",
"timestamp": "2026-03-25T10:00:00Z",
"requirement": {
"original": "做一个用户认证功能",
"refined": {
"type": "功能开发",
"core_features": ["注册", "登录", "找回密码"],
"target_users": "普通用户(移动端)",
"auth_methods": ["手机号+验证码", "微信OAuth"],
"platform": "微信小程序",
"tech_stack": ["小程序原生", "Node.js", "MySQL"],
"success_criteria": [
"功能完整:注册、登录、找回密码流程完整",
"性能:登录响应 < 2秒",
"安全:密码加密、Token 7天有效"
],
"timeline": "2周"
}
},
"solution": {
"selected": "方案2:微信云开发",
"reasons": [
"时间紧迫(2周),云开发最快",
"小程序原生支持,集成方便",
"无需服务器维护,降低运维成本"
],
"alternatives": [
{
"name": "方案1:自定义认证系统",
"pros": ["完全可控", "无第三方依赖"],
"cons": ["开发周期长", "需要自己维护安全性"]
},
{
"name": "方案3:第三方认证服务",
"pros": ["最快上线", "功能完整"],
"cons": ["有成本", "数据不在自己手中"]
}
]
},
"next_skills": [
"planning"
]
}
Requirement refinement question template library
Feature development category
User scenarios(3-4 questions):
- Who will use it? User types, scale
- In what scenarios will it be used? Usage frequency
- Expected experience? User journey
- What pain points? Problems to solve
Technical constraints(3-4 questions):
- Deployment platform? Web/mobile/mini program
- Tech stack? Frontend and backend frameworks
- Data storage? Database type
- Third-party integration? Existing systems
Feature scope(3-4 questions):
- Core features? Which must be included
- Extended features? Which can be included
- Exclusions? Clear boundaries
- Priority? MVP vs full version
Success criteria(3-4 questions):
- Acceptance criteria? How to determine completion
- Performance requirements? Response time, concurrency
- Security requirements? Encryption, permissions
- Time constraints? When it must be completed
Architecture design category
System scale(3-4 questions):
- User scale? Current, future
- Data scale? Storage, growth rate
- Concurrency requirements? Peak, average
- Scalability? Future plans
Technology selection(3-4 questions):
- Architecture style? Microservices/monolith/Serverless
- Technology preferences? Technologies the team is familiar with
- Third-party dependencies? Whether they need to be introduced
- Technical debt? Existing system limitations
Non-functional requirements(3-4 questions):
- Performance metrics? Response time, throughput
- Availability? SLA requirements
- Security? Compliance requirements
- Maintainability? Documentation, monitoring
Performance optimization category
Optimization goals(3-4 questions):
- Specific metrics? Load time, response speed
- Target values? From how much to how much
- Priority? Which are most important
- User experience? Core scenarios
Optimization scope(3-4 questions):
- Which modules? Frontend/Backend/Database
- Where is the bottleneck? Known issues
- Monitoring data? Current state analysis
- Constraints? Parts that cannot be changed
Trade-offs(3-4 questions):
- Cost budget? Resource constraints
- Time limit? How long to complete
- Risk tolerance? Stability requirements
- Reversibility? Can it be rolled back
Examples
Case 1: Refining Vague Requirements
User requirement: "Optimize performance"
Refinement process:
Question group 1: Optimization goals
Q1: 哪方面需要优化?
A: 首页加载速度太慢
Q2: 当前状态如何?
A: 现在加载要5秒,太慢了
Q3: 期望达到什么效果?
A: 希望能到2秒以内
Q4: 用户量多大?
A: 日活1万左右
Question group 2: Optimization scope
Q1: 首页包含哪些内容?
A: 轮播图、推荐列表、广告位
Q2: 哪些部分最慢?
A: 轮播图加载特别慢
Q3: 图片多大?
A: 每张2-3MB
Q4: 有CDN吗?
A: 没有,都从服务器加载
Refinement result:
需求:优化首页加载速度
当前:5秒
目标:< 2秒
瓶颈:轮播图过大(2-3MB/张)
方案:图片压缩 + CDN加速
Case 2: Solution Exploration and Comparison
User requirement: "Implement search functionality"
Solution exploration:
Solution 1: Database LIKE query
- Advantages: Simple and fast
- Disadvantages: Poor performance, does not support complex searches
- Applicable: Small data volume (< 10,000 records)
Solution 2: Elasticsearch
- Advantages: Powerful, fast, supports complex searches
- Disadvantages: Requires deployment, learning cost
- Applicable: Large data volume (> 100,000 records)
Solution 3: Algolia
- Advantages: Hosted service, fast integration
- Disadvantages: Has cost, data needs to be uploaded
- Applicable: Quick launch, small to medium data volume
Recommendation: Choose based on data volume
- < 10,000 records: Solution 1
- 10,000-100,000 records: Solution 3
-
100,000 records: Solution 2
Common Pitfalls
Mistake 1: Skipping requirement refinement and executing directly
Manifestation: User says "make a login", and it is implemented directly Correct approach: First ask 3-4 questions to confirm requirements
Mistake 2: Asking only one question before acting
Manifestation: Asking "what platform?" and then stopping Correct approach: Ask 3-4 questions for each key point
Mistake 3: Assuming user requirements
Manifestation: "I think the user wants..." Correct approach: Confirm with the user, do not assume
Mistake 4: Exploring only one solution
Manifestation: Using the first solution that comes to mind Correct approach: Explore and compare at least 3 solutions
Mistake 5: Passing on without generating artifacts
Manifestation: Not recording after refinement Correct approach: Generate artifact files and pass them to subsequent skills
References
- "Requirements Engineering" - Karl Wiegers
- "User Story Mapping" - Jeff Patton
- "Design Thinking" - IDEO
- "5 Whys" - Root Cause Analysis
- "Six Thinking Hats" - Edward de Bono