opencode-plugin-development

Develop OpenCode plugins that hook events and intercept tool execution.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/mpsuesser/workspace --skill opencode-plugin-development-mpsuesser
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: opencode-plugin-development
Source: https://github.com/mpsuesser/workspace/tree/main/dotconfig/opencode/skills/opencode-plugin-development
Command: npx skills add https://github.com/mpsuesser/workspace --skill opencode-plugin-development-mpsuesser

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you quickly design and debug OpenCode plugins by turning the plugin API into practical, reliable patterns for real event and tool workflows.

Core Features & Use Cases

  • End-to-end Hooking Guide: Covers how to implement event-driven behavior (chat, tool execution, commands, permissions, config) and how to reason about execution order.
  • Tool & Schema Mastery: Shows how to register custom tools, define schemas (including Zod-based parameter builders), and shape tool I/O, titles, and metadata.
  • Runtime Control & Session Orchestration: Explains how to mutate LLM request parameters/headers, inject context safely across turns and compaction, and manage subagent/child-session lifecycles, including TUI automation.

Quick Start

Use the opencode-plugin-development Skill to ask OpenCode to intercept tool calls, inject session-specific context, register a custom tool with a strict schema, and ensure the behavior survives session compaction while updating the TUI with progress notifications.

Frequently Asked Questions about opencode-plugin-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I intercept tool execution and mutate runtime behavior in OpenCode plugins?

OpenCode plugin development intercepts tool execution by returning async hook functions that mutate hook input/output payloads. You register these hooks with correct YAML frontmatter naming, allowing your plugin to alter runtime behavior, inject context, and manage session-aware automation across tool workflows.

What is the execution order for OpenCode event hooks during chat and tool workflows?

OpenCode event hooks follow a specified execution order for chat, tool execution, commands, permissions, and config events. Understanding this sequence is critical for reasoning about runtime behavior, ensuring your plugin intercepts and mutates events at the correct lifecycle stage without conflicts.

How do I register a custom tool with a strict schema in TypeScript for OpenCode?

To register a custom tool in OpenCode, you define schemas using Zod-based parameter builders and shape the tool input/output, titles, and metadata. This TypeScript approach ensures strict parameter validation and reliable tool execution within your plugin architecture.

Does OpenCode plugin development support managing subagent and child-session lifecycles?

OpenCode plugin development supports managing subagent and child-session lifecycles, including TUI automation. You can orchestrate child sessions, inject context safely across turns and compaction, and automate the TUI lifecycle with progress notifications during runtime.

Why does my OpenCode plugin context disappear after session compaction?

Context disappears after session compaction if your plugin does not correctly inject context safely across turns and compaction. Proper OpenCode plugin development requires adhering to specified hook input/output mutation rules to ensure injected context survives compaction events.

Can I mutate LLM request parameters and headers using OpenCode hooks?

Yes, OpenCode hooks allow you to mutate LLM request parameters and headers directly. By leveraging the plugin API's event-driven behavior, your plugin can intercept requests and alter runtime parameters, enabling session-aware automation and custom agent configurations.