How do plugins work and differ from skills?

dev
19fe3e2mark subagent sessions as agent initiated to ensure they dont count against quota (got the ok from copilot team)
This post might have stale content, as dev is 1256 commits ahead.

how do plugins work? what's the diff between plugins and skils?

Avatar of anthropic/claude-opus-4.5
Claude Opus 4.5
commented

Now I have enough context. Here's a comprehensive answer:


##Plugins vs Skills: Key Differences

Plugins and Skills serve fundamentally different purposes in OpenCode:

###Skills = Reusable Instructions for the AI

Skills are markdown files (SKILL.md) that provide the AI with specialized knowledge and step-by-step guidance for specific tasks. They're essentially "prompt templates" or "instruction sets."

How they work:

  • Defined as markdown files with YAML frontmatter in specific directories
  • Discovered automatically at startup from:
    • .opencode/skills/<name>/SKILL.md (project)
    • ~/.config/opencode/skills/<name>/SKILL.md (global)
    • .claude/skills/<name>/SKILL.md (Claude-compatible)
  • The AI can load them on-demand via the built-in skill tool
  • Skills are listed to the AI, which decides when to use them based on the task

Example: A git-release skill might contain instructions on how to draft release notes and version bumps.

From packages/opencode/src/skill/skill.ts:

export const Info = z.object({
  name: z.string(),
  description: z.string(),
  location: z.string(),
})

###Plugins = Code Extensions That Hook Into OpenCode

Plugins are JavaScript/TypeScript modules that extend OpenCode's core functionality by hooking into various lifecycle events.

How they work:

  • Can be loaded from:
    • Local files in .opencode/plugins/ or ~/.config/opencode/plugins/
    • npm packages specified in opencode.json
  • Plugins export functions that return hooks - callbacks for various events
  • They can modify behavior, add authentication methods, transform messages, etc.

Available hooks (from packages/plugin/src/index.ts):

HookPurpose
authAdd custom authentication providers (OAuth, API keys)
toolAdd custom tools the AI can use
eventReact to any event in the system
configModify configuration at load time
chat.messageProcess incoming messages
chat.paramsModify LLM parameters (temperature, etc.)
chat.headersAdd custom headers to API requests
permission.askCustomize permission prompts
tool.execute.before/afterIntercept tool execution

Example: The CodexAuthPlugin adds OAuth authentication for OpenAI's Codex API.


###TL;DR Comparison

AspectSkillsPlugins
FormatMarkdown filesJS/TS code
PurposeInstructions for the AIExtend OpenCode itself
When usedAI loads them during conversationRun at startup, hook into events
Who uses themThe AI agentOpenCode's runtime
CapabilitiesProvide knowledge/guidanceAdd tools, auth, modify behavior
ComplexitySimple (just markdown)More complex (code with hooks)

Skills = "Hey AI, here's how to do X"
Plugins = "Hey OpenCode, let me add/change functionality"


END OF POST

How do plugins work and differ from skills? — anomalyco/opencode