opencode-plugins
Skill5 starsChanged yesterdayMITView on GitHub
Build OpenCode plugins and terminal UI extensions without MCP: v1 hook plugins (@opencode-ai/plugin, config key plugin), v2 Plugin.define server plugins (@opencode/plugin, config key plugins), v2 TUI/CLI plugins (@opencode/plugin/tui, dialogs, keymap, routes, toasts), discovery paths, the V1 to V2 migration, and npm distribution. Use when the user wants an OpenCode plugin, mod, TUI customization, or asks whether OpenCode has a UI extension mechanism.
- Reads credentials
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 0 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 47
Default export from Plugin.define.
- Very specific: line 50
No Bun $ shell helper; v2 removed it.
- Very specific: line 61
Write .opencode/plugins/<name>/index.ts (or tui.ts).
- Very specific: line 69
Do not bind ctrl+n or ctrl+p in dialogs.
- Very specific: line 70
Keep keymap.layer factories pure.
- Very specific: line 71
Do not npm publish or open an upstream PR without the user's explicit go-ahead this turn.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
OpenCode plugins and TUI extensions
Not a desktop mod target. OpenCode's docs say plugins change behavior, and "to change the terminal UI, build a CLI plugin" (opencode.ai/v2/docs/build/plugins). No documented plugin API changes the UI of the OpenCode desktop app or web UI. Do not treat this skill as the OpenCode equivalent of Claude Desktop mods; it covers server plugins (hooks, tools) and TUI plugins only. Both need no MCP. Re-check the docs for a desktop UI extension API before stating otherwise.
First: which generation?
| v1 | v2 | |
| Docs | opencode.ai/docs/plugins/ | opencode.ai/v2/docs/build/plugins |
| Package | @opencode-ai/plugin | @opencode/plugin (TUI: @opencode/plugin/tui) |
| Shape | export const X: Plugin = async (ctx) => hooks | export default Plugin.define({ id, async setup(ctx) { return cleanup } }) |
| Config key | plugin | plugins |
V1 implementations do not run in V2. Ask or check the user's version, then follow one generation only. Details: references/v1-hooks.md, references/v2-server.md, references/v2-tui.md, references/migrate-and-publish.md.
Requirements (v2)
- A stable
idon every plugin. Storage is scoped by it. - Default export from
Plugin.define. - Return a cleanup function from
setupinstead of adisposehook. - Published plugins depend on a compatible
@opencode/pluginrange. - No Bun
$shell helper; v2 removed it.
Where plugins load
- Local server plugins:
.opencode/plugins/<name>/index.ts(v2 also reads.opencode/plugin/); v1 also reads~/.config/opencode/plugins/. - TUI plugins:
<global-config>/plugins/<name>/{index.ts,tui.ts}and<project>/.opencode/plugins/<name>/. - Config:
opencode.json(c)for server plugins,cli.jsonfor TUI plugins. Entries are a package name (optionally@version), a path, afile://URL, or{ package, options }. A-idor-wildcardprefix disables a TUI plugin. The docs do not give the globalcli.jsonpath; do not assert one.
Workflow
- Pick the generation and the surface (server or TUI).
- Write
.opencode/plugins/<name>/index.ts(ortui.ts). - Restart OpenCode and exercise the feature.
- For distribution, publish an npm package and list it in the user's config by name.
Safety
- Plugins run with the user's privileges. Never read or log environment secrets; do not forward prompts, tool inputs or files to remote servers without disclosure.
shell.envandpermissionhooks can change what the agent may do. Keep them narrow and explainable.- Do not bind
ctrl+norctrl+pin dialogs; they are reserved for navigation. - Keep
keymap.layerfactories pure. - Do not
npm publishor open an upstream PR without the user's explicit go-ahead this turn.
Checklist
- Generation confirmed; config key matches (
pluginvsplugins). - Stable
id; cleanup returned; every subscription unsubscribed. - Dependency range on
@opencode/plugin(v2) or@opencode-ai/plugin(v1). - Tested in a project-local
.opencode/plugins/before publishing.
Anti-patterns
- Copying a V1 example into a V2 project.
- Building an MCP server to add a keybinding or dialog.
- Importing the plugin SDK by absolute path (TUI imports resolve at runtime).
- Leaving listeners registered without returning cleanup.
Pointers
| Need | Where |
| V1 hooks, events, custom tools | references/v1-hooks.md |
V2 server ctx API | references/v2-server.md |
| V2 TUI context, dialogs, keymap, routes | references/v2-tui.md |
| Migration table and publishing | references/migrate-and-publish.md |
In this repository30 other files it gives its agents.
- docs/agents.mdAGENTS.md
- website/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/claude-desktop-skills.mdcCursor rule
- .cursor/rules/claude-mod.mdcCursor rule
- .cursor/rules/codex-desktop-skills.mdcCursor rule
- .cursor/rules/desktop-and-publishing-skills.mdcCursor rule
- .cursor/rules/release.mdcCursor rule
- claude-code-mods-guideSkill
- claude-desktop-extensionsSkill
- claude-desktop-modsSkill
- claude-desktop-pluginsSkill
- codex-desktop-extensionsSkill
- codex-desktop-pluginsSkill
- codex-desktop-skillsSkill
- copilot-desktop-extensionsSkill
- cursor-extensions-and-pluginsSkill
- opencode-pluginsSkill
- publishing-mental-to-storesSkill
- claude-code-mods-guideSkill
- claude-desktop-extensionsSkill
- claude-desktop-modsSkill
- claude-desktop-pluginsSkill
- codex-desktop-extensionsSkill
- codex-desktop-pluginsSkill
- codex-desktop-skillsSkill
- copilot-desktop-extensionsSkill
- cursor-extensions-and-pluginsSkill
- publishing-mental-to-storesSkill
- mental-setupSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

