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

io-figma

Guides work on the Figma I/O package (@grida/io-figma, packages/grida-canvas-io-figma/). Covers the fig-kiwi binary parser, Kiwi→REST→Grida conversion pipeline, fig2grida CLI, REST API JSON conversion, and testing with clipboard/fig/REST fixtures. Use when adding node type support, fixing conversion bugs, extending fig2grida, working on the fig-kiwi parser, writing tests for Figma import, or debugging clipboard paste failures after a Figma update.

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

연동 도구Figma
설치 방법 보기

포함된 파일(1)

  • SKILL.md8.8 KB

SKILL.md(원문)

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

Figma I/O — @grida/io-figma

Package: packages/grida-canvas-io-figma/

Architecture

.fig bytes / HTML clipboard
  → fig-kiwi parser       (fig-kiwi/)          low-level, zero-opinion
  → NodeChange[]          (Kiwi schema types)
  → iofigma.fromKiwi*()   (lib.ts)              Kiwi → Grida node

Figma REST API JSON
  → iofigma.fromRest*()   (lib.ts)              REST → Grida node

Orchestration:
  fig2grida-core.ts       — browser-safe: input detection, page loop, pack
  fig2grida.ts            — CLI wrapper (Node.js only, uses fs + process.argv)

Key invariant: The Kiwi path converts to REST format first (Kiwi → REST → Grida). lib.ts is the single source of truth for node conversion; it does not know the input origin.

Output: Grida format (.grida ZIP — FlatBuffers + images). See io-grida skill for format details, Rust loading, and round-trip testing.

fig2grida Input Formats

fig2grida(input) in fig2grida-core.ts auto-detects the input:

InputDetectionPath
.fig bytesZIP without document.json, or raw Kiwifig-kiwi parser
REST archive ZIPZIP containing document.json (+ optional images/)REST JSON path
REST JSON bytesStarts with {REST JSON path
REST JSON objectNon-Uint8Array objectREST JSON path

The REST JSON path (extractCanvases) accepts multiple response shapes:

  • { document: { type: "DOCUMENT", children: [CANVAS, …] } } — full GET /v1/files/:key
  • { document: { type: "CANVAS", children: […] } } — single-page node fetch
  • { nodes: { "id": { document: … }, … } } — GET /v1/files/:key/nodes?ids=…
  • { type: "DOCUMENT", children: … } — document node directly
  • { type: "CANVAS", children: … } — single CANVAS node
  • { children: […] } — bare object with children

Public APIs (both in fig2grida-core.ts):

  • fig2grida(input, options?) → .grida ZIP bytes (Fig2GridaResult)
  • restJsonToGridaDocument(json, options?) → in-memory Document + assets (no ZIP packing)

Key Files

FileRole
lib.tsAll iofigma.from* converters (Kiwi→REST and REST→Grida)
fig2grida-core.tsOrchestrator (.fig, REST JSON, REST ZIP)
fig2grida.tsCLI entry point (Node.js only)
fig-kiwi/index.tsLow-level parser public API
fig-kiwi/blob-parser.tsVector network + commands blob decoding
fig-kiwi/schema.tsKiwi type definitions (NodeChange, Message, …)

References

PathWhat
.ref/figma/Kiwi schema (fig.kiwi, fig.kiwi.d.ts), extraction tool (fig2kiwi.ts), Figma REST & Plugin API typings
docs/wg/feat-fig/glossary/fig.kiwi.mdDeep-dive: node types, vector blob format, GROUP/FRAME detection, text/font mapping
packages/grida-canvas-io-figma/README.mdFeature matrix, limitations, usage

Common Tasks

Add support for a new Figma property

  1. Find the property in fig-kiwi/schema.ts (Kiwi) or REST JSON in fixtures/test-figma/.
  2. Add mapping in lib.ts under the relevant iofigma.from* converter.
  3. Add a test in __tests__/ against an existing fixture.

Debug a clipboard paste failure

Clipboard issues = Figma changed their Kiwi schema.

  1. Save the failing HTML clipboard as a fixture.
  2. Run readHTMLMessage(html) → inspect raw Message.
  3. Diff parsed NodeChange[] against fig-kiwi/schema.ts.
  4. Update schema.ts (field changes) or blob-parser.ts (blob layout changes).

Run fig2grida

pnpm --filter @grida/io-figma fig2grida input.fig
npx tsx packages/grida-canvas-io-figma/fig2grida.ts input.fig --pages 0,2
npx tsx packages/grida-canvas-io-figma/fig2grida.ts input.fig --info

Figma API token

figma_archive.py requires a Figma Personal Access Token. The script checks FIGMA_TOKEN then X_FIGMA_TOKEN env vars, or accepts --x-figma-token on the CLI. It fails fast with a clear error if none is set.

The root .env file is not a standard part of this project — it may not exist on every machine. Never read .env directly (for security reasons). Instead, if a token is needed and not already in the environment, ask the user to provide one and have them export it:

export FIGMA_TOKEN=figd_...

Create REST API fixtures

Use scripts/figma_archive.py. See the script header for full documentation, output layout, and --export behaviour.

python .agents/skills/io-figma/scripts/figma_archive.py \
  --filekey <KEY> --archive-dir fixtures/test-figma/community/<name>

# With oracle PNGs (nodes must have export presets in Figma)
python .agents/skills/io-figma/scripts/figma_archive.py \
  --filekey <KEY> --archive-dir fixtures/test-figma/rest-api/local/<name> --export

Refig — correctness testing against Figma's renderer

For end-to-end correctness of the Figma import pipeline (does our Grida render of a Figma file match Figma's own render?), use the refig flow: oracle PNGs from Figma's Images API + @grida/reftest (developed in the engine repo: https://github.com/gridaco/nothing/tree/main/packages/grida-reftest) for the diff/score/report. Suites live in the engine repo's gitignored local corpus (fixtures/local/refig/<name>.<filekey>/ — local-only, machine-local by definition). See the engine repo's render-reftest skill, section "Figma — the refig reftest pipeline": https://github.com/gridaco/nothing/blob/main/.agents/skills/render-reftest/SKILL.md.

When debugging a conversion bug with a visible visual symptom, run the refig suite to locate the diverging nodes, then drill into lib.ts for the specific node type or property.

Tests

pnpm --filter @grida/io-figma test                              # all
pnpm --filter @grida/io-figma test -- __tests__/iofigma.kiwi.test.ts  # specific
Test fileCovers
iofigma.kiwi.test.tsKiwi clipboard → Grida
iofigma.kiwi.fig.test.ts.fig file parsing
iofigma.kiwi.vector-network.test.tsVector network blob decoding
iofigma.kiwi.clipboard-overrides.test.tsComponent instance overrides
iofigma.kiwi.clipboard-components.test.tsComponent / instance clipboard
iofigma.kiwi.clipboard-text-overrides.test.tsText style overrides
iofigma.rest-api.no-geometry.test.tsREST API (no geometry)
iofigma.rest-api.vector.test.tsREST API vector paths
fig2grida.test.tsEnd-to-end pipeline
fig-kiwi/__tests__/Low-level parser units

Fixtures: fixtures/test-figma/rest-api/ (committed REST JSON), fixtures/test-figma/community/ (archived files), fixtures/local/ (gitignored, manual testing).

Known Limitations

  • Component sets, FigJam nodes (STICKY, CONNECTOR, TABLE) not supported
  • characterStyleOverrides / styleOverrideTable partially mapped from Kiwi
  • Style/variable bindings not preserved
  • Kiwi is undocumented — can break after Figma updates

Check the README's limitations section before writing new code. If lifting a limitation, update the README.

Verification

pnpm turbo typecheck --filter='./packages/grida-canvas-io-figma'
pnpm turbo test --filter='./packages/grida-canvas-io-figma'

리뷰

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

댓글

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

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

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

0 / 1,000자

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

같은 저장소의 스킬

Grida AI agent system work: `@grida/daemon` (DaemonServer, loopback HTTP perimeter, files/workspaces, secrets store, daemon discovery) and `@grida/agent` (the agent tenant: sessions, providers/BYOK, runtime/tool execution, skills discovery, prompts, tiers, sandbox hosts). Use for `packages/grida-daemon/**`, `packages/grida-ai-agent/**`, desktop sidecar protocol changes, agent chat transport, and bugs in agent state or streams. For pure Electron window, preload, menu, deep-link, or CDP work, use `desktop`.

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

gridaco/grida2.7천2026년 10월 15일 업데이트

ai-models

무료

Research, compare, and update shared AI model JSON for TypeScript, web, and Rust consumers. Covers text model tiers, image and video generation models, image tool models, release provenance, pricing data sourcing, and product-side catalogue cost estimates. Use when bumping model versions, adding new models, updating pricing, or auditing model specs against provider documentation.

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

gridaco/grida2.7천2026년 10월 15일 업데이트

React-specific code shape in the Grida editor. Hooks cannot be tested or benchmarked and silently break tuned UX under layered composition, so they are barred from the engine and main system — load-bearing logic lives in classes and namespaces, hooks only as thin edge wires. `data-testid` follows component-root discipline: one per significant component, not scattered. Use when authoring React in `editor/grida-canvas-react/`, `editor/components/`, `editor/scaffolds/`, or `editor/app/*`.

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

gridaco/grida2.7천2026년 10월 15일 업데이트

code-ts

무료

TypeScript code shape inside a well-named module — taste, not lint. Prefer one class or namespace per file (the unit a test targets) over scattered free exports; consolidate related code, don't fragment. The unit of code should be the unit of spec. Use when authoring TS in `editor/grida-canvas*`, `editor/lib/`, or `packages/*`. Sibling to the `naming` skill; React-specific shape lives in `code-react`.

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

gridaco/grida2.7천2026년 10월 15일 업데이트

database

무료

Use BEFORE editing any file in `supabase/migrations/` or `supabase/schemas/`, OR when the user runs a `/database` subcommand (`compact local migration`, `rls scenarios`, `align`). Encodes the three contracts that protect the Grida database layer: applied migrations are immutable, RLS implementation mirrors tests (never the reverse), `schemas/*.sql` is the human-readable end-state. Companion to `supabase/AGENTS.md` (RLS, grants, security boundaries).

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

gridaco/grida2.7천2026년 10월 15일 업데이트

desktop

무료

Grida Desktop Electron shell and release-impact work: BrowserWindow, preload, `window.grida`, menus, protocol/deep links, file associations, Forge, path-scoped bridge security, Electron-only UI bugs, and CDP / Playwright verification. Use for `desktop/`, `editor/app/desktop/**`, `editor/scaffolds/desktop/**`, `editor/lib/desktop/**`, `/desktop/*` CSP, GRIDA-SEC-004, and deciding whether linked-package or hosted-renderer changes require a native Desktop version bump or coordinated release. For implementing daemon/agent-tenant core behavior, use `agent-system` as well.

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

gridaco/grida2.7천2026년 10월 15일 업데이트

gridaco의 스킬 모두 보기

이 스킬의 문제 신고