从当前会话中提取经验,自动生成可复用的 Claude Code Skill。Use when user wants to 提取skill, 总结成skill, 固化经验, 生成skill, extract skill, create skill from context, save as skill, 把经验变成skill.
/plugin marketplace add InfQuest/vibe-ops-plugin/plugin install vibe-ops@vibe-opsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
从当前会话的上下文中提取成功经验和失败教训,自动生成可复用的 Claude Code Skill 文件。
这是一个"元技能"——用于创建其他技能的技能。通过分析当前会话中完成的任务,提取关键步骤、常见陷阱和最佳实践,将一次性的问题解决固化为可重复的工作流。
你是一个经验提取助手,帮助用户将会话中的工作经验转化为可复用的 Claude Code Skill。请按以下步骤操作:
回顾整个会话历史,识别并提取以下信息:
⚠️ 必须:使用 AskUserQuestion 工具收集必要信息。
使用 AskUserQuestion 工具询问用户:
Skill 名称:这个 skill 叫什么名字?
api-caller、file-processor)主要功能描述:一句话描述这个 skill 做什么
触发词:用户会用什么词来触发这个 skill?
保存位置:
根据任务性质自动判断是否需要配套脚本(不要问用户):
需要脚本的情况:
不需要脚本的情况:
脚本语言选择:
Python uv script 模板:
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "requests",
# "其他依赖",
# ]
# ///
import sys
# 脚本内容...
根据分析结果和用户输入,生成以下格式的 SKILL.md:
---
name: {skill-name}
description: {功能描述}。Use when user wants to {触发词1}, {触发词2}, {trigger1}, {trigger2}.
---
# {Skill Title}
{简要说明这个 skill 的功能和来源}
## Background
> 此 skill 从 [具体任务描述] 的实践经验中提取。
{描述这个 skill 解决的问题场景}
## Prerequisites
{列出依赖条件,如环境变量、工具等}
## Instructions
{详细的执行步骤,来自成功的方案}
### Step 1: {步骤标题}
{具体操作}
### Step 2: {步骤标题}
{具体操作}
...
## Common Pitfalls
{从失败经验中提取的常见陷阱}
| 错误做法 | 正确做法 | 原因 |
|---------|---------|------|
| ❌ {错误示例} | ✅ {正确示例} | {解释} |
## Best Practices
{从成功经验中提取的最佳实践}
- {实践1}
- {实践2}
- ...
## Troubleshooting
{常见问题及解决方案,来自实际遇到的错误}
**问题:{问题描述}**
- 原因:{原因分析}
- 解决:{解决方案}
## Example Interaction
{一个典型的使用示例}
用户:{示例输入}
助手:
1. {步骤1}
2. {步骤2}
...
使用 Write 工具将生成的内容写入对应目录:
skills/{skill-name}/SKILL.md
skills/{skill-name}/{script-name}.py # 如果需要脚本
如果创建了 Python 脚本,添加可执行权限:
chmod +x skills/{skill-name}/{script-name}.py
询问用户是否需要更新 CLAUDE.md 来注册新 skill:
完成后告诉用户:
生成的 SKILL.md 应该:
假设用户刚完成了一个"使用 OpenRouter API 实现图片理解"的任务,调用此 skill 后可能生成:
---
name: openrouter-vision
description: 使用 OpenRouter API 进行图片理解。Use when user wants to 调用视觉API, 图片分析API, call vision API.
---
# OpenRouter Vision API
通过 OpenRouter 调用视觉模型分析图片。
## Background
> 此 skill 从 image-understand skill 开发实践中提取。
## Prerequisites
1. `OPENROUTER_API_KEY` 环境变量
2. Python 3.11+ 和 uv
## Instructions
### Step 1: 准备图片
- 支持格式:PNG、JPG、JPEG、GIF、WebP
- 大小限制:20MB
### Step 2: 构建 API 请求
...
## Common Pitfalls
| 错误做法 | 正确做法 | 原因 |
|---------|---------|------|
| ❌ `ext === 'jpg'` | ✅ `ext === 'jpg' \|\| ext === 'jpeg'` | jpeg 扩展名也需要处理 |
| ❌ 不检查文件大小 | ✅ 添加 20MB 限制 | API 有大小限制 |
## Best Practices
- 使用 `fs.statSync()` 检查文件大小后再读取
- MIME 类型映射要完整
- 添加可执行权限 `chmod +x`
...
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.