关于 request-analyzer
request-analyzer 是一款用于评估用户请求并推荐相关技能的协调型 Skill,面向需要组织 Agent 工作流的场景。它检查请求的清晰度、具体性和完整性,判断任务类型后建议优化、启用其他技能、直接处理或澄清。
主要功能
- 01评估请求的清晰度、具体性和完整性
- 02识别任务类别与工作流
- 03按条件推荐相关技能
- 04决定直接处理或提出澄清问题
- 05结合对话上下文判断
适用场景
- 01处理信息不足的编码请求
- 02为界面设计请求推荐分析技能
- 03判断明确的组件需求是否适合专用技能
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ staruhub/ claudeskills --skill request-analyzer安装后在 Claude Code 中输入/request-analyzer确认已加载。
附带文件references/skill-activation-guide.md
详细介绍
请求分析器
此技能会主动分析用户请求,以确定任务类型、评估提示词质量,并智能推荐应激活哪些其他技能,从而更好地满足用户需求。
目的
充当智能协调器,以便:
- 系统地分析每个用户请求
- 评估提示词质量(清晰度、具体程度、完整性)
- 确定任务类型和适当的工作流
- 在有帮助时,建议激活特定技能
- 确保用户获得尽可能好的帮助
何时使用此技能
为确保工作流协调达到最佳效果,每个对话开始时都应激活此技能。
具体来说,在以下情况下激活:
- 新对话开始时
- 用户提交新请求或问题时
- 用户寻求任务方面的帮助时
- 提出任何编码、设计或技术请求时
- 需要澄清用户意图时
核心分析流程
步骤 1:快速评估
立即从三个维度评估请求:
清晰度(0–100%):
- 请求是否含义明确?
- 术语是否定义清楚?
- 是否只有一种合理的解读方式?
具体程度(0–100%):
- 是否提供了足够的上下文?
- 是否说明了技术要求?
- 范围是否明确?
完整性(0–100%):
- 是否包含所有必要信息?
- 是否定义了成功标准?
- 是否提及了约束条件?
步骤 2:识别任务类型
将请求归入以下类别之一:
- 代码实现 - 编写新代码
- 调试/修复 - 解决 Bug 或错误
- 分析/审查 - 检查代码或系统
- 设计实现 - 根据设计构建 UI
- 重构 - 改进现有代码
- 解释/学习 - 理解概念
- 一般问题 - 非技术类问题
有关详细的分类标准,请参阅 references/skill-activation-guide.md。
步骤 3:技能推荐
根据评估结果和任务类型,确定哪些技能可能有帮助:
在以下情况下考虑使用 prompt-optimizer:
- 清晰度得分 < 60%
- 具体程度得分 < 60%
- 完整性得分 < 60%
- 总体质量 < 70%
- 缺少关键信息
- 存在多种可能的解读方式
在以下情况下考虑使用 ui-analyzer:
- 用户提到:截图、设计、模型图、Figma、图片
- 用户提供或引用了图片文件
- 请求包含“实现此设计”
- 任务涉及分析 UI 布局
在以下情况下考虑使用 react-component-generator:
- 用户请求创建 React 组件
- 提到:组件、表单、按钮、模态框、卡片、列表
- ui-analyzer 确定了要构建的组件后
- 组件要求明确
步骤 4:决策与执行
做出以下决策之一:
选项 A:建议优化 如果提示词质量较低,明确建议使用 prompt-optimizer:
"I notice your request could benefit from more clarity. Let me activate the
prompt-optimizer skill to help structure a more specific request."
选项 B:推荐特定技能 如果请求清晰,但符合某项技能的适用领域:
"This looks like a UI design implementation task. I'll use the ui-analyzer
skill to systematically analyze the design and generate the code."
选项 C:直接处理 如果请求清晰、完整,且不需要专门技能:
"Your request is clear. I'll proceed with [task description]."
选项 D:请求澄清 如果缺少关键信息且无法合理推断:
"To help you effectively, I need to know: [specific questions]"
分析工作流
针对每个请求
- 仔细阅读请求
- 从三个维度评分(清晰度、具体程度、完整性)
- 使用分类系统识别任务类型
- 根据参考指南检查技能激活条件
- 给出建议(优化、激活技能、直接处理或请求澄清)
- 根据决策采取行动
详细步骤
步骤 1:初步阅读
- 理解用户意图
- 注意附件或引用内容
- 考虑对话上下文
步骤 2:质量评分
清晰度检查:
- 是否没有含糊用语(如“东西”“某些内容”“杂项”)?
- 是否定义了所有术语?
- 是否只有一种清晰的理解方式?
- 是否包含行动动词?
具体性检查:
- 是否提供了上下文?
- 是否提及技术规格(针对代码)?
- 是否定义了范围?
- 是否提供了示例(如有帮助)?
完整性检查:
- 是否提供了所有输入?
- 是否说明了成功标准?
- 是否提及了约束条件?
- 是否考虑了边缘情况?
步骤 3:任务分类
对照 references/skill-activation-guide.md 中的模式:
- 代码实现模式
- 调试模式
- 分析模式
- 设计实现模式
- 重构模式
步骤 4:技能匹配
对于每项可用技能,检查是否满足激活条件:
prompt-optimizer:
- Quality score < 70%? → Consider
- Missing critical info? → Consider
- Vague language present? → Consider
- Multiple interpretations? → Consider
ui-analyzer:
- Screenshot/design mentioned? → Activate
- Image provided? → Activate
- "Implement design" request? → Activate
react-component-generator:
- React component requested? → Consider
- After prompt optimization? → Consider
- Clear component spec? → Activate
步骤 5:给出建议
根据分析,形成建议:
- 激活哪些技能
- 它们为何有帮助
- 预期效果
步骤 6:执行
可选择:
- 明确说明技能已激活(保持透明)
- 无缝整合技能的使用
- 如果不确定,向用户征求确认
输出格式
格式 1:建议优化(低质量提示词)
## Request Analysis
I've analyzed your request and noticed it could benefit from more specificity.
**Current Request**: [User's request]
**Observations**:
- Missing: [what's missing]
- Unclear: [what's ambiguous]
- Would help: [what would improve it]
**Recommendation**: Let me use the prompt-optimizer skill to help structure
a clearer, more actionable request.
[Then activate prompt-optimizer]
格式 2:建议使用技能(提示词质量良好,领域明确)
## Request Analysis
Your request is clear and matches our ui-analyzer skill's capabilities.
**Task Type**: Design Implementation
**Recommended Approach**:
1. Use ui-analyzer to examine the screenshot
2. Extract design tokens and components
3. Generate React code with Tailwind CSS
Proceeding with UI analysis...
[Then activate ui-analyzer]
格式 3:直接执行(提示词质量高,无需特殊技能)
## Request Analysis
Your request is clear and complete. I'll proceed with creating the TypeScript
function with input validation as specified.
[Proceed with implementation]
格式 4:需要澄清
## Request Analysis
To help you effectively, I need some additional information:
1. [Question 1]
2. [Question 2]
3. [Question 3]
Once I have these details, I can [what you'll do].
与其他技能集成
与 prompt-optimizer 集成
何时委派:
- 质量评分显示存在问题
- 请求含糊或不完整
- 存在多种理解方式
- 缺少关键信息
如何操作:
- 找出质量问题
- 说明优化为何有帮助
- 提及将激活 prompt-optimizer
- 让 prompt-optimizer 接手
示例流程:
User: "Make a form"
↓
request-analyzer: Detects low specificity
↓
request-analyzer: "This request needs more details. Activating prompt-optimizer..."
↓
prompt-optimizer: Analyzes and provides optimized version
↓
User: Confirms optimized version
↓
react-component-generator: Creates the well-specified form
与 ui-analyzer 集成
何时委派:
- 提及截图或设计
- 提供了图像文件
- 请求实现设计
如何操作:
- 确认这是设计实现任务
- 确认图像可用或已提供引用
- 说明将由 ui-analyzer 负责处理
- 让 ui-analyzer 接手
示例流程:
User: "Build this UI [screenshot attached]"
↓
request-analyzer: Detects design implementation task
↓
request-analyzer: "I'll use ui-analyzer to examine your design..."
↓
ui-analyzer: Analyzes screenshot and generates code
与 react-component-generator 集成
何时委派:
- 请求创建 React 组件
- 规格说明清晰
- 没有设计截图(仅有文字描述)
如何操作:
- 确认组件需求清晰
- 如果不清晰,先使用 prompt-optimizer
- 需求清晰后,说明将使用 react-component-generator
- 让它负责创建组件
示例流程:
User: "Create a React login form with email/password, validation, TypeScript"
↓
request-analyzer: Detects high-quality component request
↓
request-analyzer: "Clear component spec. Using react-component-generator..."
↓
react-component-generator: Creates the component
决策矩阵
| 提示词质量 | 有截图 | 任务类型 | 操作 |
|---|---|---|---|
| 低(<70%) | 否 | 任意 | → prompt-optimizer |
| 低(<70%) | 是 | 设计 | → 先用 prompt-optimizer,再用 ui-analyzer |
| 高(>80%) | 是 | 设计 | → ui-analyzer |
| 高(>80%) | 否 | 组件 | → react-component-generator |
| 高(>80%) | 否 | 通用代码 | → 直接执行 |
| 中等(70-80%) | 否 | 任意 | → 提出澄清问题或直接执行 |
特殊注意事项
对话上下文
如果这是持续对话中的后续请求:
- 之前的消息可能已提供缺失的上下文
- 不要过度分析简短的后续请求
- 在“创建表单”之后提出“现在添加验证”是可以的
- 考虑完整的对话历史
用户体验
在全面性与效率之间取得平衡:
- 不要对简单明确的请求过度处理
- 避免给有经验的用户造成阻碍
- 提供帮助,但不要吹毛求疵
- 透明说明技能为何有帮助
置信度等级
高置信度(>90%) — 果断行动:
- 提示词与技能领域明显匹配
- 质量问题显而易见
- 建议明确无误
中等置信度(60-90%) — 提出建议并解释:
- 与技能领域部分匹配
- 存在一些质量问题
- 解释使用技能的好处
低置信度(<60%) — 询问或谨慎处理:
- 匹配情况不明确
- 没有明显的质量问题
- 可能不需要特殊技能
参考资料用法
请查阅 references/skill-activation-guide.md,了解:
- 可用技能 — 完整列表及激活条件
- 请求类型分类 — 详细模式
- 决策树 — 可视化工作流指南
- 多技能场景 — 复杂激活模式
- 激活置信度等级 — 何时激活
- 常见模式 — 识别典型请求
- 边缘情况 — 处理特殊情形
示例
示例 1:模糊请求
User: "Fix my code"
Analysis:
- Clarity: 20% (what code? what's wrong?)
- Specificity: 10% (no file, no error, no context)
- Completeness: 15% (no reproduction steps, no expected behavior)
- Overall: 15% → Very Low
Decision: Activate prompt-optimizer
Output:
"I notice your request needs more details to be actionable. Let me help
structure it using the prompt-optimizer skill.
Missing information:
- Which file or code section?
- What's the current behavior?
- What error messages appear?
- What should happen instead?
[Activating prompt-optimizer...]"
示例 2:UI 设计请求
User: "Implement this login page design [screenshot]"
Analysis:
- Clarity: 85% (clear intent)
- Specificity: 80% (has design, mentions login page)
- Completeness: 75% (might need tech stack clarification)
- Task Type: Design Implementation
- Has Screenshot: Yes
Decision: Activate ui-analyzer (might clarify tech stack within workflow)
Output:
"I'll analyze your login page design and generate the React components.
Using the ui-analyzer skill to:
1. Examine the layout and components
2. Extract design tokens (colors, spacing, typography)
3. Generate React + TypeScript + Tailwind code
[Activating ui-analyzer...]"
示例 3:明确的组件请求
User: "Create a React Button component with TypeScript, supporting primary/
secondary/danger variants, sm/md/lg sizes, and Tailwind CSS styling"
Analysis:
- Clarity: 95% (very clear)
- Specificity: 95% (all tech specs present)
- Completeness: 90% (comprehensive requirements)
- Task Type: Code Implementation (React component)
- Overall: 93% → Excellent
Decision: Activate react-component-generator directly
Output:
"Excellent! Your component requirements are clear and complete. I'll use the
react-component-generator skill to create this button component.
[Activating react-component-generator...]"
示例 4:一般问题
User: "What's the difference between useState and useReducer in React?"
Analysis:
- Clarity: 100% (perfectly clear)
- Task Type: Explanation/Learning
- No coding task
- No design implementation
Decision: Proceed directly (no special skill needed)
Output:
"Great question! Let me explain the differences between useState and useReducer..."
[Provide explanation directly - no skill activation needed]
最佳实践
- 积极主动,但不打扰 — 提供帮助,同时避免造成阻碍
- 说明价值 — 告诉用户技能为何能提供帮助
- 保持透明 — 说明正在使用哪些技能以及原因
- 尊重用户时间 — 不要过度分析简单请求
- 借鉴上下文 — 考虑对话历史
- 平衡自动化与判断 — 技能是工具,而非规则
- 优先考虑用户成功 — 目标是取得更好的结果,而非追求完美流程
重要说明
- 此技能是协调者,而非阻碍者
- 高质量提示词应顺畅处理,无需干预
- 技能应改善而非妨碍用户体验
- 如有疑问,请询问用户,而非擅自假设
- 透明有助于建立信任——请解释你的推理
- 最终目标是帮助用户成功完成任务