Skip to content

Commit 236ce7a

Browse files
docs: Agent Skills (anomalyco#5931)
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
1 parent 8bdc0c8 commit 236ce7a

3 files changed

Lines changed: 124 additions & 2 deletions

File tree

.github/workflows/docs-update.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ jobs:
5353
Steps:
5454
1. For each commit that looks like a new feature or significant change:
5555
- Read the changed files to understand what was added
56-
- Check if the feature is already documented in packages/docs/
56+
- Check if the feature is already documented in packages/web/src/content/docs/*
5757
2. If you find undocumented features:
58-
- Update the relevant documentation files in packages/docs/
58+
- Update the relevant documentation files in packages/web/src/content/docs/*
5959
- Follow the existing documentation style and structure
6060
- Make sure to document the feature clearly with examples where appropriate
6161
3. If all new features are already documented, report that no updates are needed
62+
4. If you are creating a new documentation file be sure to update packages/web/astro.config.mjs too.
6263
6364
Focus on user-facing features and API changes. Skip internal refactors, bug fixes, and test updates unless they affect user-facing behavior.
6465
All doc related commits should start with "docs:" prefix.

packages/web/astro.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export default defineConfig({
7878
"lsp",
7979
"mcp-servers",
8080
"acp",
81+
"skills",
8182
"custom-tools",
8283
],
8384
},
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
title: "Agent Skills"
3+
description: "Define reusable behavior via SKILL.md definitions"
4+
---
5+
6+
Agent skills let OpenCode discover reusable instructions from your repo or home directory.
7+
When a conversation matches a skill, the agent is prompted to read its `SKILL.md`.
8+
9+
---
10+
11+
## Place files
12+
13+
Create one folder per skill name and put a `SKILL.md` inside it.
14+
OpenCode searches these locations:
15+
16+
- Project config: `.opencode/skill/<name>/SKILL.md`
17+
- Global config: `~/.opencode/skill/<name>/SKILL.md`
18+
- Claude-compatible: `.claude/skills/<name>/SKILL.md`
19+
20+
---
21+
22+
## Understand discovery
23+
24+
For project-local paths, OpenCode walks up from your current working directory until it reaches the git worktree.
25+
It loads any matching `skill/*/SKILL.md` in `.opencode/` and any matching `.claude/skills/*/SKILL.md` along the way.
26+
27+
Global definitions are also loaded from `~/.opencode/skill/*/SKILL.md`.
28+
29+
---
30+
31+
## Write frontmatter
32+
33+
Each `SKILL.md` must start with YAML frontmatter.
34+
Only these fields are recognized:
35+
36+
- `name` (required)
37+
- `description` (required)
38+
- `license` (optional)
39+
- `compatibility` (optional)
40+
- `metadata` (optional, string-to-string map)
41+
42+
Unknown frontmatter fields are ignored.
43+
44+
---
45+
46+
## Validate names
47+
48+
`name` must:
49+
50+
- Be 1–64 characters
51+
- Be lowercase alphanumeric with single hyphen separators
52+
- Not start or end with `-`
53+
- Not contain consecutive `--`
54+
- Match the directory name that contains `SKILL.md`
55+
56+
Equivalent regex:
57+
58+
```text
59+
^[a-z0-9]+(-[a-z0-9]+)*$
60+
```
61+
62+
---
63+
64+
## Follow length rules
65+
66+
`description` must be 1-1024 characters.
67+
Keep it specific enough for the agent to choose correctly.
68+
69+
---
70+
71+
## Use an example
72+
73+
Create `.opencode/skill/git-release/SKILL.md` like this:
74+
75+
```markdown
76+
---
77+
name: git-release
78+
description: Create consistent releases and changelogs
79+
license: MIT
80+
compatibility: opencode
81+
metadata:
82+
audience: maintainers
83+
workflow: github
84+
---
85+
86+
## What I do
87+
88+
- Draft release notes from merged PRs
89+
- Propose a version bump
90+
- Provide a copy-pasteable `gh release create` command
91+
92+
## When to use me
93+
94+
Use this when you are preparing a tagged release.
95+
Ask clarifying questions if the target versioning scheme is unclear.
96+
```
97+
98+
---
99+
100+
## Recognize prompt injection
101+
102+
OpenCode adds an `<available_skills>` XML block to the system prompt.
103+
Each entry includes the skill name, description, and its discovered location.
104+
105+
```xml
106+
<available_skills>
107+
<skill>
108+
<name>git-release</name>
109+
<description>Create consistent releases and changelogs</description>
110+
<location>.opencode/skill/git-release/SKILL.md</location>
111+
</skill>
112+
</available_skills>
113+
```
114+
115+
---
116+
117+
## Troubleshoot loading
118+
119+
If a skill does not show up, verify the folder name matches `name` exactly.
120+
Also check that `SKILL.md` is spelled in all caps and includes frontmatter.

0 commit comments

Comments
 (0)