[PR #9010] feat(plugin): add skill support for plugins #12949

Closed
opened 2026-02-16 18:17:50 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9010

State: closed
Merged: No


Summary

Allows plugins to bundle and expose skills by declaring paths in their return type:

export const MyPlugin: Plugin = async () => ({
  skill: ['./skills/pdf', './skills/docs/*']
})

This addresses a gap where plugins can export tool but not skill, making it difficult to distribute complete packages.

Changes

  • Added skill?: string[] to the Hooks interface in @opencode-ai/plugin
  • Created SkillRegistry to track skill paths from plugins
  • Modified Skill.state() to load skills from the registry with proper precedence:
    1. Global ~/.config/opencode/skill/ (lowest priority)
    2. Plugin skills
    3. Project .claude/skills/
    4. Project .opencode/skill/ (highest priority)
  • Added tests for plugin skill loading
  • Updated documentation

Related Issues

  • Closes #6013 - Add Skill Configuration to Config Type
  • Addresses #6347 - Plugin Hook for Registering Additional Config Directories
  • Provides simpler alternative to #8386 - Skill Registry proposal

Why this approach?

As discussed in the issues, instead of creating a separate Skill Registry system or directory hooks, this leverages the existing plugin mechanism. Benefits:

  • No new infrastructure - npm remains the distribution mechanism
  • Consistent model - plugins can now bundle skills + tools + hooks together
  • Simple API - just an array of relative paths with glob support

Testing

bun test packages/opencode/test/skill/plugin-skill.test.ts

All 10 skill tests pass (6 existing + 4 new).

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9010 **State:** closed **Merged:** No --- ## Summary Allows plugins to bundle and expose skills by declaring paths in their return type: ```typescript export const MyPlugin: Plugin = async () => ({ skill: ['./skills/pdf', './skills/docs/*'] }) ``` This addresses a gap where plugins can export `tool` but not `skill`, making it difficult to distribute complete packages. ## Changes - Added `skill?: string[]` to the `Hooks` interface in `@opencode-ai/plugin` - Created `SkillRegistry` to track skill paths from plugins - Modified `Skill.state()` to load skills from the registry with proper precedence: 1. Global `~/.config/opencode/skill/` (lowest priority) 2. Plugin skills 3. Project `.claude/skills/` 4. Project `.opencode/skill/` (highest priority) - Added tests for plugin skill loading - Updated documentation ## Related Issues - Closes #6013 - Add Skill Configuration to Config Type - Addresses #6347 - Plugin Hook for Registering Additional Config Directories - Provides simpler alternative to #8386 - Skill Registry proposal ## Why this approach? As discussed in the issues, instead of creating a separate Skill Registry system or directory hooks, this leverages the existing plugin mechanism. Benefits: - **No new infrastructure** - npm remains the distribution mechanism - **Consistent model** - plugins can now bundle skills + tools + hooks together - **Simple API** - just an array of relative paths with glob support ## Testing ```bash bun test packages/opencode/test/skill/plugin-skill.test.ts ``` All 10 skill tests pass (6 existing + 4 new).
yindo added the pull-request label 2026-02-16 18:17:50 -05:00
yindo closed this issue 2026-02-16 18:17:50 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12949