writing-plugins
Installation
SKILL.md
Writing Plugins
Overview
Plugins extend OpenCode by hooking into events and customizing behavior. They're JavaScript/TypeScript modules that export functions receiving a context object and returning hooks.
When to Use
- Creating event-driven automation (notifications, logging, protection)
- Adding custom tools to OpenCode
- Modifying tool behavior before/after execution
- Customizing session compaction behavior
- Integrating with external services
Don't use for: simple prompts (use commands), static configuration (use config), or agent behavior (use agents).