본문으로 건너뛰기
cccskills
무료GitHub에 공개

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.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(8)

  • SKILL.md6.9 KB
  • agents/openai.yaml322 B
  • references/command-system.md8.5 KB
  • references/event-system.md5.2 KB
  • references/facade-extension.md7.9 KB
  • references/plugin-architecture.md9.9 KB
  • references/ui-customization.md8.7 KB
  • scripts/scaffold-plugin.ts7.0 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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.

HookUse 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 registered command. A shortcut also executes the command whose ID it carries; IShortcutItem has no custom handler.

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

Use IconManager for icons and ComponentManager for React/Vue/custom components. Keep their returned disposables. Read ui-customization.md for current menu nesting, context-menu positions, shortcuts, components, and range popups.

Events

Prefer typed Facade events through univerAPI.addEvent(). Load the owning Facade side-effect module so its event names and parameter types are installed. Filter ICommandService listeners by exported command constants when no semantic Facade event exists.

Read event-system.md for current event names, cancellation, custom events, and cleanup.

Validation

After generating or editing a plugin:

  1. Build or typecheck it against the target project's exact Univer versions.
  2. Register it in a minimal app and exercise the command, menu/shortcut, Facade side-effect import, and disposal path.
  3. Verify persisted changes round-trip and undo/redo when applicable.
  4. Run the skill validator after editing this skill:
python3 ~/.codex/skills/.system/skill-creator/scripts/quick_validate.py skills/univer-plugin-dev

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Build applications with Univer Office SDK, covering the Web SDK (browser Office editors, headless Sheets and Docs in Node), Server SDK (self-hosted OT collaboration, storage, auth, Office import/export), AI SDK (agent-operated Office CLIs, reviewable Worktrees), and Binding SDK (plain HTML pages bound to live Sheet data). Use when starting or designing any Univer-based app or choosing Univer packages, including when the user describes a spreadsheet, document, collaboration, or AI-office need without naming a Univer package.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dream-num/skills782026년 10월 14일 업데이트

Use when installing or operating Univer CLI for .univer files, spreadsheets, documents, slides, Base databases, Board canvases, cross-Unit embedding, worktrees, Facade authoring, inspection, verification, import/export, screenshots, or viewer handoff.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dream-num/skills782026년 10월 14일 업데이트

Customize Univer color themes, branded palettes, dark mode, and theme-aware plugin styles across Sheets, Docs, Slides, Bases, Boards, and PDFs. Use when setting an initial or runtime Theme, consuming ThemeService or --univer-* CSS variables, keeping custom UI or canvas code theme-aware, registering a separate Univer Pro chart theme, or migrating theme code from Univer 0.25.0 to current 1.0 source.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dream-num/skills782026년 10월 14일 업데이트

Integrate Univer Sheets, Docs, or Slides into React, Vue 3, HTML, or Node.js projects. Use when embedding Univer, choosing preset or plugin mode, initializing instances, configuring themes/locales/workers, or manipulating workbooks, worksheets, ranges, formulas, permissions, and events through the Facade API.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dream-num/skills782026년 10월 14일 업데이트

Run Univer Sheets, Docs, Slides, Bases, Boards, or PDFs in Node.js without browser UI. Use for server-side or backend Univer, OSS Sheets or Docs Node presets, Pro product Facades and collaboration, JSON snapshot processing, formula or Base child-process workers, or automated unit manipulation with @univerjs/rpc-node.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dream-num/skills782026년 10월 14일 업데이트

Integrate current Univer Pro features into browser applications. Use for licensed Sheets, Docs, Slides, Bases, Boards, or PDFs; advanced Sheets presets; collaboration and edit history; Office import/export; printing; pivot tables; charts; sparklines; shapes; Pro workers; license ordering; or Pro Facade APIs.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dream-num/skills782026년 10월 14일 업데이트

dream-num의 스킬 모두 보기

이 스킬의 문제 신고