token-mapping

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Token mapping

Token映射

A report that lands raw values (hex codes, pixel values, shadows) on a token list someone else owns. With no token set, it hands back groundwork for building one. The rules and an example report are in
references/mapping-rules.md
, finding and reading sources in
references/sources.md
. Sibling links are relative to this skill's folder.
本skill用于生成报告,将原始值(hex代码、像素值、阴影)映射到他人维护的Token列表中。如果不存在Token集合,它会返回构建Token列表的基础素材。规则和示例报告位于
references/mapping-rules.md
中,查找和读取源文件的方法位于
references/sources.md
中。同级链接均相对于本skill的文件夹。

Start from whatever the ask gives

从请求提供的任意内容开始

"Check the tokens on the settings page" is enough. Find the values and the list yourself, and ask only for what no tool can reach. Defaults:
  • Values: what the person named, else the branch diff, else the product code (
    references/sources.md
    ).
  • Mode: the list's default mode, named in Source.
  • rem root: 16px, unless the project sets another.
「检查设置页面的Token」这样的需求就足够了。你需要自行查找样式值和Token列表,仅在工具无法获取相关内容时才发起询问。默认规则:
  • 样式值:优先使用用户指定的内容,其次是分支diff,最后是产品代码(
    references/sources.md
    )。
  • 模式:Token列表的默认模式,在来源部分中指定。
  • rem基准值:16px,除非项目另有设置。

When a coordinator calls it

当协调者调用本skill时

Take the values and the list in the brief as given and run to the end without asking. Questions go under For a person to decide, which the caller turns into gates. Start with a status line,
Status: complete
,
Status: not actionable (gap threshold)
or
Status: stopped: <condition>
, then
Commit: none
. Return the report, or the stop shape below, as your final message.
直接使用需求说明中给出的样式值和Token列表,全程无需询问直接运行至结束。所有问题需归入「待人工决策」部分,由调用者将其转化为检查关卡。回复开头需包含状态行:
Status: complete
、
Status: not actionable (gap threshold)
或
Status: stopped: <condition>
,紧随其后的是
Commit: none
。将报告或下方的停止格式作为最终消息返回。

Steps

步骤

  1. Load the rules. Read
    references/mapping-rules.md
    and any AGENTS.md or CLAUDE.md. Done when overrides and any precedence rule are noted.
  2. Load the list. Done when Source has its name, format, location, read method and time.
  3. Resolve it. Follow every alias to its final value in each mode, and compare any second source. Done when every alias resolves and every disagreement is written down.
  4. Collect the groundwork. One row per property (a
    border
    shorthand is two rows), each with its location (
    file:line
    , or URL plus selector), category and job, sorted per
    mapping-rules.md
    (What counts as the team's list). Done when every raw and palette value in scope has a row.
  5. Normalize both sides per the rules file, converting colors with code.
  6. Classify. List the candidate tokens whose stated purpose covers the row's job, semantic before primitive, and give one class per row per mode. Done when every row has a class and a reason, and every semantic row states its difference in numbers.
  7. Count and close. Apply the gap threshold, write Consistency by role when the rules call for it, then the Summary and Source.
  1. 加载规则。 读取
    references/mapping-rules.md
    以及所有AGENTS.md或CLAUDE.md文件。当记录完所有覆盖规则和优先级规则后,本步骤完成。
  2. 加载Token列表。 当来源部分中记录了列表的名称、格式、位置、读取方式和读取时间后,本步骤完成。
  3. 解析Token列表。 在每个模式下追踪所有别名直至其最终值,并与第二来源(如有)进行对比。当所有别名都已解析、所有不一致之处都已记录后,本步骤完成。
  4. 收集基础数据。 每个属性对应一行(
    border
    简写属性对应两行),每行都需包含其位置(
    file:line
    格式,或URL加选择器)、类别和用途,按照
    mapping-rules.md
    中的规则排序(即「什么才算团队的Token列表」)。当范围内的所有原始值和调色板值都有对应行后,本步骤完成。
  5. 标准化。 根据规则文件对两边的值进行标准化,使用代码转换颜色值。
  6. 分类。 列出所有用途与该行用途匹配的候选Token,优先语义化Token,其次是基础Token,每个模式下每行对应一个分类。当所有行都有对应的分类和理由,且所有语义化Token行都说明了数值差异后,本步骤完成。
  7. 统计并收尾。 应用缺口阈值,按规则要求编写「按角色划分的一致性」部分,然后完成摘要和来源部分。

Output

输出

Seven parts, in this order, each specified in
references/mapping-rules.md
(Report shape): Summary, Mapping, Do not use, Ambiguous, Gaps, For a person to decide, Source.
Run directly, the chat reply gives the Summary's answer with its numbers, each command with its exit code, up to three questions for a person with defaults, and
Next:
with one prompt to paste.
The report is ready when:
  • Every row has a job, a class and a reason, and every ambiguous row names two or more candidates.
  • A semantic token appears wherever one covers the job, never its primitive.
  • Anything inferred rather than read, such as a job taken from a class name, is marked inferred.
  • Nothing in the repo changed.
报告共包含七个部分,按以下顺序排列,每个部分的规范都在
references/mapping-rules.md
中(报告结构章节):摘要、映射关系、不建议使用、存疑项、缺口、待人工决策、来源。
直接运行时,聊天回复会给出摘要的答案及相关数值、每个命令的退出码、最多三个带默认值的人工决策问题,以及
Next:
字段和一个可供粘贴的提示词。
满足以下条件时,报告才算完成:
  • 每一行都有对应的用途、分类和理由,每个存疑行都列出了两个或更多候选Token。
  • 只要存在匹配用途的语义化Token,就绝不使用其对应的基础Token。
  • 所有推断而非直接读取的内容(例如从类名推断出的用途)都需标记为推断。
  • 代码仓库中的内容没有任何改动。

Stops

停止条件

Stop and report on these only.
  • No list exists, or no tool can read one.
  • One name has two values in the same mode, which makes the list broken.
  • Two sources disagree and no project rule says which wins. Report both sides.
A stopped run returns the condition, the groundwork from step 4 (grouped per
mapping-rules.md
, When the repo has no token file), and the shortest message that unblocks it, such as "Paste
tokens.json
or give its path." Gaps are never a stop, at any count.
仅在以下情况时停止并报告:
  • 不存在Token列表,或没有工具能够读取该列表。
  • 同一个名称在同一模式下有两个不同的值,导致Token列表损坏。
  • 两个来源的数据不一致,且没有项目规则说明以哪个为准。需同时报告两边的内容。
运行停止时需返回停止条件、第4步收集的基础数据(按照
mapping-rules.md
中「当仓库没有Token文件时」的规则分组),以及解决该问题的最短提示,例如「粘贴
tokens.json
内容或提供其路径」。无论缺口数量多少,都不能作为停止理由。

Hard limits

严格限制

  • Name only tokens in the list that was read. A gap never gets a new token name.
  • Match on purpose before value, and on value only within the rules file's tolerances.
  • Read the list and the values fresh each run and record the read time. A failed read is reported, never filled from memory.
  • A public system's token names, Geist's included, are never the team's list.
  • 仅能使用已读取的Token列表中的Token名称。缺口项永远不会获得新的Token名称。
  • 优先按用途匹配,其次按值匹配,且值的匹配必须在规则文件规定的容差范围内。
  • 每次运行都需重新读取Token列表和样式值,并记录读取时间。读取失败时需报告,绝不能用记忆中的内容填充。
  • 公共系统的Token名称(包括Geist在内)永远不能算作团队的Token列表。