Files
opencode/skill/opencode/SKILL.md
voson 6153911e46 feat(opencode): 重新创建 OpenCode 技能管理模块并添加 Cursor 同步功能
- 恢复完整的技能创建指南文档

- 新增技能同步到 Cursor IDE 功能

- 更新 SKILL.md 支持技能同步触发短语
2026-01-23 10:41:32 +08:00

6.5 KiB
Raw Permalink Blame History

name, description
name description
opencode Create and manage OpenCode commands and skills with templates and best practices. Includes skill synchronization to Cursor IDE. Use this skill when users ask to create commands, skills, or sync to Cursor.

OpenCode Command and Skill Management

You are an expert in OpenCode configuration and extension development. This skill serves as the entry point for creating and managing OpenCode commands and skills.

Trigger Phrases: When users mention any of the following, automatically use this skill:

  • "创建command", "创建命令", "make command", "create command"
  • "创建skill", "创建技能", "make skill", "create skill"
  • "添加command", "添加命令", "add command"
  • "添加skill", "添加技能", "add skill"
  • "opcode command", "opencode skill"
  • "同步技能", "sync skills", "sync to cursor", "同步到cursor"
  • "技能同步", "skill sync", "同步opencode技能"

Overview

OpenCode extensions are organized into two main types:

  • Commands: User-invoked prompts for repetitive tasks, defined in command/ directory
  • Skills: Reusable behavior definitions for agents, defined in skill/<name>/SKILL.md

Detailed Guides

This skill folder contains comprehensive guides for command and skill creation:

Command Creation

For detailed command creation guidelines, refer to:

  • skill/opencode/command-creation.md - Complete guide to creating OpenCode commands
  • Includes: file structure, templates, best practices, troubleshooting

Skill Creation

For detailed skill creation guidelines, refer to:

  • skill/opencode/skill-creation.md - Complete guide to creating OpenCode skills
  • Includes: directory structure, naming rules, templates, testing

Skill Synchronization (OpenCode → Cursor)

For syncing OpenCode skills to Cursor IDE, refer to:

  • skill/opencode/sync-to-cursor.md - Guide to synchronize OpenCode skills to Cursor IDE
  • Includes: sync strategies, operation steps, error handling, best practices

Quick Start

To Create a Command

  1. Determine command name (kebab-case, descriptive)
  2. Default location: global (~/.config/opencode/command/)
  3. Create file: <command-name>.md
  4. Add frontmatter with description
  5. Write template with $ARGUMENTS support

To Create a Skill

  1. Validate skill name (lowercase, hyphens, alphanumeric)
  2. Default location: global (~/.config/opencode/skill/<skill-name>/)
  3. Create directory: skill/<skill-name>/
  4. Create SKILL.md with required frontmatter
  5. Add structured content: Purpose, Usage, Examples, Troubleshooting

Automatic Name Generation

When users request command or skill creation, names are automatically generated based on the description to provide a seamless experience.

For Commands:

  1. Keyword Extraction: Identify action verbs and target nouns from the description
  2. English Conversion: Convert Chinese keywords to English equivalents (e.g., "创建" → "create", "总结" → "summarize")
  3. Kebab-case Format: Combine words with hyphens, all lowercase (e.g., "create-summary")
  4. Conflict Resolution: Check if name exists in command/ directory, append numeric suffix if needed

For Skills:

  1. Function Extraction: Identify core functionality from the description
  2. Simplified Naming: Use lowercase, hyphen-separated words describing the skill's purpose
  3. Validation: Ensure name follows [a-z0-9-]+ pattern
  4. Conflict Check: Verify uniqueness in skill/ directory

Examples:

  • "创建command用于归纳总结当前对话中有价值的内容" → summarize-conversation
  • "创建skill用于管理git工作流" → git-workflow
  • "添加命令来处理图片压缩" → compress-images
  • "创建技能用于代码审查" → code-review

User Override:

If users explicitly provide a name in their request, use the provided name instead of auto-generation.

Response Guide for Creation Requests

When users ask to create commands or skills, follow this structured approach:

For "创建command" or "创建命令" requests:

  1. 自动生成名称: 基于用户描述自动生成 kebab-case 命令名称
    • 从描述中提取关键词(动词+名词)
    • 转换为英文 kebab-case 格式
    • 如果名称已存在,添加数字后缀(如 -2, -3
  2. 验证名称: 确保名称符合 kebab-case 规范
  3. 默认位置: 全局 (~/.config/opencode/command/)
  4. 创建模板:
    • 生成包含 description 的 frontmatter
    • 创建支持 $ARGUMENTS 的模板
    • 包含使用示例
  5. 写入文件: 在默认位置创建命令文件
  6. 测试: 验证文件存在且格式正确

For "创建skill" or "创建技能" requests:

  1. 自动生成名称: 基于用户描述自动生成 skill 名称
    • 从描述中提取核心功能关键词
    • 转换为小写字母、连字符格式
    • 如果名称已存在,添加数字后缀
  2. 验证名称: 确保名称符合命名规则(小写字母、连字符、字母数字)
  3. 默认位置: 全局 (~/.config/opencode/skill/<name>/)
  4. 创建目录: skill/<name>/
  5. 创建 SKILL.md:
    • 包含 namedescription 的 frontmatter
    • 结构化内容Purpose, Usage, Examples, Best Practices, Troubleshooting
  6. 写入文件: 在默认位置创建完整的 SKILL.md 文件
  7. 测试: 验证技能可正常加载 skill({ name: "<skill-name>" })

Sample Response Format:

我将帮你创建 [command/skill]。

基于您的描述,自动生成名称:[generated-name]

**自动命名规则**:
- 从描述中提取关键词(动词+名词)
- 转换为 kebab-case 格式(小写字母、连字符)
- 检查名称冲突,自动添加数字后缀

**文件详情**:
- 名称: [generated-name]
- 用途: [brief-description]
- 位置: 全局 (~/.config/opencode/[command|skill]/)

已创建 [file-path]

```markdown
[complete file content]

要测试,请运行:[/command-name] 或 skill({ name: "skill-name" })


## Resources

- [OpenCode Skills Documentation](https://opencode.ai/docs/skills)
- [OpenCode Commands Documentation](https://opencode.ai/docs/commands)
- [OpenCode Configuration Guide](https://opencode.ai/docs/config)
- [GitHub Repository](https://github.com/anomalyco/opencode)

## Updates and Maintenance

1. **Regular Review**: Periodically review and update commands/skills
2. **Version Tracking**: Use Git to track changes
3. **Community Sharing**: Share useful commands/skills with community
4. **Feedback Integration**: Incorporate user feedback for improvements

---

*Last updated: 2026-01-15*