Skills are external tools with bundled scripts and resources that extend OpenCode's capabilities. They follow Anthropic's Agent Skills Specification and are enabled via the opencode-skills plugin.
- Auto-discovery - Scans project, home, and config directories for skills
- Spec compliance - Validates against Anthropic's Skills Specification v1.0
- Dynamic tools - Each skill becomes a
skills_{{name}}tool - Path resolution - Base directory context for relative file paths
- Nested skills - Supports hierarchical skill organization
- Graceful errors - Invalid skills skipped with helpful messages
- OpenCode SDK >= 1.0.126 - Required for agent context preservation
Add the plugin to your opencode.json or ~/.config/opencode/opencode.json:
{
"plugin": ["opencode-skills"]
}OpenCode auto-installs plugins on startup.
Pin to a specific version:
{
"plugin": ["opencode-skills@0.1.1"]
}# Check installed version
cat ~/.cache/opencode/node_modules/opencode-skills/package.json | grep version
# Force update
rm -rf ~/.cache/opencode
# Then restart OpenCodeThe plugin scans three locations (lowest to highest priority):
~/.config/opencode/skills/- XDG config location~/.opencode/skills/- Global skills (all projects).opencode/skills/- Project-local skills (overrides global)
All locations are merged. Duplicate skill names: project-local takes precedence.
mkdir -p .opencode/skills/my-skillEvery skill must have a SKILL.md file with YAML frontmatter:
---
name: my-skill
description: A custom skill that helps with specific tasks (min 20 chars)
license: MIT
allowed-tools:
- read
- write
metadata:
version: "1.0"
---
# My Custom Skill
This skill helps you accomplish specific tasks.
## Instructions
1. First, do this
2. Then, do that
3. Finally, verify the results
You can reference supporting files like `scripts/helper.py`.my-skill/
├── SKILL.md # Required
├── scripts/ # Executable code
│ └── helper.py
├── references/ # Documentation
│ └── api-docs.md
└── assets/ # Output files
└── template.html
Skills are discovered at startup.
The agent can invoke skills_my_skill and the skill content + base directory is provided.
| Directory | Frontmatter Name | Tool Name |
|---|---|---|
brand-guidelines/ |
brand-guidelines |
skills_brand_guidelines |
tools/analyzer/ |
analyzer |
skills_tools_analyzer |
Rules:
- Directory name: lowercase with hyphens (
[a-z0-9-]+) - Frontmatter
name: must match directory name exactly - Description: minimum 20 characters
By default, all discovered skills are available. Use tool configuration to control access.
{
"$schema": "https://opencode.ai/config.json",
"tools": {
"skills_*": false,
"skills_my_skill": true
}
}{
"$schema": "https://opencode.ai/config.json",
"tools": {
"skills_*": false
},
"agent": {
"build": {
"tools": {
"skills_document_skills_docx": true,
"skills_document_skills_xlsx": true
}
}
}
}mode: subagent
description: Content creator agent
tools:
skills_brand_guidelines: true
skills_writing_style: trueThe plugin uses Anthropic's message insertion pattern:
- Skill loading message - Announces skill activation
- Skill content message - Delivers instructions with base directory context
- Tool confirmation - Returns
"Launching skill: {name}"
Both messages use noReply: true, so skill content persists throughout conversations.
Skills reference files with relative paths:
Read `references/api.md` and run `scripts/deploy.sh`The agent receives base directory context and resolves paths automatically.
| Issue | Solution |
|---|---|
| Skills not discovered | Verify SKILL.md exists, check console for messages |
| Tool not appearing | Ensure name matches directory, restart OpenCode |
| Paths not resolving | Check base directory in output, use relative paths |
| Invalid skill errors | Name must be lowercase+hyphens, description >= 20 chars |
| Plugin not updating | Clear cache: rm -rf ~/.cache/opencode |
Location: .opencode/skills/weather/
A skill that fetches weather data using Open-Meteo API:
weather/
├── SKILL.md # Skill instructions
└── scripts/
└── get-weather.ts # Executable TypeScript
Usage:
npx tsx .opencode/skills/weather/scripts/get-weather.ts "London"
npx tsx .opencode/skills/weather/scripts/get-weather.ts "Paris" "2025-01-15"The skill is enabled in opencode.json:
{
"tools": {
"skills_*": false,
"skills_weather": true
}
}