Skill Extractor
Extract successful experiences and lessons learned from the current conversation context, and automatically generate reusable Claude Code Skill files.
Background
This is a "meta-skill" — a skill used to create other skills. By analyzing the tasks completed in the current conversation, extract key steps, common pitfalls, and best practices, and solidify one-time problem-solving into repeatable workflows.
Instructions
You are an experience extraction assistant, helping users transform work experiences in conversations into reusable Claude Code Skills. Please follow these steps:
Step 1: Analyze current conversation context
Review the entire conversation history, identify and extract the following information:
- Original Requirement: What problem did the user initially want to solve?
- Execution Steps: What key steps were taken to complete the task?
- Lessons from Failures: Which attempts failed? What were the reasons for failure?
- Successful Solution: What was the final solution adopted?
- Key Findings: What important precautions, checkpoints, or tips are there?
Step 2: Collect user input
⚠️ Required: Use the AskUserQuestion tool to collect necessary information.
Use the AskUserQuestion tool to ask the user:
-
Skill Name: What is the name of this skill?
- Ask the user to input it, recommend using kebab-case format (e.g., , )
-
Core Function Description: A one-sentence description of what this skill does
- Ask the user to input it or make recommendations based on analysis results
-
Trigger Words: What words will users use to trigger this skill?
- Ask the user to input it, recommend 2-3 each in Chinese and English
-
Save Location:
- Options:
- "Current plugin directory skills/ (Recommended)"
- "Custom path"
Step 3: Decide whether a script is needed
Automatically determine whether a supporting script is needed based on the nature of the task (do not ask the user):
Situations where a script is needed:
- Calling external APIs (such as OpenRouter, OpenAI, etc.)
- Complex file processing (binary files, encoding conversion, etc.)
- Dependence on specific libraries (such as ffmpeg, whisper, etc.)
- Involving network requests, data parsing, etc.
Situations where no script is needed:
- Pure prompt-driven workflows
- Mainly combinations of bash commands
- Simple file operations
Script language selection:
- Prioritize Python, using uv script format (inline dependency declaration)
- Use Bun when JavaScript is needed (built into Max, faster than Node.js)
Python uv script template:
python
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "requests",
# "其他依赖",
# ]
# ///
import sys
# 脚本内容...
Step 4: Generate SKILL.md content
Based on the analysis results and user input, generate SKILL.md in the following format:
markdown
---
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}
...
Step 5: Write to file
Use the Write tool to write the generated content to the corresponding directory:
skills/{skill-name}/SKILL.md
skills/{skill-name}/{script-name}.py # If a script is needed
If a Python script is created, add executable permissions:
bash
chmod +x skills/{skill-name}/{script-name}.py
Step 6: Update documentation (optional)
Ask the user if they need to update CLAUDE.md to register the new skill:
- Update the project structure diagram
- Update the Skills table
Step 7: Show results
After completion, inform the user:
- The path of the created file
- How to use the Skill
- List of trigger words
Output Quality Guidelines
The generated SKILL.md should:
- Executable: Clear steps that can be directly followed
- Valuable: Contains truly useful experiences, not general statements
- Pitfall-focused: Highlight failed experiences and common pitfalls
- Code examples: Key steps should have code or command examples
- Concise and clear: Avoid redundancy and maintain clear structure
Example
Assume the user just completed a task of "Implementing image understanding using OpenRouter API", calling this skill may generate:
markdown
---
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: Prepare images
- Supported formats: PNG, JPG, JPEG, GIF, WebP
- Size limit: 20MB
### Step 2: Build API request
...
## Common Pitfalls
|---------|---------|------|
| ❌ `ext === 'jpg'` | ✅ `ext === 'jpg' \|\| ext === 'jpeg'` | jpeg 扩展名也需要处理 |
| ❌ 不检查文件大小 | ✅ 添加 20MB 限制 | API 有大小限制 |
## Best Practices
- Use `fs.statSync()` to check file size before reading
- Complete MIME type mapping
- Add executable permission `chmod +x`
...
Notes
- This skill depends on conversation context and needs to be used immediately after completing the task
- The generated skill is a draft, and users may need to adjust it according to actual situations
- Encourage users to review and supplement missing experiences