create-skill-from-repo

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Create Skills from Repo

从仓库创建Skills

Use this workflow to quickly ingest a framework or project's logic and documentation into the local environment. This is triggered when a user provides a
<repo-url>
and a
<skills-name>
for which no local skill yet exists.
使用此工作流可快速将框架或项目的逻辑与文档导入本地环境。当用户提供一个
<repo-url>
和一个本地尚未存在的
<skills-name>
时,将触发此工作流。

🎯 Objectives

🎯 目标

  1. Source Persistence: Keep the original repo in
    sources/
    for traceability and future updates.
  2. Knowledge Distillation: Convert dense documentation into agent-optimized
    references/*.md
    (focusing on Usage and Why over Installation).
  3. Automatic Registration: Ensure the new skill is immediately discoverable via
    AGENTS.md
    .

  1. 源代码持久化:将原始仓库保存在
    sources/
    目录中,以便追溯和后续更新。
  2. 知识提炼:将冗长的文档转换为适配Agent的
    references/*.md
    文件(重点关注使用方法设计初衷,而非安装步骤)。
  3. 自动注册:确保新技能可通过
    AGENTS.md
    立即被发现。

🛠 Prerequisites

🛠 前置条件

  • Validation: Ensure
    <repo-url>
    is valid and
    <skills-name>
    uses kebab-case.
  • Environment: Verify
    git
    access and identify the project root.

  • 验证:确保
    <repo-url>
    有效,且
    <skills-name>
    使用kebab-case命名格式。
  • 环境:验证
    git
    访问权限,并确定项目根目录。

🔄 Workflow

🔄 工作流

Step 1: Source Synchronization

步骤1:源代码同步

  1. Define the destination:
    sources/<submodule>
    .
  2. Sync Logic:
  • Primary:
    git submodule add <repo-url> sources/<submodule>
  • Fallback: If the workspace is not a git repo, use
    git clone --depth 1 <repo-url> sources/<submodule>
  • Maintenance: If the directory exists but is empty, run
    git submodule update --init
    .
  1. 定义目标路径:
    sources/<submodule>
  2. 同步逻辑
  • 主要方式
    git submodule add <repo-url> sources/<submodule>
  • 备选方式:如果工作区不是git仓库,使用
    git clone --depth 1 <repo-url> sources/<submodule>
  • 维护操作:如果目录已存在但为空,执行
    git submodule update --init

Step 2: Identify Knowledge Base

步骤2:识别知识库

  1. Locate Source Root: Scan
    sources/<submodule>/
    for
    docs/
    ,
    wiki/
    ,
    README.md
    , or
    packages/*/docs/
    .
  2. Filtering Strategy:
  • Include: API references, core concepts, design patterns, best practices.
  • Exclude: Installation guides (irrelevant to the Agent), contributing logs, sponsorship info, or marketing fluff.
  1. 定位源代码根目录:扫描
    sources/<submodule>/
    目录,查找
    docs/
    wiki/
    README.md
    packages/*/docs/
  2. 筛选策略
  • 包含:API参考、核心概念、设计模式、最佳实践。
  • 排除:安装指南(与Agent无关)、贡献日志、赞助信息或营销内容。

Step 3: Modular Skill Generation

步骤3:生成模块化技能

Target Structure:
skills/<skills-name>/[SKILL.md, GENERATION.md, references/]
  1. references/*.md
    Guidelines
    :
  • Atomicity: One concept per file.
  • Naming:
    {category}-{concept}.md
    (e.g.,
    core-reactivity.md
    ).
  • Content: Must include a
    Frontmatter
    , a brief description, high-quality Code Snippets, and source URLs.
  1. SKILL.md
    Indexing
    :
  • Create a central entry point with tables categorizing references into
    Core
    ,
    Features
    , and
    Advanced
    .
  1. GENERATION.md
    Metadata
    :
  • Record the Git SHA, source path, and generation date for future diffing.
目标结构
skills/<skills-name>/[SKILL.md, GENERATION.md, references/]
  1. references/*.md
    编写规范
  • 原子性:每个文件对应一个概念。
  • 命名
    {category}-{concept}.md
    (例如:
    core-reactivity.md
    )。
  • 内容:必须包含
    Frontmatter
    、简短描述、高质量代码片段和源代码URL。
  1. SKILL.md
    索引
  • 创建一个中心入口文件,通过表格将参考文档分为
    核心
    功能
    进阶
    三类。
  1. GENERATION.md
    元数据
  • 记录Git SHA、源代码路径和生成日期,以便后续对比差异。

Step 4: The Coverage Loop

步骤4:覆盖循环

  1. Review: Compare the
    Source Root
    navigation tree against the generated
    references/
    .
  2. Supplement: If major modules (e.g., Middleware, Auth, Error Handling) are missing, repeat Step 3 for those specific modules.
  3. Exit Condition: Stop once the primary API surface and architectural pillars are covered. Do not get bogged down in edge cases.
  1. 审查:将
    源代码根目录
    的导航树与生成的
    references/
    目录进行对比。
  2. 补充:如果缺失主要模块(如中间件、认证、错误处理),针对这些特定模块重复执行步骤3。
  3. 退出条件:当覆盖了主要API表面和架构支柱后停止。无需纠结于边缘情况。

Step 5: Integration & Handover

步骤5:集成与交付

  1. **Update
    AGENTS.md**
    : Locate
    AGENTS.md
    in the project root (create it if missing).
  2. Inject Skill Entry:
markdown
undefined
  1. 更新
    AGENTS.md
    :在项目根目录中找到
    AGENTS.md
    (如果不存在则创建)。
  2. 注入技能条目
markdown
undefined

<skills-name>

<skills-name>

  • Location:
    skills/<skills-name>/
  • Description: [Short description from SKILL.md]


3. **Completion Report**: Summarize the output for the user (e.g., "Generated 15 reference files covering Core and Advanced modules").

---
  • 位置
    skills/<skills-name>/
  • 描述:[来自SKILL.md的简短描述]


3. **完成报告**:向用户总结输出内容(例如:“已生成15份参考文件,覆盖核心和进阶模块”)。

---

💡 Key Principles

💡 核心原则

  • Agent-Centric Writing: Write for an AI audience. Prioritize technical accuracy and code examples over prose.
  • Kebab-Case: Strictly use
    kebab-case
    for all directory and filenames.
  • Path Formatting: Always use forward slashes (
    /
    ) for cross-platform compatibility.
  • Incremental Readiness: The
    sources/
    clone should remain so that
    git diff
    can be used later to spot documentation changes.

  • 以Agent为中心的写作:为AI受众编写内容。优先保证技术准确性和代码示例,而非冗长的文字描述。
  • Kebab-Case命名:所有目录和文件名严格使用
    kebab-case
    格式。
  • 路径格式:始终使用正斜杠(
    /
    )以保证跨平台兼容性。
  • 增量就绪
    sources/
    目录下的克隆仓库应保持原样,以便后续使用
    git diff
    发现文档变更。

📚 References

📚 参考资料

TopicDescriptionReference
Coverage CriteriaDefinitions of "major modules" and stop conditionscoverage-loop
Style GuideDetailed writing style for reference filesstyle-guide

Would you like me to simulate a run of this skill using a specific repository URL to show you the expected output?
主题描述参考链接
覆盖标准“主要模块”和停止条件的定义coverage-loop
风格指南参考文件的详细写作风格规范style-guide

是否需要我使用特定的仓库URL模拟运行此技能,以展示预期输出?