figjam-plugin
FigJam plugin development workflow. Use when working on plugin code (code.ts, ui.ts), debugging WebSocket communication, or building the plugin.
When & Why to Use This Skill
This Claude skill provides a specialized workflow for FigJam plugin development, focusing on the dual-thread architecture of Figma's environment. It streamlines the process of managing canvas rendering in the main thread (code.ts) and handling UI or WebSocket communication in the browser thread (ui.ts), ensuring developers can efficiently navigate API limitations, build processes, and real-time debugging.
Use Cases
- Architecting and debugging the communication bridge between the Figma main thread and UI thread using postMessage and WebSockets.
- Implementing complex canvas rendering logic and node manipulation using the figma.* API within the restricted code.ts environment.
- Troubleshooting plugin build errors and manifest configurations when importing projects into the Figma Desktop developer environment.
- Developing real-time collaborative features by managing WebSocket clients within the ui.ts file to sync external data with FigJam.
| name | figjam-plugin |
|---|---|
| description | FigJam plugin development workflow. Use when modifying code.ts (canvas rendering), ui.ts (WebSocket/UI), fixing plugin build errors, or adding new rendering features. |
FigJam Plugin Development
Architecture
| Thread | File | APIs | Role |
|---|---|---|---|
| Main | code.ts |
figma.* only |
Canvas rendering |
| UI | ui.ts |
Browser APIs | WebSocket client, connection UI |
Critical: code.ts has NO browser APIs (window, document, fetch, WebSocket).
Communication
CLI ←─ WebSocket ─→ ui.ts ←─ postMessage ─→ code.ts ←─ figma.* ─→ Canvas
Build & Import
cd packages/plugin && bun run build
Import: Figma Desktop → Plugins → Development → Import from manifest → packages/plugin/manifest.json
Debugging
- UI errors: Right-click plugin UI → Inspect
- Main errors: Plugins → Development → Open console
JSON Import
- Accepts DSL (nodes array) or IR (nodes object)
- Validates with
@figram/core, normalizes to IR - Errors shown in alert with path + message
Key Files
| File | Purpose |
|---|---|
manifest.json |
Plugin config |
src/code.ts |
Canvas rendering |
src/ui.ts |
WebSocket + UI |
src/icons/ |
Service icons |