本文へスキップ
Skillpedia
インターフェース(UI/UX)101k · #990

token-map

できること

デザインの色やフォントなどの見た目のスタイルを整理し、既存のデザインシステムと問題なく組み合わせられるようにするプログラムです。デザイン内のスタイルとデザインシステムで定義されたスタイルを比較し、すべてが一貫して合うよう対応表(マップ)を作成します。

使う場面

  • ✓FigmaのデザインをコードへStます移行するとき。
  • ✓既存のデザインを新しいデザインシステムに対応させて更新するとき。
  • ✓色、フォント、余白などの見た目のスタイルが、デザインとデザインシステムの間で一貫しているか確認したいとき。

スキルのリンク

https://github.com/nexu-io/open-design/blob/main/plugins/_official/atoms/token-map/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/nexu-io/open-design/blob/main/plugins/_official/atoms/token-map/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“私のデザインにある色とタイポグラフィのトークンを、現在有効なデザインシステムに対応づけてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

プログラムは、Figmaやコードから取り出したデザインの見た目のスタイル(トークン)を分析します。各スタイルがどのような役割を持つか(たとえばメインの色か、見出しかなど)を、デザイン内での使われ方をもとに推定します。その後、デザイン内の各スタイルがデザインシステムのどのスタイルに対応するかを示すファイルを作成します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Token map

Spec §10 / §21.3.1: every figma-migration / code-migration run crosses the same boundary — "the source has its own tokens; the target uses the active OD design system; we need a deterministic mapping". This atom produces that mapping.

Inputs

  • figma/tokens.json from figma-extract (figma-migration), OR
  • code/tokens.json from design-extract (code-migration).
  • The active design system DESIGN.md (already injected into the prompt; the atom reads from the staged design-system context).

Output

project-cwd/
└── token-map/
    ├── colors.json     # { source: '#hex' | 'tokenName', target: '--ds-token' }[]
    ├── typography.json # font + size + weight pairings
    ├── spacing.json    # spacing scale crosswalk
    ├── unmatched.json  # { source: ..., reason: 'no-target-equivalent' }[]
    └── meta.json       # { sourceKind: 'figma' | 'code', generatedAt, atomDigest }

unmatched.json is the audit list a human reviews; the agent must not invent target tokens silently.

Semantic token inference

Figma often exports anonymous source names such as color-3, paint/17, or raw #5B8DEF. Do not ask the user to rename those before mapping. First infer the semantic role from usage evidence:

  • Node path, component name, instance overrides, variant/state labels, frame name, layer name, and nearby text such as Primary, Selected, Link, Error, Focus, Nav, Button, or CTA.
  • CSS-like position in the rendered tree: background fill, foreground text/icon, border, divider, overlay, shadow tint, focus ring, status badge, chart series, or brand/accent treatment.
  • Contrast relationships: a color paired repeatedly with the main canvas is likely foreground; one paired with foreground inside CTA components is likely primary/accent background; a thin outline around interactive elements is likely border or focus-ring.
  • Reuse topology: a value that appears across primary buttons, selected tabs, and active nav items is stronger evidence for --ds-color-primary than a value that appears once in an illustration.

Use that role evidence to choose among existing active design-system tokens and to decide whether an anonymous token should be renamed or left unmatched before the executable mapping pass. Keep the on-disk token-map contract unchanged: the atom still writes the existing bucket files, unmatched.json, and meta.json only.

For example, this is a useful reasoning note for deciding whether color-3 should map to the active primary token:

{
  "source": "color-3",
  "value": "#5B8DEF",
  "role": "primary",
  "targetCandidates": ["--ds-color-primary", "--ds-color-link"],
  "evidence": [
    "Button/Primary fill",
    "Selected tab indicator",
    "Link text in Settings frame"
  ]
}

Then map to an active design-system token only when the evidence is role-based, not value-only. If the top candidates are too close to call, or if the evidence points to conflicting roles (primary vs link vs focus-ring), leave the source token unmatched using the existing no-target-equivalent reason and include the competing candidates in the hint. This keeps automation useful for common anonymous-token cases while preserving human review for ambiguous brand decisions.

Before / after expectation

Without semantic inference, an anonymous Figma token can only produce an uncertain value-level mapping:

{
  "source": "color-3",
  "value": "#5B8DEF",
  "target": null,
  "reason": "no-target-equivalent"
}

With semantic inference, the same token should carry role evidence before it is accepted:

{
  "source": "color-3",
  "value": "#5B8DEF",
  "target": "--ds-color-primary",
  "via": "name"
}

This deterministic v1 atom does not claim a measured accuracy lift by itself. Treat the expected improvement as coverage of previously manual anonymous-token cases when the Figma tree contains enough role evidence. Real accuracy numbers require a fixture suite with known source tokens, expected semantic roles, and a before/after agent run. See examples/semantic-inference-before-after.json for a deterministic same-token-batch simulation that compares the old value-level output with the semantic inference output.

Convergence

The atom completes when every input token is either mapped or explicitly recorded under unmatched.json with a non-empty reason. The until evaluator reads tokens.unmatched.length === 0

…

よくある質問

「トークン」とは何ですか?

トークンとは、デザインの見た目のスタイルを構成する基本的な要素のことです。たとえば、特定の色(例:青 #0000FF)、フォントサイズ(例:16px)、余白の値(例:8px)などがあります。

デザイン内のスタイルに、デザインシステム側で対応するものがない場合はどうなりますか?

そのようなスタイルは「unmatched.json」というファイルに一覧で記載され、対応づけられなかった理由も説明されます。プログラムが勝手に新しいものを作るのではなく、内容を確認して手動で対応を決められるようになっています。

プログラムは、デザイン内のどのスタイルがデザインシステムのどのスタイルに一致するのをどう判断しますか?

コンポーネント名、そのスタイルが使われている文脈(たとえばボタンの文字など)、色同士の関係といった手がかりを使って、スタイルの役割を推定し、デザインシステム内で最も適したものを見つけます。

詳細

作者による元の説明

Map an extracted Figma / source-code token bag onto the active OD design system, producing a deterministic mapping the generate stage can consume.

repo: nexu-io/open-design

人気

GitHubのスター
101k
ランキング
#990
ライセンス
Apache-2.0
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル