关于 skill-create
skill-create 是一项指导 AI Agent 在共享的 sourman/skills 仓库中创建技能的 skill,涵盖目录与 SKILL.md 格式,以及提交、推送和验证步骤。
主要功能
- 01SKILL.md 结构与 YAML frontmatter
- 02使用 kebab-case 命名目录
- 03Git 提交与推送步骤
- 04安装验证说明
适用场景
- 01向 sourman/skills 添加新技能
- 02更新并发布现有技能
- 03在其他项目中检查技能安装
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ sourman/ skills --skill skill-create安装后在 Claude Code 中输入/skill-create确认已加载。
详细介绍
用途
此技能会指导 AI Agent 如何创建新技能,并将其添加到共享的 skills 仓库:https://github.com/sourman/skills。
仓库位置
skills 仓库位于:
- 远程:
https://github.com/sourman/skills - 本地工作副本:
/tmp/skills(某些环境中为~/skills)
技能结构
每个技能都是仓库根目录下的一个目录,其中包含一个 SKILL.md 文件:
skills/
├── skill-name-1/
│ └── SKILL.md
├── skill-name-2/
│ └── SKILL.md
└── README.md
SKILL.md 文件必须包含:
- YAML frontmatter,含有
name和description - Markdown 内容,包含给 AI Agent 的说明
创建新技能
第 1 步:进入仓库
cd /tmp/skills
# OR if it doesn't exist:
git clone [email protected]:sourman/skills.git /tmp/skills
cd /tmp/skills
第 2 步:创建技能目录
mkdir <skill-name>
技能名称使用 kebab-case(例如:react-best-practices、typescript-eslint、docker-workflow)。
第 3 步:创建 SKILL.md 文件
按照以下结构创建 <skill-name>/SKILL.md:
---
name: skill-name
description: Brief one-line description of what this skill teaches the AI agent
---
# Skill Title
A clear, concise description of what this skill covers.
## What This Skill Covers
- Topic area 1
- Topic area 2
- Topic area 3
## Key Commands
```bash
# Example commands relevant to this skill
command --option value
详细说明
在此处提供详细说明、最佳实践和工作流。
适用场景
在以下情况使用此技能:
- 条件 1
- 条件 2
**Frontmatter Requirements:**
- `name`: Must match the directory name (kebab-case)
- `description`: One-line summary for the skills directory
## Step 4: Add and Commit to Git
```bash
# Ensure you're on the master branch
git checkout master
# Add the new skill
git add <skill-name>/
# Commit with a descriptive message
git commit -m "Add <skill-name> skill"
# If the master branch doesn't exist, you might be on main:
git checkout main
第 5 步:推送到 GitHub
# Push the changes
git push origin master
# OR if on main:
git push origin main
示例:创建新技能
以下是创建名为 git-workflow 的技能的完整示例:
# 1. Navigate to repo
cd /tmp/skills
# 2. Create directory
mkdir git-workflow
# 3. Create SKILL.md
cat > git-workflow/SKILL.md << 'EOF'
---
name: git-workflow
description: Git best practices, branching strategies, and commit conventions
---
# Git Workflow
This skill covers Git best practices for collaborative development.
## Branch Naming
Use descriptive branch names:
- `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
# 4. Commit
git add git-workflow/
git commit -m "Add git-workflow skill"
# 5. Push
git push origin master
更新现有技能
更新现有技能的方法:
cd /tmp/skills
# Edit the skill file
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
验证技能
推送后,验证技能是否可访问:
- 在 GitHub 上检查:https://github.com/sourman/skills/tree/main/
- 在另一个项目中测试安装:
bun x skills add sourman/skills/<skill-name>
重要说明
- 技能目录名称始终使用 kebab-case
- frontmatter 中的
name必须与目录名称一致 - 编写清晰的描述——这是 Agent 列出技能时看到的内容
- 测试技能,方法是在其他项目中安装它
- 保持技能聚焦——每个技能都应涵盖特定领域或技术
故障排除
Git 推送失败
如果推送失败,并显示“remote does not support password authentication”:
# Ensure SSH is set up correctly
ssh -T [email protected]
分支名称问题
如果不确定当前所在的分支:
git branch
# Use 'main' or 'master' accordingly
权限被拒绝
如果无法推送:
- 确认你有 sourman/skills 的推送权限
- 检查你是否以正确的用户身份通过身份验证:
gh auth status
评论
支持 Markdown