AgentSkillsCN

build-skill

生成高质量的 Git 提交信息:仔细审视并暂存预期变更,将其拆分为逻辑清晰的提交,并撰写简洁明了的提交信息(包含 Conventional Commits 规范)。适用于用户需要提交代码、撰写提交信息、暂存变更,或希望将工作拆分为多个提交时。

SKILL.md
--- frontmatter
name: build-skill
description: Create effective skills for OpenCode agents. Load FIRST before writing any SKILL.md. Provides required format, naming conventions, progressive disclosure patterns, and validation. Use when building, reviewing, or debugging skills.

Building Skills

Skills extend agent capabilities with specialized knowledge, workflows, and tools.

Quick Start

Minimal viable skill in 30 seconds:

bash
mkdir my-skill && cat > my-skill/SKILL.md << 'EOF'
---
name: my-skill
description: Does X when Y happens. Use for Z tasks.
---

# My Skill

Instructions go here.
EOF

Place in .opencode/skill/ (project) or ~/.config/opencode/skill/ (global).

Skill Type Decision Tree

code
What are you building?
├─ Instructions only → Simple skill (SKILL.md only)
│   Example: code-review guidelines, commit message format
│
├─ Domain knowledge → Reference-heavy skill (+ references/)
│   Example: API docs, database schemas, company policies
│
├─ Repeatable automation → Script-heavy skill (+ scripts/)
│   Example: PDF processing, data validation, file conversion
│
├─ Complex multi-step workflow → Multi-file skill (all directories)
│   Example: release process, deployment pipeline
│
└─ Large platform → Progressive skill
    Example: AWS, GCP, Cloudflare (60+ products)

When to Create a Skill

Create a skill when:

  • Same instructions repeated across conversations
  • Domain knowledge model lacks (schemas, internal APIs, company policies)
  • Workflow requires 3+ steps with specific order
  • Code rewritten repeatedly for same task
  • Team needs shared procedural knowledge

When NOT to Create a Skill

ScenarioDo Instead
Single-use instructionsAGENTS.md or inline in conversation
Model already knows domainDon't add redundant context
< 3 steps, no reuseInline instructions
Highly variable workflowHigher-freedom guidelines
Just want to store filesUse regular directories

Reading Order

TaskFiles to Read
New skill from scratchanatomy.md → frontmatter.md
Optimize existing skillprogressive-disclosure.md
Add scripts/resourcesbundled-resources.md
Find skill patternpatterns.md
Debug/fix skillgotchas.md

In This Reference

FilePurpose
anatomy.mdSkill directory structures
frontmatter.mdYAML spec, naming, validation
progressive-disclosure.mdToken-efficient design
bundled-resources.mdscripts/, references/, assets/
patterns.mdReal-world skill patterns
gotchas.mdCommon mistakes + fixes

Scripts

ScriptPurpose
scripts/init_skill.shScaffold new skill
scripts/validate_skill.shValidate skill structure
scripts/package_skill.shCreate distributable zip

Pre-Flight Checklist

Before using a skill:

  • SKILL.md starts with --- (line 1, no blank lines)
  • name: field present, matches directory name
  • description: includes what + when to use
  • Closing --- after frontmatter
  • SKILL.md under 200 lines (use references/ for more)
  • All internal links resolve

Run: ./scripts/validate_skill.sh ./my-skill

Skill Locations

PriorityLocation
1.opencode/skill/<name>/ (project)
2~/.config/opencode/skill/<name>/ (global)
3.claude/skills/<name>/ (Claude-compat)

Discovery walks up from CWD to git root. First-wins for duplicate names.

See Also