A test plugin demonstrating OpenCode's native bundled extensions support for commands, skills, agents, and MCP servers.
| Agent | Description |
|---|---|
reviewer |
Expert code reviewer for analyzing code quality and issues |
documenter |
Documentation specialist for writing clear docs |
| Command | Description |
|---|---|
/analyze |
Analyze code for issues and improvements |
/explain |
Explain code or concepts in detail |
/test-gen |
Generate tests for code or functionality |
| Skill | Description |
|---|---|
git-workflow |
Git workflow best practices |
debugging |
Systematic debugging techniques |
| Server | Description |
|---|---|
context7 |
Library documentation via Context7 |
- Clone and build:
cd ~/Work/opencode-plugin
npm install
npm run build- Add to your
.opencode/config.json:
{
"plugin": ["file:///home/ryan/Work/opencode-plugin/dist/index.js"]
}{
"plugin": ["opencode-plugin-test@latest"]
}src/
agents/ # Agent definitions
reviewer.ts
documenter.ts
index.ts
commands/ # Command definitions
analyze.ts
explain.ts
test-gen.ts
index.ts
skills/ # Skill definitions
git-workflow.ts
debugging.ts
index.ts
mcp/ # MCP server configs
index.ts
index.ts # Main plugin entry
This plugin uses OpenCode's native extension bundling:
import type { Plugin } from "@opencode-ai/plugin";
import { reviewer, documenter } from "./agents";
import { analyze, explain, testGen } from "./commands";
import { gitWorkflow, debugging } from "./skills";
import { builtinMcps } from "./mcp";
export const TestPlugin: Plugin = async (ctx) => {
return {
// Native agent registration
agent: {
reviewer,
documenter,
},
// Native command registration
command: {
analyze,
explain,
"test-gen": testGen,
},
// Native skill registration
skill: {
"git-workflow": gitWorkflow,
debugging,
},
// MCP via config hook
config: async (config) => {
config.mcp = config.mcp || {};
for (const [name, mcp] of Object.entries(builtinMcps)) {
if (!config.mcp[name]) {
config.mcp[name] = mcp;
}
}
},
};
};Extensions are loaded in order (later wins):
- Built-in
- Plugin-provided (this plugin)
- Config-based (
~/.config/opencode/) - File-based (
.opencode/command/*.md, etc.)
Users can override any plugin-provided extension by creating a file-based version.
MIT