summaryrefslogtreecommitdiffhomepage
path: root/packages/web/src/content/docs
diff options
context:
space:
mode:
authorMohammad Alhashemi <[email protected]>2025-12-23 04:14:33 +0300
committerGitHub <[email protected]>2025-12-22 20:14:33 -0500
commit3a54ab68d1f9684d86434dd6e890d43c63adf461 (patch)
treea9f1cd852ead2fa8415339aaafbdeab514017d74 /packages/web/src/content/docs
parent44fd0eee646d6b2d589c9bac0291f5c1c8d4ba9a (diff)
downloadopencode-3a54ab68d1f9684d86434dd6e890d43c63adf461.tar.gz
opencode-3a54ab68d1f9684d86434dd6e890d43c63adf461.zip
feat(skill): add per-agent filtering to skill tool description (#6000)
Diffstat (limited to 'packages/web/src/content/docs')
-rw-r--r--packages/web/src/content/docs/skills.mdx113
1 files changed, 106 insertions, 7 deletions
diff --git a/packages/web/src/content/docs/skills.mdx b/packages/web/src/content/docs/skills.mdx
index 217d4b3d2..c1d433a83 100644
--- a/packages/web/src/content/docs/skills.mdx
+++ b/packages/web/src/content/docs/skills.mdx
@@ -4,7 +4,7 @@ description: "Define reusable behavior via SKILL.md definitions"
---
Agent skills let OpenCode discover reusable instructions from your repo or home directory.
-When a conversation matches a skill, the agent is prompted to read its `SKILL.md`.
+Skills are loaded on-demand via the native `skill` tool—agents see available skills and can load the full content when needed.
---
@@ -97,24 +97,123 @@ Ask clarifying questions if the target versioning scheme is unclear.
---
-## Recognize prompt injection
+## Recognize tool description
-OpenCode adds an `<available_skills>` XML block to the system prompt.
-Each entry includes the skill name, description, and its discovered location.
+OpenCode lists available skills in the `skill` tool description.
+Each entry includes the skill name and description:
```xml
<available_skills>
<skill>
<name>git-release</name>
<description>Create consistent releases and changelogs</description>
- <location>.opencode/skill/git-release/SKILL.md</location>
</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`:
+
+```json
+{
+ "permission": {
+ "skill": {
+ "pr-review": "allow",
+ "internal-*": "deny",
+ "experimental-*": "ask",
+ "*": "allow"
+ }
+ }
+}
+```
+
+| 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):
+
+```yaml
+---
+permission:
+ skill:
+ "documents-*": "allow"
+---
+```
+
+**For built-in agents** (in `opencode.json`):
+
+```json
+{
+ "agent": {
+ "plan": {
+ "permission": {
+ "skill": {
+ "internal-*": "allow"
+ }
+ }
+ }
+ }
+}
+```
+
+---
+
+## Disable the skill tool
+
+Completely disable skills for agents that shouldn't use them:
+
+**For custom agents**:
+
+```yaml
+---
+tools:
+ skill: false
+---
+```
+
+**For built-in agents**:
+
+```json
+{
+ "agent": {
+ "plan": {
+ "tools": {
+ "skill": false
+ }
+ }
+ }
+}
+```
+
+When disabled, the `<available_skills>` section is omitted entirely.
+
---
## Troubleshoot loading
-If a skill does not show up, verify the folder name matches `name` exactly.
-Also check that `SKILL.md` is spelled in all caps and includes frontmatter.
+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