Create Plugin
Create an OpenCode plugin for OmniRush.ai.
Install
npx skills add omnirush-ai/omnirush-gui --skill create-plugin -g -a claude-code -y- Repository
- omnirush-ai/omnirush-gui4.6k
- Category
- Writing
- Updated
- 6d ago
- License
- See repository
- Context cost
- Lightabout 1,226 tokens
- Runs scripts
- No, instructions only
What it does
Create an OpenCode plugin for OmniRush.ai. Scaffolds the plugin file with the correct API shape, tool definitions, and hook registration. Use when the user asks to 'create a plugin', 'write a plugin', or 'make a plugin that does X'.
Skill: Create an OpenCode Plugin
Scaffold a working OpenCode plugin for use in OmniRush.ai.
When to use
- User asks "create a plugin that does X"
- User asks "write a plugin" or "make a plugin"
- User wants to extend OmniRush.ai/OpenCode with custom tools
Plugin API
An OpenCode plugin is an async factory function that returns a hooks object.
File location
Plugins can live in:
- Project:
.opencode/plugins/my-plugin.ts(auto-discovered) - Global:
~/.config/opencode/plugins/my-plugin.ts - npm: published as a package, referenced in
opencode.jsonpluginarray - URL:
file:orhttps:path in thepluginarray
Minimal shape
import { z } from "zod";
export default async () => ({
tool: {
my_tool_name: {
description: "What this tool does.",
args: z.object({
input: z.string().describe("The input parameter."),
}).shape, // NOTE: .shape, not the ZodObject itself
async execute(args: { input: string }) {
// Your logic here. Can use fetch(), fs, child_process, etc.
return `Result: ${args.input}`;
},
},
},
});
Key rules
- Export default an async function that returns the hooks object.
- Tool args use
zodSchema.shape(aZodRawShape), not theZodObject. executereturns astringor{ output: string; metadata?: Record<string, unknown> }.- Tools are declared, not registered imperatively, return them in the hooks object.
fetch()works, plugins run in-process inside the OpenCode runtime.process.envis accessible, use env vars for secrets/config.
Available hooks
{
// Modify the system prompt
"experimental.chat.system.transform": async (input, output: { system: string[] }) => {
output.system.push("Extra instruction for the agent.");
},
// Define tools the agent can call
tool: {
tool_name: { description, args, execute },
},
