writing-opencode-plugins

Guide OpenCode plugin development with TypeScript, Bun, and npm publishing workflows.

1|Updated Nov 26, 2014
One-click install
npx skills add https://github.com/tianhuil/dotfiles --skill writing-opencode-plugins
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: writing-opencode-plugins
Source: https://github.com/tianhuil/dotfiles/tree/main/home/.config/opencode/skills/opencode-plugin-writing
Command: npx skills add https://github.com/tianhuil/dotfiles --skill writing-opencode-plugins

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guides developers through the full lifecycle of OpenCode plugin creation, resolving common ambiguity around project layout, testing practices, and publishing workflows.

Core Features & Use Cases

  • Shim-based development vs runtime loading to keep plugin code isolated
  • Clear plugin project skeleton (src/, .opencode/, test/, and root package.json)
  • Established testing patterns with unit and integration tests (Bun)
  • Publishing guidance to distribute plugins via npm and OpenCode tooling
  • Best practices for packaging, configuration, and maintainability

Quick Start

Create a new plugin directory following the shown structure and implement your plugin using the shim pattern.

Frequently Asked Questions about writing-opencode-plugins

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

FAQPage Schema
How do I structure an OpenCode plugin project for development and publishing?

An OpenCode plugin project requires a structured layout: a src/ directory for code, a .opencode/ folder for configuration, a test/ directory, and a root package.json to manage dependencies and packaging.

How do I test OpenCode plugins using Bun?

You test OpenCode plugins using Bun by following established unit and integration testing conventions provided in the guide to ensure your plugin code functions correctly before publishing.

What is the shim pattern in OpenCode plugin development?

The shim pattern is a development approach that uses shim-based loading to keep plugin code isolated during runtime, ensuring maintainability and preventing conflicts within the OpenCode environment.

Can I publish OpenCode plugins to npm using TypeScript?

Yes, you can publish OpenCode plugins to npm using TypeScript with Bun by following specific packaging configurations and publishing workflows designed for distributing plugins via npm and OpenCode tooling.

What are the best practices for maintaining OpenCode plugin configurations?

Best practices for maintaining OpenCode plugins involve enforcing a structured project layout, utilizing shim-based loading, adhering to unit and integration testing conventions, and applying proper packaging configurations in TypeScript.

Do I need Bun to develop and package OpenCode plugins?

Using Bun is the established convention in this OpenCode plugin guide for running unit and integration tests and managing TypeScript packaging configurations throughout the development lifecycle.