create-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese创建Skill
Create Skill
目的
Purpose
创建新的skill文件,如果插件结构不存在则自动初始化。
Create a new skill file, and automatically initialize the plugin structure if it does not exist.
执行逻辑
Execution Logic
1. 检查插件结构
1. Check Plugin Structure
检查当前目录是否存在 .claude/ 目录
├─ 找到 → 继续到步骤3
└─ 未找到 → 进入步骤2Check if the .claude/ directory exists in the current directory
├─ Found → Proceed to Step 3
└─ Not Found → Enter Step 22. 自动初始化插件(如需要)
2. Automatically Initialize Plugin (if required)
- 读取 init-plugin skill 获取结构知识
- 询问用户:"这个插件应该叫什么名字?"
- 验证名称格式(小写、连字符)
- 创建 .claude/ 结构:
- .claude/skills/
- .claude/agents/
- .claude/commands/
- .claude/hooks/hooks.json
- 继续到步骤3
- Read the init-plugin skill to obtain structure knowledge
- Ask the user: "What should this plugin be named?"
- Validate name format (lowercase, hyphen-separated)
- Create the .claude/ structure:
- .claude/skills/
- .claude/agents/
- .claude/commands/
- .claude/hooks/hooks.json
- Proceed to Step 3
3. 收集skill信息
3. Collect Skill Information
询问用户:
- "Skill名称?" (验证:小写、连字符、数字)
- "描述?"
- "需要哪些工具?(逗号分隔,或留空)"
Ask the user:
- "Skill name?" (Validation: lowercase, hyphen-separated, numbers allowed)
- "Description?"
- "Which tools are needed? (comma-separated, or leave blank)"
4. 创建skill
4. Create Skill
- 创建目录:
.claude/skills/{skill-name}/ - 从模板生成 SKILL.md
- 插入用户输入(完全按用户提供的内容,不做修改)
- 显示成功消息
- Create directory:
.claude/skills/{skill-name}/ - Generate SKILL.md from template
- Insert user input (exactly as provided, no modifications)
- Display success message
验证规则
Validation Rules
- Skill名称格式:
^[a-z0-9-]+$ - 不允许重复名称: 检查现有skills
- 描述必需: 至少10个字符
- Skill name format:
^[a-z0-9-]+$ - Duplicate names not allowed: Check existing skills
- Description required: At least 10 characters
成功输出
Success Output
✅ Skill已创建: {skill-name}
📁 位置: ./.claude/skills/{skill-name}/SKILL.md
🚀 该skill立即可用✅ Skill created: {skill-name}
📁 Location: ./.claude/skills/{skill-name}/SKILL.md
🚀 This skill is ready to use immediately错误处理
Error Handling
- 名称格式无效 → 重新询问
- 名称重复 → 提示并询问是否覆盖
- 无写入权限 → 报告错误
- Invalid name format → Ask again
- Duplicate name → Prompt and ask if user wants to overwrite
- No write permission → Report error
示例
Example
用户: "创建一个reddit-upvote skill"
执行流程:
- 检查 .claude/ → 未找到
- 询问插件名 → "reddit-automation"
- 创建 .claude/ 结构
- 询问skill信息:
- 名称: reddit-upvote
- 描述: Upvote Reddit posts
- 工具: (留空)
- 创建 .claude/skills/reddit-upvote/SKILL.md
- 输出成功消息
User: "Create a reddit-upvote skill"
Execution Flow:
- Check .claude/ → Not found
- Ask plugin name → "reddit-automation"
- Create .claude/ structure
- Ask for skill information:
- Name: reddit-upvote
- Description: Upvote Reddit posts
- Tools: (leave blank)
- Create .claude/skills/reddit-upvote/SKILL.md
- Output success message