skill-creator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill Creator
Skill Creator
创建新的 OpenCode Skill。
Create a new OpenCode Skill.
何时使用
When to Use
用户想要创建一个新的 OpenCode skill 时使用。
Use this when the user wants to create a new OpenCode Skill.
重要参考
Important References
在创建 skill 之前,必须阅读以下文档:
- SKILL.md 格式规范 — YAML frontmatter 和 Markdown 正文的格式要求
- 目录结构规范 — scripts/references/assets 的用途和选择
- 脚本语言选择指南 — 何时需要脚本 + 语言选择原则
- 路径引用规范 — 必读:skill 内部资源的合规引用方式(相对路径 / Markdown 链接,禁止硬编码绝对路径)
Before creating a skill, you must read the following documents:
- SKILL.md Format Specification — Format requirements for YAML frontmatter and Markdown content
- Directory Structure Specification — Purpose and selection of scripts/references/assets
- Script Language Selection Guide — When scripts are needed + language selection principles
- Path Resolution Specification — Must-read: Compliant way to reference internal skill resources (relative paths / Markdown links, hard-coded absolute paths are prohibited)
生态字段(可选 frontmatter)
Ecosystem Fields (Optional Frontmatter)
agentskills.io 规范除必填的 、 外,还支持以下可选字段(创建时按需选用,不要为填而填):
namedescription| 字段 | 用途 | 示例 |
|---|---|---|
| 许可证名称,或指向随 skill 附带的许可证文件 | |
| 环境要求(目标产品、系统包、网络访问等),1-500 字符,大多数 skill 不需要 | |
| 自定义键值对元数据(author、version、category 等),可含 | 见下例 |
| 空格分隔的预授权工具列表(实验性字段,各 Agent 支持程度不一) | |
yaml
metadata:
author: your-name
version: "1.0.0"
supportedAgents: ["claude-code", "opencode"]要点:
- :可选,写法参考本仓库其他 skill(如
license)。license: MIT - :声明该 skill 面向的 Agent 列表;省略表示全兼容。
metadata.supportedAgents - :可选,写法参考本仓库其他 skill(如
allowed-tools)。格式必须为空格分隔字符串(allowed-tools: Bash),支持子命令限制形式(如allowed-tools: Read Write Edit);不要写成 YAML 数组或逗号分隔。不写则工具默认全部可用。Bash(git:*)
In addition to the required and , the agentskills.io specification supports the following optional fields (use as needed when creating, do not fill for the sake of filling):
namedescription| Field | Purpose | Example |
|---|---|---|
| Name of the license, or a link to the license file included with the skill | |
| Environment requirements (target products, system packages, network access, etc.), 1-500 characters, most skills do not require it | |
| Custom key-value pair metadata (author, version, category, etc.), can include | See example below |
| Space-separated list of pre-authorized tools (experimental field, support varies by Agent) | |
yaml
metadata:
author: your-name
version: "1.0.0"
supportedAgents: ["claude-code", "opencode"]Key Points:
- : Optional, refer to other skills in this repository for writing style (e.g.,
license).license: MIT - : Declare the list of Agents this skill is intended for; omitting it means full compatibility.
metadata.supportedAgents - : Optional, refer to other skills in this repository for writing style (e.g.,
allowed-tools). Must be a space-separated string (e.g.,allowed-tools: Bash), supports subcommand restriction format (such asallowed-tools: Read Write Edit); do not write as YAML array or comma-separated. If not specified, all tools are available by default.Bash(git:*)
创建流程
Creation Process
Phase 1: 澄清需求
Phase 1: Clarify Requirements
一轮问完所有需要的信息。 包括:
- 使用场景:这个 skill 在哪些情况下会被调用?举 2-3 个典型场景。
- 输入/输出:输入什么 → 产出什么?
- 边界情况:有没有需要特别处理的边界?
- skill 名字(kebab-case)
- 触发词:什么时候应该触发?列出用户可能说的关键词
- 输出格式:产出有什么格式要求?
- 安装位置:这个 skill 的最终目标路径是哪里?(这是唯一位置,不存在 deploy 步骤)
询问用户直接在主对话中进行即可(提问/确认都是普通对话,不需要专门的 question 工具)。为可选字段,不写则工具默认全部可用。allowed-tools
关于"安装位置"必问的 3 个子问题:
- 使用范围:这个 skill 给当前用户所有项目用(全局),还是只给当前项目用(项目级)?
- 项目自定义目录:当前项目根目录是否已经有 skill 目录约定(非 ,例如
.opencode/skills/、skills/)?如果有,优先用项目自己的约定。.agents/skills/ - 是否在
.opencode:如果是项目级 skill 且要随 Git 共享,需要确认.gitignore没被忽略,否则换.opencode/或skills/的opencode.json。skills.paths
位置速查(详见 目录结构规范 - 安装位置):
- 全局通用:← 个人用,推荐默认
~/.config/opencode/skills/<name>/ - 项目级(随 Git 共享):← 项目专属
<project>/.opencode/skills/<name>/ - 项目自定义:用户项目根目录的 等 ← 遵循项目既有约定
skills/
用以下格式总结你的理解,让用户确认:
undefinedAsk all necessary information in one round. Include:
- Usage Scenarios: In which situations will this skill be invoked? Provide 2-3 typical scenarios.
- Input/Output: What is the input → what is the output?
- Edge Cases: Are there any edge cases that need special handling?
- Skill Name (kebab-case)
- Trigger Phrases: When should this skill be triggered? List keywords the user might say
- Output Format: Are there any format requirements for the output?
- Installation Location: Where is the final target path for this skill? (This is the only location, there is no deploy step)
Ask the user directly in the main conversation (questions/confirmations are regular conversations, no special question tool is needed).is an optional field; if not specified, all tools are available by default.allowed-tools
3 Sub-questions that must be asked about "Installation Location":
- Scope: Is this skill for all projects of the current user (global), or only for the current project (project-level)?
- Project Custom Directory: Does the current project root directory already have a skill directory convention (not , such as
.opencode/skills/,skills/)? If yes, prioritize the project's existing convention..agents/skills/ - Is in
.opencode: If it is a project-level skill and needs to be shared with Git, confirm that.gitignoreis not ignored; otherwise, use.opencode/orskills/inskills.pathsinstead.opencode.json
Location Quick Reference(See Directory Structure Specification - Installation Location for details):
- Global Use: ← For personal use, recommended default
~/.config/opencode/skills/<name>/ - Project-level (Shared with Git): ← Exclusive to the project
<project>/.opencode/skills/<name>/ - Project Custom: or other directories in the user's project root ← Follow the project's existing convention
skills/
Summarize your understanding in the following format and ask the user to confirm:
undefined我的理解
My Understanding
- 解决的问题:{一句话}
- 典型场景:{2-3 个场景}
- 输入/输出:{输入} → {输出}
- 边界:{需要注意的边界}
- skill 名字:
{name} - 触发词:{触发词列表}
- 安装位置:← 这是最终目标,创建后即可使用,无需复制
{绝对路径}
以上理解正确吗?
**以上理解正确吗?请确认,或补充遗漏的信息。**- Problem Solved: {one sentence}
- Typical Scenarios: {2-3 scenarios}
- Input/Output: {input} → {output}
- Edge Cases: {notable edge cases to watch for}
- Skill Name:
{name} - Trigger Phrases: {list of trigger phrases}
- Installation Location: ← This is the final location, ready to use after creation, no need to copy
{absolute path}
Is the above understanding correct?
**Is the above understanding correct? Please confirm, or supplement any missing information.**Phase 2: 创建文件
Phase 2: Create Files
直接在主对话里写 SKILL.md。 根据实际复杂度判断是否需要 scripts/、references/、assets/ 子目录。
- 创建目录结构
- 写入 SKILL.md
- 如需 scripts/,创建并写入脚本文件
- 如需 references/,创建并写入参考文档
- 如需 assets/,创建并写入资源文件
关键:SKILL.md 中引用 skill 内部资源(scripts/、references/、assets/ 等子目录下的文件)时,用相对路径(相对于 skill 目录,如 )或 Markdown 链接(如 ),详见 路径引用规范。禁止硬编码绝对路径(如 ),禁止 语法(如 ——agentskills.io 规范不允许,其他 Agent 无法识别)。
scripts/main.py[指南](references/guide.md)~/.config/opencode/skills/xxx@path@scripts/xxxbash
undefinedWrite SKILL.md directly in the main conversation. Determine whether subdirectories like scripts/, references/, assets/ are needed based on actual complexity.
- Create directory structure
- Write SKILL.md
- If scripts/ is needed, create and write script files
- If references/ is needed, create and write reference documents
- If assets/ is needed, create and write resource files
Key: When referencing internal skill resources (files in subdirectories like scripts/, references/, assets/) in SKILL.md, use relative paths (relative to the skill directory, e.g., ) or Markdown links (e.g., ), see Path Resolution Specification for details. Prohibit hard-coded absolute paths (e.g., ), prohibit syntax (e.g., — not allowed by agentskills.io specification, cannot be recognized by other Agents).
scripts/main.py[Guide](references/guide.md)~/.config/opencode/skills/xxx@path@scripts/xxxbash
undefined示例:全局 skill —— 这一步就是最终位置
Example: Global skill — This is the final location
mkdir -p ~/.config/opencode/skills/{skill-name}/
mkdir -p ~/.config/opencode/skills/{skill-name}/
示例:项目级 skill —— 这一步也是最终位置
Example: Project-level skill — This is also the final location
mkdir -p .opencode/skills/{skill-name}/
> ⚠️ **关键澄清**:`mkdir -p` 创建的目录就是 skill 的**最终存放位置**。OpenCode 通过纯文件发现机制加载 skill(扫描 6+ 个已知路径,后发现的同名 skill 覆盖先发现的),**不存在 "deploy 到全局" 这一步骤**。如果用户要"全局"skill,直接写到 `~/.config/opencode/skills/<name>/` 即可,不要先写到 `.opencode/skills/` 再复制。
**写完后告知用户文件路径,让用户直接 review 最终文件。** 用户可以:
- 直接使用(无需回复)
- 提出修改意见(进入修改循环)
- 删除文件重来
---mkdir -p .opencode/skills/{skill-name}/
> ⚠️ **Key Clarification**: The directory created by `mkdir -p` is the **final storage location** of the skill. OpenCode loads skills through a pure file discovery mechanism (scans 6+ known paths, later discovered skills with the same name override earlier ones), **there is no "deploy to global" step**. If the user wants a "global" skill, write directly to `~/.config/opencode/skills/<name>/`, do not write to `.opencode/skills/` first and then copy.
**After writing, inform the user of the file path and let them directly review the final files.** The user can:
- Use it directly (no reply needed)
- Propose modification suggestions (enter modification loop)
- Delete files and start over
---⚠️ 重要提醒
⚠️ Important Reminder
Phase 1 必须完成:理解用户问题要透彻,不清楚就问。
Phase 1 must be completed: Understand the user's problem thoroughly, ask if unclear.
目录结构完整说明
Complete Directory Structure Description
skill-name/
├── SKILL.md # 必选:指令 + 元数据
├── scripts/ # 可选:可执行脚本
├── references/ # 可选:参考文档
└── assets/ # 可选:模板/资源skill-name/
├── SKILL.md # Required: Instructions + Metadata
├── scripts/ # Optional: Executable scripts
├── references/ # Optional: Reference documents
└── assets/ # Optional: Templates/Resources