skill-create

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Purpose

目的

This skill instructs AI agents on how to create new skills and add them to the shared
skills
repository at
https://github.com/sourman/skills
.
本技能用于指导AI Agent如何创建新技能,并将其添加到位于
https://github.com/sourman/skills
的共享
skills
仓库中。

Repository Location

仓库位置

The skills repository is located at:
  • Remote:
    https://github.com/sourman/skills
  • Local working copy:
    /tmp/skills
    (or
    ~/skills
    in some environments)
技能仓库的地址如下:
  • 远程仓库:
    https://github.com/sourman/skills
  • 本地工作副本:
    /tmp/skills
    (部分环境下为
    ~/skills

Skill Structure

技能结构

Each skill is a directory at the repository root containing a
SKILL.md
file:
skills/
├── skill-name-1/
│   └── SKILL.md
├── skill-name-2/
│   └── SKILL.md
└── README.md
The
SKILL.md
file must have:
  1. YAML frontmatter with
    name
    and
    description
  2. Markdown content with instructions for the AI agent
每个技能都是仓库根目录下的一个文件夹,其中包含一个
SKILL.md
文件:
skills/
├── skill-name-1/
│   └── SKILL.md
├── skill-name-2/
│   └── SKILL.md
└── README.md
SKILL.md
文件必须包含:
  1. 带有
    name
    description
    YAML前置元数据
  2. 供AI Agent查看的Markdown格式操作说明

Creating a New Skill

创建新技能

Step 1: Navigate to the Repository

步骤1:进入仓库目录

bash
cd /tmp/skills
bash
cd /tmp/skills

OR if it doesn't exist:

若仓库不存在则执行:

git clone git@github.com:sourman/skills.git /tmp/skills cd /tmp/skills
undefined
git clone git@github.com:sourman/skills.git /tmp/skills cd /tmp/skills
undefined

Step 2: Create the Skill Directory

步骤2:创建技能文件夹

bash
mkdir <skill-name>
Use kebab-case for skill names (e.g.,
react-best-practices
,
typescript-eslint
,
docker-workflow
).
bash
mkdir <skill-name>
技能名称请使用kebab-case格式(例如:
react-best-practices
typescript-eslint
docker-workflow
)。

Step 3: Create the SKILL.md File

步骤3:创建SKILL.md文件

Create
<skill-name>/SKILL.md
with the following structure:
markdown
---
name: skill-name
description: Brief one-line description of what this skill teaches the AI agent
---
创建
<skill-name>/SKILL.md
文件,结构如下:
markdown
---
name: skill-name
description: 对本技能教授内容的简短单行描述
---

Skill Title

技能标题

A clear, concise description of what this skill covers.
清晰、简洁地描述本技能涵盖的内容。

What This Skill Covers

本技能涵盖的内容

  • Topic area 1
  • Topic area 2
  • Topic area 3
  • 主题领域1
  • 主题领域2
  • 主题领域3

Key Commands

核心命令

bash
undefined
bash
undefined

Example commands relevant to this skill

与本技能相关的示例命令

command --option value
undefined
command --option value
undefined

Detailed Instructions

详细操作说明

Provide detailed instructions, best practices, and workflows here.
在此处提供详细的操作步骤、最佳实践和工作流程。

When to Use This Skill

适用场景

Use this skill when:
  • Condition 1
  • Condition 2

**Frontmatter Requirements:**
- `name`: Must match the directory name (kebab-case)
- `description`: One-line summary for the skills directory
在以下场景中使用本技能:
  • 场景1
  • 场景2

**前置元数据要求:**
- `name`:必须与文件夹名称一致(kebab-case格式)
- `description`:技能目录中展示的单行摘要

Step 4: Add and Commit to Git

步骤4:Git提交与暂存

bash
undefined
bash
undefined

Ensure you're on the master branch

确保当前处于master分支

git checkout master
git checkout master

Add the new skill

暂存新技能

git add <skill-name>/
git add <skill-name>/

Commit with a descriptive message

提交并添加描述性信息

git commit -m "Add <skill-name> skill"
git commit -m "Add <skill-name> skill"

If the master branch doesn't exist, you might be on main:

若master分支不存在,可能当前处于main分支:

git checkout main
undefined
git checkout main
undefined

Step 5: Push to GitHub

步骤5:推送到GitHub

bash
undefined
bash
undefined

Push the changes

推送变更

git push origin master
git push origin master

OR if on main:

若当前处于main分支则执行:

git push origin main
undefined
git push origin main
undefined

Example: Creating a New Skill

示例:创建新技能

Here's a complete example of creating a skill called
git-workflow
:
bash
undefined
以下是创建名为
git-workflow
技能的完整示例:
bash
undefined

1. Navigate to repo

1. 进入仓库目录

cd /tmp/skills
cd /tmp/skills

2. Create directory

2. 创建文件夹

mkdir git-workflow
mkdir git-workflow

3. Create SKILL.md

3. 创建SKILL.md文件

cat > git-workflow/SKILL.md << 'EOF'

name: git-workflow description: Git best practices, branching strategies, and commit conventions

cat > git-workflow/SKILL.md << 'EOF'

name: git-workflow description: Git最佳实践、分支策略和提交规范

Git Workflow

Git工作流

This skill covers Git best practices for collaborative development.
本技能涵盖协作开发中的Git最佳实践。

Branch Naming

分支命名规则

Use descriptive branch names:
  • feature/add-user-authentication
  • fix/login-page-bug
  • refactor/database-connection
使用描述性的分支名称:
  • feature/add-user-authentication
  • fix/login-page-bug
  • refactor/database-connection

Commit Messages

提交信息规范

Follow conventional commits:
  • feat: add user authentication
  • fix: resolve login redirect issue
  • docs: update API documentation
    EOF
遵循约定式提交规范:
  • feat: add user authentication
  • fix: resolve login redirect issue
  • docs: update API documentation
    EOF

4. Commit

4. 提交变更

git add git-workflow/ git commit -m "Add git-workflow skill"
git add git-workflow/ git commit -m "Add git-workflow skill"

5. Push

5. 推送到远程仓库

git push origin master
undefined
git push origin master
undefined

Updating an Existing Skill

更新已有技能

To update an existing skill:
bash
cd /tmp/skills
更新已有技能的操作步骤:
bash
cd /tmp/skills

Edit the skill file

编辑技能文件

vim <skill-name>/SKILL.md
vim <skill-name>/SKILL.md

Commit and push

提交并推送变更

git add <skill-name>/SKILL.md git commit -m "Update <skill-name> skill: describe changes" git push origin master
undefined
git add <skill-name>/SKILL.md git commit -m "Update <skill-name> skill: describe changes" git push origin master
undefined

Verifying the Skill

技能验证

After pushing, verify the skill is accessible:
  1. Check GitHub: https://github.com/sourman/skills/tree/main/<skill-name>
  2. Test installation in another project:
    bash
    bun x skills add sourman/skills/<skill-name>
推送完成后,验证技能是否可正常访问:
  1. 查看GitHub页面:https://github.com/sourman/skills/tree/main/<skill-name>
  2. 在其他项目中测试安装:
    bash
    bun x skills add sourman/skills/<skill-name>

Important Notes

重要注意事项

  1. Always use kebab-case for skill directory names
  2. Frontmatter
    name
    must match
    the directory name
  3. Write clear descriptions - this is what agents see when listing skills
  4. Test your skill by installing it in a different project
  5. Keep skills focused - each skill should cover a specific domain or technology
  1. 始终使用kebab-case格式命名技能文件夹
  2. 前置元数据中的
    name
    必须与文件夹名称一致
  3. 编写清晰的描述 - 这是Agent在列出技能时看到的内容
  4. 测试技能 - 在其他项目中安装并验证
  5. 保持技能聚焦 - 每个技能应覆盖特定领域或技术

Troubleshooting

故障排除

Git Push Fails

Git推送失败

If push fails with "remote does not support password authentication":
bash
undefined
若推送时提示“remote does not support password authentication”:
bash
undefined

Ensure SSH is set up correctly

确保SSH配置正确

ssh -T git@github.com
undefined
ssh -T git@github.com
undefined

Branch Name Issues

分支名称问题

If you're not sure which branch you're on:
bash
git branch
若不确定当前所在分支:
bash
git branch

Use 'main' or 'master' accordingly

根据结果使用'main'或'master'分支

undefined
undefined

Permission Denied

权限不足

If you can't push:
  1. Verify you have push access to sourman/skills
  2. Check that you're authenticated as the correct user:
    gh auth status
若无法推送:
  1. 验证是否拥有sourman/skills仓库的推送权限
  2. 检查当前认证用户是否正确:
    gh auth status