Chuyển đến nội dung
Skillpedia
Giao diện (UI/UX)101k · #990

token-map

Skill này làm gì

Chương trình này giúp sắp xếp các kiểu dáng hình ảnh của thiết kế (như màu sắc và phông chữ) để chúng hoạt động tốt với một hệ thống thiết kế có sẵn. Nó so sánh kiểu dáng của thiết kế với các kiểu dáng được định nghĩa trong hệ thống thiết kế và tạo một bản đồ để đảm bảo mọi thứ khớp nhau nhất quán.

Khi nào nên dùng

  • ✓Khi bạn chuyển một thiết kế từ Figma sang mã.
  • ✓Khi bạn cập nhật một thiết kế hiện có để dùng hệ thống thiết kế mới.
  • ✓Khi bạn muốn đảm bảo mọi kiểu dáng hình ảnh (màu sắc, phông chữ, khoảng cách) nhất quán giữa thiết kế và hệ thống thiết kế.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/nexu-io/open-design/blob/main/plugins/_official/atoms/token-map/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Vui lòng ánh xạ các token màu sắc và kiểu chữ từ thiết kế của tôi sang hệ thống thiết kế đang dùng.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Chương trình phân tích các kiểu dáng hình ảnh (token) từ thiết kế của bạn, được trích xuất từ Figma hoặc mã. Nó cố đoán mục đích của từng kiểu dáng (ví dụ màu chính hay tiêu đề) dựa trên cách nó được dùng trong thiết kế. Sau đó, nó tạo một tệp thể hiện mỗi kiểu dáng của thiết kế tương ứng với kiểu dáng nào trong hệ thống thiết kế.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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

…

Câu hỏi thường gặp

“Tokens” là gì?

Tokens là các khối xây dựng cơ bản của kiểu dáng hình ảnh, như một màu cụ thể (ví dụ xanh dương #0000FF), một cỡ chữ (ví dụ 16px) hoặc một giá trị khoảng cách (ví dụ 8px).

Điều gì xảy ra nếu một kiểu dáng trong thiết kế của tôi không có tương đương trong hệ thống thiết kế?

Chương trình sẽ liệt kê các kiểu dáng này trong một tệp tên là “unmatched.json”, kèm giải thích lý do không thể ghép. Bạn có thể xem xét và tự quyết định cách xử lý, thay vì chương trình tự bịa ra.

Chương trình biết kiểu dáng nào trong thiết kế tương ứng với kiểu dáng nào trong hệ thống thiết kế không?

Nó dựa vào các manh mối từ thiết kế, như tên thành phần, bối cảnh nơi kiểu dáng được dùng (ví dụ chữ trên nút bấm) và mối quan hệ màu sắc, để suy ra mục đích của kiểu dáng và tìm sự tương đồng tốt nhất trong hệ thống thiết kế.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
101k
Vị trí xếp hạng
#990
Giấy phép
Apache-2.0
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự