opencode-plugin-developmentlisted
Install: claude install-skill gdm257/cc-plugins
# OpenCode Plugin Development Guide
Create plugins to extend OpenCode's functionality by hooking into events, adding custom tools, and modifying behavior.
## Overview
OpenCode plugins are JavaScript/TypeScript modules that export a plugin function. The function receives a context object and returns a hooks object defining event hooks and custom tools.
## Plugin Types
OpenCode supports two plugin installation methods:
### Config Plugin Field (Recommended)
Define plugins in your `opencode.json` `plugin` array:
```json
{
"plugin": ["my-plugin@1.0.0", "@scope/enterprise-plugin"]
}
```
**Characteristics:**
- Plugins are npm packages installed via **Bun**
- Dependencies declared in `package.json` are **automatically installed**
- Published to npm registry for distribution
- Version management via npm versioning
- Suitable for: distributable plugins, plugins with external dependencies
### Local Plugin Directory
Place plugin files directly in `.opencode/plugins/`:
```
.opencode/plugins/
└── my-plugin.ts
```
**Characteristics:**
- Local files loaded via `file://` URLs
- **No dependency installation** - all dependencies must be pre-installed
- Quick iteration for development
- Suitable for: private plugins, prototypes, plugins without external dependencies
**Comparison:**
| Feature | Config `plugin` Field | Local `.opencode/plugins/` |
| ----------------------- | --------------------- | -------------------------- |
| Dependency Installation | ✅ Automa