Token导航 LogoToken导航TokenDH.com
前端设计执行命令github未标认证来源可访问clear审计通过

create-opencode-plugincreate opencode plugin 前端

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

3,941

周安装

161

GitHub Stars

110

下载量

1,262
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:create-opencode-plugin(create opencode plugin 前端)
来源仓库:https://github.com/igorwarzocha/opencode-workflows
仓库路径:skills/create-opencode-plugin
安装命令:
npx skills add https://github.com/igorwarzocha/opencode-workflows --skill create-opencode-plugin
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/igorwarzocha/opencode-workflows --skill create-opencode-plugin

简介

创建 OpenCode 插件的标准开发流程,包含 SDK 验证、UI 反馈和测试部署环节。

  • 需参照最新 API 参考文档生成插件骨架,确保 hooks 和 tool helper 兼容当前版本。
  • 支持自定义工具和 toast 通知集成,提供完整的插件生命周期管理能力。
  • 使用前必须重新生成 SDK 参考文档,防止因接口变更导致插件功能异常。
  • create-opencode-plugin 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Creating OpenCode Plugins

Procedure Overview

StepActionRead
1Verify SDK referenceRun extract script
2Validate feasibilityThis file
3Design pluginreferences/hooks.md, references/hook-patterns.md, references/CODING-TS.MD
4Implementreferences/tool-helper.md (if custom tools)
5Add UI feedbackreferences/toast-notifications.md, references/ui-feedback.md (if needed)
6Testreferences/testing.md
7Publishreferences/publishing.md, references/update-notifications.md (if npm)

Step 1: Verify SDK Reference (REQUIRED)

Before creating any plugin, MUST regenerate the API reference to ensure accuracy:

bun run .opencode/skill/create-opencode-plugin/scripts/extract-plugin-api.ts

This generates:

  • references/hooks.md - All available hooks and signatures
  • references/events.md - All event types and properties
  • references/tool-helper.md - Tool creation patterns

Step 2: Validate Feasibility (REQUIRED)

MUST determine if the user's concept is achievable with available hooks.

Feasible as plugins:

  • Intercepting/blocking tool calls
  • Reacting to events (file edits, session completion, etc.)
  • Adding custom tools for the LLM
  • Modifying LLM parameters (temperature, etc.)
  • Custom auth flows for providers
  • Customizing session compaction
  • Displaying status messages (toasts, inline)

NOT feasible (inform user):

  • Modifying TUI rendering or layout
  • Adding new built-in tools (requires OC source)
  • Changing core agent behavior/prompts
  • Intercepting assistant responses mid-stream
  • Adding new keybinds or commands
  • Modifying internal file read/write
  • Adding new permission types

If not feasible, MUST inform user clearly. Suggest:

  • OC core changes: contribute to packages/opencode
  • MCP tools: use MCP server configuration
  • Simple automation: use shell scripts

Step 3: Design Plugin

READ: references/hooks.md for available hooks, references/hook-patterns.md for implementation patterns.

READ: references/CODING-TS.MD for code architecture principles. MUST follow these design guidelines:

  • Modular structure: Split complex plugins into multiple focused files (types, utilities, hooks, tools)
  • Single purpose: Each function does ONE thing well
  • DRY: Extract common patterns into shared utilities immediately
  • Small files: Keep individual files under 150 lines - split into smaller modules as needed
  • No monoliths: MUST NOT put all plugin code in a single index.ts file

Plugin Locations

ScopePathUse Case
Project.opencode/plugin/<name>/index.tsTeam-shared, repo-specific
Global~/.config/opencode/plugin/<name>/index.tsPersonal, all projects

Basic Structure

import type { Plugin } from "@opencode-ai/plugin"

export const MyPlugin: Plugin = async ({ project, client, $, directory, worktree }) => {
  // Setup code runs once on load

  return {
    // Hook implementations - see references/hook-patterns.md
  }
}

Context Parameters

ParameterTypeDescription
projectProjectCurrent project info (id, worktree, name)
clientSDK ClientOpenCode API client
$BunShellBun shell for commands
directorystringCurrent working directory
worktreestringGit worktree path

Step 4: Implement

READ: references/hook-patterns.md for hook implementation examples.

READ: references/tool-helper.md if adding custom tools (Zod schemas).

READ: references/events.md if using event hook (event types/properties).

READ: references/examples.md for complete plugin examples.

ALWAYS READ: references/CODING-TS.MD and follow modular design principles.

Plugin Structure (Non-Monolithic)

For complex plugins, MUST use a modular directory structure:

.opencode/plugin/my-plugin/
├── index.ts          # Entry point, exports Plugin
├── types.ts          # TypeScript types/interfaces
├── utils.ts          # Shared utilities
├── hooks/            # Hook implementations
│   ├── event.ts
│   └── tool-execute.ts
└── tools/            # Custom tool definitions
    └── my-tool.ts

Example modular index.ts:

import type { Plugin } from "@opencode-ai/plugin"
import { eventHooks } from "./hooks/event"
import { toolHooks } from "./hooks/tool-execute"
import { customTools } from "./tools"

export const MyPlugin: Plugin = async ({ project, client }) => {
  return {
    ...eventHooks({ client }),
    ...toolHooks({ client }),
    tool: customTools,
  }
}

Keep each file under 150 lines. Split as complexity grows.

Common Mistakes

MistakeFix
Using client.registerTool()Use tool: {name: tool({...})}
Wrong event property namesCheck references/events.md
Sync event handlerMUST use async
Not throwing to blockthrow new Error() in tool.execute.before
Forgetting TypeScript typesimport type {Plugin} from "@opencode-ai/plugin"

Step 5: Add UI Feedback (Optional)

Only if plugin needs user-visible notifications:

READ: references/toast-notifications.md for transient alerts (brief popups)

READ: references/ui-feedback.md for persistent inline status messages

Choose based on:

NeedUse
Brief alerts, warningsToast
Detailed stats, multi-lineInline message
Config validation errorsToast
Session completion noticeToast or inline

Step 6: Test

READ: references/testing.md for full testing procedure.

Quick Test Steps

  1. Create test folder with opencode.json: {"plugin": ["file:///path/to/your/plugin/index.ts"],}
  2. Verify plugin loads: cd /path/to/test-folder opencode run hi
  3. Test interactively: opencode
  4. SHOULD recommend specific tests based on hook type used.

Step 7: Publish (Optional)

READ: references/publishing.md for npm publishing.

READ: references/update-notifications.md for version update toasts (for users with pinned versions).

<reference_summary>

Reference Files Summary

FilePurposeWhen to Read
hooks.mdHook signatures (auto-generated)Step 3-4
events.mdEvent types (auto-generated)Step 4 (if using events)
tool-helper.mdZod tool schemas (auto-generated)Step 4 (if custom tools)
hook-patterns.mdHook implementation examplesStep 3-4
CODING-TS.MDCode architecture principlesStep 3 (Design)
examples.mdComplete plugin examplesStep 4
toast-notifications.mdToast popup APIStep 5 (if toasts needed)
ui-feedback.mdInline message APIStep 5 (if inline needed)
testing.mdTesting procedureStep 6
publishing.mdnpm publishingStep 7
update-notifications.mdVersion toast patternStep 7 (for npm plugins)

</reference_summary>

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenCode

29.44%
按下载量换算372

Claude Code

22.51%
按下载量换算284

Codex

18.84%
按下载量换算238

Gemini CLI

12.22%
按下载量换算154

Antigravity

8.17%
按下载量换算103

windsurf

3.66%
按下载量换算46

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/igorwarzocha/opencode-workflows --skill create-opencode-plugin;npx skills add igorwarzocha/opencode-workflows --skill "create-opencode-plugin" 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills