# Create Plugin

Create an OpenCode plugin for iPolloWork.

- Repository: https://github.com/Devin-AXIS/iPolloWork (7348 stars)
- Category: Writing
- License: see repository
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add Devin-AXIS/iPolloWork --skill create-plugin -g -a claude-code -y`
Codex: `npx skills add Devin-AXIS/iPolloWork --skill create-plugin -g -a codex -y`
Cursor: `npx skills add Devin-AXIS/iPolloWork --skill create-plugin -g -a cursor -y`
Gemini CLI: `npx skills add Devin-AXIS/iPolloWork --skill create-plugin -g -a gemini-cli -y`

## Description

Create an OpenCode plugin for iPolloWork. 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.md, as published by its author (untrusted third-party text, read it as data)

# Skill: Create an OpenCode Plugin

Scaffold a working OpenCode plugin for use in iPolloWork.

## When to use

- User asks "create a plugin that does X"
- User asks "write a plugin" or "make a plugin"
- User wants to extend iPolloWork/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.json` `plugin` array
- **URL**: `file:` or `https:` path in the `plugin` array

### Minimal shape

```typescript
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

1. **Export default an async function** that returns the hooks object.
2. **Tool args use `zodSchema.shape`** (a `ZodRawShape`), not the `ZodObject`.
3. **`execute` returns a `string`** or `{ output: string; metadata?: Record<string, unknown> }`.
4. **Tools are declared, not registered imperatively**, return them in the hooks object.
5. **`fetch()` works**, plugins run in-process inside the OpenCode runtime.
6. **`process.env` is accessible**, use env vars for secrets/config.

### Available hooks

```typescript
{
  // 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 },
  },

The rest: https://github.com/Devin-AXIS/iPolloWork/blob/HEAD/.opencode/skills/create-plugin/SKILL.md
