MCPInstall

univer-plugin-dev

Develop custom plugins for Univer (spreadsheet/document/presentation engine). Use when writing a plugin, registering commands/mutations/operations, extending Facade API classes (FUniver, FWorkbook, FWorksheet, FRange), adding toolbar buttons or context menus, binding shortcuts, or listening to workbook/sheet/cell events. Triggers include 'write a plugin', 'custom command', 'extend FRange', 'toolbar button', 'shortcut', 'menu item', 'Facade extension', or any plugin development error.

Installs
230
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/dream-num/univer-sdk-skills --skill univer-plugin-dev
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads univer-plugin-dev automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Univer Plugin Development

Guide for building custom plugins that extend Univer's functionality.

Compatibility: This skill is written for Univer v0.21.x. Core plugin patterns (lifecycle, DI, commands) remain stable, but specific service tokens and facade classes may shift. Prefer the user's existing codebase patterns when they differ from examples here.

Quick Start

Scaffold a new plugin

Use the bundled script to generate a minimal plugin skeleton:

# If installed to ~/.codex/skills/
npx tsx ~/.codex/skills/univer-plugin-dev/scripts/scaffold-plugin.ts my-plugin --path ./src/plugins

# Or from this repo directly
npx tsx ~/univer-sdk-skills/skills/univer-plugin-dev/scripts/scaffold-plugin.ts my-plugin --path ./src/plugins

This creates:

my-plugin/
├── src/
│   ├── index.ts
│   ├── plugin.ts
│   ├── commands/
│   │   └── commands.my-command.ts
│   ├── controllers/
│   │   └── my-menu.controller.ts
│   └── facade/
│       └── f-univer.ts
├── package.json
└── tsconfig.json

Register the plugin in your app

import { MyPlugin } from './plugins/my-plugin/src';
import './plugins/my-plugin/src/facade/f-univer'; // side-effect import for Facade extension

univer.registerPlugin(MyPlugin);

Core Concepts

Plugin Lifecycle

Plugins inherit from Plugin and override lifecycle hooks:

HookWhenWhat to do
onStarting()Plugin mounted, no unit yetRegister commands, services, menus, shortcuts
onReady()Business unit createdAccess workbook/doc instance
onRendered()UI renderedDOM-dependent initialization
onSteady()Everything stableBackground tasks

Always use disposeWithMe() to register disposable resources so they auto-cleanup when the plugin is destroyed.

Command System

Three command types:

  • COMMAND — Business entry point. Orchestrates mutations and operations. Supports undo/redo if you manually push to IUndoRedoService.
  • MUTATION — Atomic data change. Persisted to snapshot. Automatically undoable.
  • OPERATION — UI state change. Not persisted. Not undoable.

See references/command-system.md for full examples of each type and undo/redo construction.

Dependency Injection

Univer uses a custom DI container (Injector). Services are retrieved by:

// Constructor injection
@Inject(IMenuManagerService) private readonly _menuService: IMenuManagerService

// Accessor injection (in command handlers)
const service = accessor.get(IMenuManagerService);

Common service tokens:

  • ICommandService — register/execute commands
  • IMenuManagerService — add menus/toolbar items
  • IShortcutService — register keyboard shortcuts
  • IContextMenuService — context menus
  • ComponentManager — register React components/icons
  • IUniverInstanceService — get current workbook/doc/slide
  • IUndoRedoService — push undo/redo entries

Facade Extension

Extend Facade classes to expose plugin capabilities to end users:

import { FWorksheet } from '@univerjs/sheets/facade';

class FWorksheetMyMixin extends FWorksheet {
  myMethod(): this {
    // implementation
    return this;
  }
}

FWorksheet.extend(FWorksheetMyMixin);

declare module '@univerjs/sheets/facade' {
  interface FWorksheet extends FWorksheetMyMixin {}
}

Common Tasks

For full examples (submenus, context menus, Range Popup, component replacement, complete toolbar+command+shortcut pipeline), see references/ui-customization.md.

Add a Toolbar Button

this._menuManagerService.mergeMenu({
  [RibbonOthersGroup.OTHERS]: {
    ['my-button']: {
      order: 10,
      menuItemFactory: () => ({
        id: 'my-button',
        title: 'My Button',
        type: MenuItemType.BUTTON,
      }),
    },
  },
});

Register a Command

const MyCommand: ICommand = {
  id: 'my.command.id',
  type: CommandType.COMMAND,
  handler: (accessor) => {
    // business logic
    return true;
  },
};

this._commandService.registerCommand(MyCommand);

Extend Facade

class FWorksheetMyMixin extends FWorksheet {
  myMethod(): this { return this; }
}
FWorksheet.extend(FWorksheetMyMixin);
declare module '@univerjs/sheets/facade' {
  interface FWorksheet extends FWorksheetMyMixin {}
}

References

  • Plugin architecture: references/plugin-architecture.md — lifecycle, DI, service registration, controller pattern
  • Command system: references/command-system.md — COMMAND / MUTATION / OPERATION, undo/redo, mutation factories, custom mutations
  • Facade extension: references/facade-extension.md — extend FUniver, FWorkbook, FWorksheet, FRange, multiple extensions merge strategy
  • UI customization: references/ui-customization.md — menus, submenus, shortcuts, context menus, popups, component replacement
  • Event system: references/event-system.md — events, hooks, custom events, RxJS streams

Also see univer-integrate skill for:

  • Custom formula functions (univer-integrate skill)
  • Permissions (univer-integrate skill)
  • Network layer (univer-integrate skill)

Scripts

  • Scaffold: scripts/scaffold-plugin.ts — generate a new plugin skeleton

FAQ

What does the univer-plugin-dev skill do?

Develop custom plugins for Univer (spreadsheet/document/presentation engine). Use when writing a plugin, registering commands/mutations/operations, extending Facade API classes (FUniver, FWorkbook, FWorksheet, FRange), adding toolbar buttons or context menus, binding shortcuts, or listening to workbook/sheet/cell events. Triggers include 'write a plugin', 'custom command', 'extend FRange', 'toolbar button', 'shortcut', 'menu item', 'Facade extension', or any plugin development error.

How do I install univer-plugin-dev?

Run npx skills add https://github.com/dream-num/univer-sdk-skills --skill univer-plugin-dev in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/univer-plugin-dev/ (personal) or .claude/skills/univer-plugin-dev/ (project).

Which AI agents can use univer-plugin-dev?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is univer-plugin-dev safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains univer-plugin-dev?

It is published by dream-num in dream-num/univer-sdk-skills. It has 230 recorded installs.

More from dream-num/univer-sdk-skills

View all →

univer-node-backend

dream-num/univer-sdk-skills

Open the skill to read its SKILL.md instructions.

Backend & APIs198 installs

univer-pro-integrate

dream-num/univer-sdk-skills

Open the skill to read its SKILL.md instructions.

173 installs

Popular docs & writing skills

View category →

grill-with-docs

mattpocock/skills

A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.

Docs & Writing1.2M installs

lark-markdown

open.feishu.cn

飞书 Markdown:查看、创建、上传、编辑和比较飞书中的原生 Markdown 文件。当用户要操作飞书 Markdown 文件,或比较其远端版本及本地草稿时使用。纯本地 Markdown 文件操作不触发本 skill。不负责将 Markdown 导入为飞书在线文档,也不负责文件搜索、权限、评论、移动、删除等云空间管理操作。

Docs & Writing778.7K installs

writing-beats

mattpocock/skills

Writing, exploit; assemble raw material into a journey of beats, grounding each term before a beat leans on it.

Docs & Writing490.7K installs

writing-shape

mattpocock/skills

Writing, exploit: shape raw material into an article, paragraph by paragraph.

Docs & Writing490.2K installs

writing-fragments

mattpocock/skills

Writing, explore: mine raw fragments, no structure yet.

Docs & Writing489.6K installs

writing-for-agents

mattpocock/skills

Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.

Docs & Writing479.3K installs