- Full Obsidian vault content - Host configs (ice, grizzley, ubuntu, proxmox, truenas, panda, hyte) - Media stack documentation - Traefik HA setup - Automation scripts - Bachelor party planning
168 lines
4.2 KiB
Markdown
168 lines
4.2 KiB
Markdown
---
|
||
type: agent-doc
|
||
agent: OpenCode
|
||
source: https://opencode.ai/docs/skills/
|
||
scraped: 2026-04-28T21:02:06.096255+00:00
|
||
content_hash: d4968081
|
||
---
|
||
# Agent Skills
|
||
|
||
Define reusable behavior via SKILL.md definitions
|
||
|
||
Agent skills let OpenCode discover reusable instructions from your repo or home directory. Skills are loaded on-demand via the native skill toolâagents see available skills and can load the full content when needed.
|
||
|
||
---
|
||
|
||
## Place files
|
||
|
||
Create one folder per skill name and put a SKILL.md inside it. OpenCode searches these locations:
|
||
|
||
- Project config: .opencode/skills/<name>/SKILL.md
|
||
- Global config: ~/.config/opencode/skills/<name>/SKILL.md
|
||
|
||
- Project agent-compatible: .agents/skills/<name>/SKILL.md
|
||
- Global agent-compatible: ~/.agents/skills/<name>/SKILL.md
|
||
|
||
---
|
||
|
||
## Understand discovery
|
||
|
||
For project-local paths, OpenCode walks up from your current working directory until it reaches the git worktree. It loads any matching skills/*/SKILL.md in .opencode/ and any matching .agents/skills/*/SKILL.md along the way.
|
||
|
||
Global definitions are also loaded from ~/.config/opencode/skills/*/SKILL.md and ~/.agents/skills/*/SKILL.md.
|
||
|
||
---
|
||
|
||
## Write frontmatter
|
||
|
||
Each SKILL.md must start with YAML frontmatter. Only these fields are recognized:
|
||
|
||
- name (required)
|
||
- description (required)
|
||
- license (optional)
|
||
- compatibility (optional)
|
||
- metadata (optional, string-to-string map)
|
||
|
||
Unknown frontmatter fields are ignored.
|
||
|
||
---
|
||
|
||
## Validate names
|
||
|
||
name must:
|
||
|
||
- Be 1â64 characters
|
||
- Be lowercase alphanumeric with single hyphen separators
|
||
- Not start or end with -
|
||
- Not contain consecutive --
|
||
- Match the directory name that contains SKILL.md
|
||
|
||
Equivalent regex:
|
||
|
||
```
|
||
^[a-z0-9]+(-[a-z0-9]+)*$
|
||
```
|
||
|
||
---
|
||
|
||
## Follow length rules
|
||
|
||
description must be 1-1024 characters. Keep it specific enough for the agent to choose correctly.
|
||
|
||
---
|
||
|
||
## Use an example
|
||
|
||
Create .opencode/skills/git-release/SKILL.md like this:
|
||
|
||
```
|
||
---name: git-releasedescription: Create consistent releases and changelogslicense: MITcompatibility: opencodemetadata: audience: maintainers workflow: github---
|
||
## What I do
|
||
- Draft release notes from merged PRs- Propose a version bump- Provide a copy-pasteable `gh release create` command
|
||
## When to use me
|
||
Use this when you are preparing a tagged release.Ask clarifying questions if the target versioning scheme is unclear.
|
||
```
|
||
|
||
---
|
||
|
||
## Recognize tool description
|
||
|
||
OpenCode lists available skills in the skill tool description. Each entry includes the skill name and description:
|
||
|
||
```
|
||
<available_skills> <skill> <name>git-release</name> <description>Create consistent releases and changelogs</description> </skill></available_skills>
|
||
```
|
||
|
||
The agent loads a skill by calling the tool:
|
||
|
||
```
|
||
skill({ name: "git-release" })
|
||
```
|
||
|
||
---
|
||
|
||
## Configure permissions
|
||
|
||
Control which skills agents can access using pattern-based permissions in opencode.json:
|
||
|
||
```
|
||
{ "permission": { "skill": { "*": "allow", "pr-review": "allow", "internal-*": "deny", "experimental-*": "ask" } }}
|
||
```
|
||
|
||
| Permission | Behavior |
|
||
|---|---|
|
||
| allow | Skill loads immediately |
|
||
| deny | Skill hidden from agent, access rejected |
|
||
| ask | User prompted for approval before loading |
|
||
|
||
Patterns support wildcards: internal-* matches internal-docs, internal-tools, etc.
|
||
|
||
---
|
||
|
||
## Override per agent
|
||
|
||
Give specific agents different permissions than the global defaults.
|
||
|
||
For custom agents (in agent frontmatter):
|
||
|
||
```
|
||
---permission: skill: "documents-*": "allow"---
|
||
```
|
||
|
||
For built-in agents (in opencode.json):
|
||
|
||
```
|
||
{ "agent": { "plan": { "permission": { "skill": { "internal-*": "allow" } } } }}
|
||
```
|
||
|
||
---
|
||
|
||
## Disable the skill tool
|
||
|
||
Completely disable skills for agents that shouldnât use them:
|
||
|
||
For custom agents:
|
||
|
||
```
|
||
---tools: skill: false---
|
||
```
|
||
|
||
For built-in agents:
|
||
|
||
```
|
||
{ "agent": { "plan": { "tools": { "skill": false } } }}
|
||
```
|
||
|
||
When disabled, the <available_skills> section is omitted entirely.
|
||
|
||
---
|
||
|
||
## Troubleshoot loading
|
||
|
||
If a skill does not show up:
|
||
|
||
1. Verify SKILL.md is spelled in all caps
|
||
2. Check that frontmatter includes name and description
|
||
3. Ensure skill names are unique across all locations
|
||
4. Check permissionsâskills with deny are hidden from agents
|