skill-factory

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Skill Factory

Skill Factory

将任意 GitHub 仓库一键转换为标准化的 Claude Skill。
Convert any GitHub repository into a standardized Claude Skill with one click.

核心功能

Core Features

  1. 信息获取: 通过
    git ls-remote
    获取 commit hash,通过 HTTP 获取 README
  2. 目录生成: 创建标准化的 Skill 目录结构(SKILL.md, scripts/, references/, assets/)
  3. 元数据注入: 自动填充扩展元数据字段(source_url, source_hash, version 等)
  4. 占位脚本: 生成 wrapper.py 模板,便于后续实现
  1. Information Retrieval: Get commit hash via
    git ls-remote
    , fetch README via HTTP
  2. Directory Generation: Create standardized Skill directory structure (SKILL.md, scripts/, references/, assets/)
  3. Metadata Injection: Automatically populate extended metadata fields (source_url, source_hash, version, etc.)
  4. Placeholder Script: Generate wrapper.py template for subsequent implementation

使用场景

Usage Scenarios

触发方式:
  • /skill-factory <github_url>
  • "将这个仓库打包成 Skill: <url>"
  • "从 GitHub 创建 Skill: <url>"
  • "封装这个工具: <url>"
Trigger Methods:
  • /skill-factory <github_url>
  • "Package this repository into a Skill: <url>"
  • "Create a Skill from GitHub: <url>"
  • "Wrap this tool: <url>"

工作流程

Workflow

步骤 1: 获取仓库信息

Step 1: Retrieve Repository Information

运行
scripts/fetch_github_info.py
获取仓库元数据:
bash
python scripts/fetch_github_info.py <github_url>
输出 JSON 格式:
json
{
  "name": "repo-name",
  "owner": "owner",
  "url": "https://github.com/owner/repo",
  "latest_hash": "abc123...",
  "default_branch": "main",
  "description": "仓库描述",
  "readme": "README 内容..."
}
Run
scripts/fetch_github_info.py
to get repository metadata:
bash
python scripts/fetch_github_info.py <github_url>
Output in JSON format:
json
{
  "name": "repo-name",
  "owner": "owner",
  "url": "https://github.com/owner/repo",
  "latest_hash": "abc123...",
  "default_branch": "main",
  "description": "Repository description",
  "readme": "README content..."
}

步骤 2: 分析 README

Step 2: Analyze README

Agent 分析 README 内容,理解:
  • 工具的主要功能
  • 安装和使用方法
  • CLI 参数或 API 接口
  • 依赖要求
The Agent analyzes the README content to understand:
  • Main functions of the tool
  • Installation and usage methods
  • CLI parameters or API interfaces
  • Dependency requirements

步骤 3: 创建 Skill 目录

Step 3: Create Skill Directory

运行
scripts/create_skill.py
生成目录结构:
bash
python scripts/create_skill.py <json_file_or_string> <output_dir>
生成的目录结构:
skill-name/
├── SKILL.md              # 主 Skill 文件(含扩展元数据)
├── scripts/
│   └── wrapper.py        # 占位脚本
├── references/
│   └── .gitkeep
└── assets/
    └── .gitkeep
Run
scripts/create_skill.py
to generate the directory structure:
bash
python scripts/create_skill.py <json_file_or_string> <output_dir>
Generated directory structure:
skill-name/
├── SKILL.md              # Main Skill file (with extended metadata)
├── scripts/
│   └── wrapper.py        # Placeholder script
├── references/
│   └── .gitkeep
└── assets/
    └── .gitkeep

步骤 4: 完善 Skill

Step 4: Refine Skill

Agent 根据 README 分析结果:
  1. 完善 SKILL.md 的描述和使用说明
  2. 实现 wrapper.py 的实际逻辑
  3. 添加必要的参考文档
Based on the README analysis results, the Agent:
  1. Refines the description and usage instructions in SKILL.md
  2. Implements the actual logic in wrapper.py
  3. Adds necessary reference documents

步骤 5: 验证

Step 5: Verification

确认:
  • SKILL.md 的 frontmatter 格式正确
  • source_hash 已正确记录
  • description 包含触发条件
  • wrapper.py 可执行(如已实现)
Confirm:
  • The frontmatter format of SKILL.md is correct
  • source_hash is recorded correctly
  • description includes trigger conditions
  • wrapper.py is executable (if implemented)

生成的元数据格式

Generated Metadata Format

每个由 skill-factory 创建的 Skill 必须包含以下扩展元数据:
yaml
---
name: skill-name
description: 详细描述,包含触发条件
Each Skill created by skill-factory must include the following extended metadata:
yaml
---
name: skill-name
description: Detailed description including trigger conditions

生命周期管理字段(必需)

Lifecycle management fields (required)

source_url: https://github.com/owner/repo source_hash: abc123def456... version: 0.1.0 created_at: 2026-01-23 updated_at: 2026-01-23 evolution_enabled: true
source_url: https://github.com/owner/repo source_hash: abc123def456... version: 0.1.0 created_at: 2026-01-23 updated_at: 2026-01-23 evolution_enabled: true

可选字段

Optional fields

entry_point: scripts/wrapper.py dependencies:
  • dependency1
  • dependency2

undefined
entry_point: scripts/wrapper.py dependencies:
  • dependency1
  • dependency2

undefined

脚本说明

Script Explanation

脚本功能
scripts/fetch_github_info.py
获取 GitHub 仓库元数据(轻量级,无需 clone)
scripts/create_skill.py
创建标准化 Skill 目录结构
scripts/import_github_skill.py
完整导入 GitHub 仓库为本地 Skill(支持并行下载)
ScriptFunction
scripts/fetch_github_info.py
Retrieve GitHub repository metadata (lightweight, no clone required)
scripts/create_skill.py
Create standardized Skill directory structure
scripts/import_github_skill.py
Full import of GitHub repository as local Skill (supports parallel download)

import_github_skill.py(推荐)

import_github_skill.py (Recommended)

高效地从 GitHub 仓库下载所有文件并创建本地 Skill。
特点:
  • 使用 GitHub API 获取目录结构(单次请求)
  • 并行下载所有文件(10 线程)
  • API 限流时自动切换到 git clone 备选方案
  • 支持自定义 Skill 名称
  • 支持移除源信息(
    --no-source
用法:
bash
undefined
Efficiently download all files from a GitHub repository and create a local Skill.
Features:
  • Retrieve directory structure using GitHub API (single request)
  • Parallel download of all files (10 threads)
  • Automatically switch to git clone fallback when API is rate-limited
  • Support custom Skill names
  • Support removing source information (
    --no-source
    )
Usage:
bash
undefined

基本用法

Basic usage

python scripts/import_github_skill.py <github_url> <output_dir>
python scripts/import_github_skill.py <github_url> <output_dir>

自定义名称

Custom name

python scripts/import_github_skill.py <github_url> <output_dir> --name my-skill
python scripts/import_github_skill.py <github_url> <output_dir> --name my-skill

不保留源信息(作为全新本地 Skill)

Do not retain source information (as a new local Skill)

python scripts/import_github_skill.py <github_url> <output_dir> --no-source
python scripts/import_github_skill.py <github_url> <output_dir> --no-source

组合使用

Combination usage

python scripts/import_github_skill.py https://github.com/user/repo ./skills --name my-skill --no-source

**示例:**
```bash
python scripts/import_github_skill.py https://github.com/user/repo ./skills --name my-skill --no-source

**Example:**
```bash

导入并重命名

Import and rename

python scripts/import_github_skill.py https://github.com/PenglongHuang/chinese-novelist-skill ./skills --name chinese-novelist --no-source
undefined
python scripts/import_github_skill.py https://github.com/PenglongHuang/chinese-novelist-skill ./skills --name chinese-novelist --no-source
undefined

最佳实践

Best Practices

  1. 渐进式披露: 不要将整个仓库内容塞入 Skill,只包含必要的封装代码
  2. 依赖隔离: 生成的 Skill 应明确声明依赖,建议使用 venv 或 uv 管理
  3. 幂等性:
    source_hash
    字段允许 skill-manager 后续检查更新
  4. 描述完整: description 必须包含"做什么"和"何时使用"
  1. Progressive Disclosure: Do not stuff the entire repository content into the Skill, only include necessary wrapper code
  2. Dependency Isolation: Generated Skills should explicitly declare dependencies, recommend using venv or uv for management
  3. Idempotency: The
    source_hash
    field allows skill-manager to check for updates later
  4. Complete Description: The description must include "what it does" and "when to use"

示例

Examples

示例 1: 封装 yt-dlp

Example 1: Wrap yt-dlp

用户: /skill-factory https://github.com/yt-dlp/yt-dlp

Agent:
1. 运行 fetch_github_info.py 获取仓库信息
2. 分析 README,了解 yt-dlp 是视频下载工具
3. 运行 create_skill.py 创建目录
4. 完善 SKILL.md,添加常用命令示例
5. 实现 wrapper.py,封装下载功能
User: /skill-factory https://github.com/yt-dlp/yt-dlp

Agent:
1. Run fetch_github_info.py to retrieve repository information
2. Analyze README to understand yt-dlp is a video download tool
3. Run create_skill.py to create directory
4. Refine SKILL.md and add common command examples
5. Implement wrapper.py to encapsulate download functionality

示例 2: 封装 ffmpeg-python

Example 2: Wrap ffmpeg-python

用户: 把 https://github.com/kkroening/ffmpeg-python 打包成 Skill

Agent:
1. 获取仓库信息
2. 分析 README,了解这是 FFmpeg 的 Python 绑定
3. 创建 Skill 目录
4. 完善文档,添加常用转换示例
5. 实现 wrapper.py,封装常用操作
User: Package https://github.com/kkroening/ffmpeg-python into a Skill

Agent:
1. Retrieve repository information
2. Analyze README to understand this is Python bindings for FFmpeg
3. Create Skill directory
4. Refine documentation and add common conversion examples
5. Implement wrapper.py to encapsulate common operations

与其他 Skill 的协作

Collaboration with Other Skills

  • skill-manager: 使用 source_url 和 source_hash 检查更新
  • skill-evolution: 使用 evolution_enabled 控制是否记录用户经验
  • skill-creator: 遵循相同的目录结构和元数据规范
  • skill-manager: Use source_url and source_hash to check for updates
  • skill-evolution: Use evolution_enabled to control whether user experiences are recorded
  • skill-creator: Follow the same directory structure and metadata specifications