Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

univer-plugin-dev

БесплатноЗапускает вложенные скриптыНе проверен

Develop custom plugins for Univer sheets, docs, slides, bases, boards, and PDFs. Use when implementing a Plugin lifecycle, dependency injection…

dream-numот dream-num★ 83 звезды на GitHub

Об этом скилле

Univer Plugin Development

Build plugins against the APIs exported by the target application's installed Univer packages.

Compatibility: The checked source baseline is Univer and Univer Pro 1.0.0-beta.0. Keep release-train packages such as @univerjs/core, @univerjs/sheets, @univerjs/ui, and @univerjs-pro/* on that same exact version. Independently versioned packages such as @univerjs/icons must follow the target manifest instead. If the target project differs, inspect its manifests and source exports before copying an example.

Scaffold a Sheet UI plugin

Run the bundled generator:

npx tsx <skills-repo>/skills/univer-plugin-dev/scripts/scaffold-plugin.ts my-plugin --path ./packages

It creates a buildable Sheet UI plugin package. For docs, slides, bases, boards, or PDFs, first choose the product type and official core/UI plugin family in plugin-architecture.md, then adapt the generated dependencies and UniverInstanceType.

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

Register the plugin and explicitly load its Facade extension:

import { UniverMyPlugin } from './packages/my-plugin/src';
import './packages/my-plugin/src/facade/f-univer';

univer.registerPlugin(UniverMyPlugin);

When consuming a built package, import its public subpath instead:

import { UniverMyPlugin } from 'my-plugin';
import 'my-plugin/facade';

The scaffold has no stylesheet. Product/preset styles belong to the host; if the plugin adds CSS, publish a CSS entry with a CSS-aware build and require the host to import it. See ui-customization.md for the 1.0 preset/plugin-mode CSS boundary.

Core rules

Plugin lifecycle

Extend Plugin, provide a unique pluginName, choose a UniverInstanceType, and inject Injector as the protected _injector required by the base class. The 1.0 product matrix is sheets, docs, slides, bases, boards, and PDFs; do not copy the Sheet scaffold unchanged for another product.

Hook Use it for
onStarting() Register DI dependencies, commands, menus, shortcuts, icons, and components. Do not read a workbook or the DOM.
onReady() Initialize logic that requires a created unit of the plugin's product type.
onRendered() Register render modules or other renderer/DOM-dependent logic.
onSteady() Start non-critical work after all plugins have rendered.

Own every disposable subscription, listener, shortcut, command, component, icon, render module, timer, and worker with disposeWithMe(). IMenuManagerService.mergeMenu() is the notable exception: it currently returns void.

Read plugin-architecture.md when adding lifecycle logic, DI services, configuration, dependencies, or controllers.

Command model

  • COMMAND orchestrates validation and business flow.
  • MUTATION deterministically changes persisted model state and is the collaboration changeset unit.
  • OPERATION changes transient UI state.

A mutation is not automatically undoable. Capture undo parameters before executing redo mutations, then push symmetric undoMutations and redoMutations through IUndoRedoService from the command.

Use executeCommand() for async execution and syncExecuteCommand() only when the full handler chain is synchronous. Both return the handler result directly; there is no .result wrapper.

Read command-system.md before changing persisted data, implementing undo/redo, invoking built-in commands, or listening to command execution.

Facade extensions

When the target Facade class explicitly exposes static extend(), subclass it, call extend(), and augment the module that owns the class. Not every public Facade class is a mixin target; check facade-extension.md first.

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

export interface IFWorksheetMyMixin {
    markHeader(color: string): this;
}

export class FWorksheetMyMixin extends FWorksheet implements IFWorksheetMyMixin {
    override markHeader(color: string): this {
        this.getRange(0, 0, 1, this.getMaxColumns()).setBackground(color).setFontWeight('bold');
        return this;
    }
}

FWorksheet.extend(FWorksheetMyMixin);

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

Consumers must side-effect import the extension module. Read facade-extension.md when extending FUniver, FWorkbook, FWorksheet, FRange, FDocument, Pro product Facades such as FPresentation, or Facade events.

UI extensions

Register toolbar and context-menu items by merging a menu schema. A menu item's id (or commandId) selects the re

Полный SKILL.md на GitHub

Установить univer-plugin-dev в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

agents/openai.yamlreferences/command-system.mdreferences/event-system.mdreferences/facade-extension.mdreferences/plugin-architecture.mdreferences/ui-customization.mdscripts/scaffold-plugin.ts

FAQ

Что делает скилл univer-plugin-dev?

Develop custom plugins for Univer sheets, docs, slides, bases, boards, and PDFs. Use when implementing a Plugin lifecycle, dependency injection, commands/mutations/operations, undo/redo, Facade extensions or custom events, toolbar/context-menu items, shortcuts, icons, popups, or when diagnosing plugin API and registration errors.

Как установить скилл univer-plugin-dev?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл univer-plugin-dev запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить univer-plugin-dev с