figma-restoration-rules

figma-restoration-rules is a cursor rule for Cursor from tianmuji/figma-restoration-tools. It costs 6,043 tokens per session, scanned A, original, MIT.

A set of rules for recreating Figma components, which are reusable interface elements, from Figma data and screenshots. It describes a workflow for checking the visual result and simplifying the component structure.

In plain words
What is it for?
Use it when rebuilding Figma components in the specified Vue project and checking their layout against reference images.
Why use it?
It gives the agent a defined way to compare the source design with the implementation and remove elements that are not actually visible.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /Users/yujie_wu/Documents/study/11111/figma-restoration-mcp-vue-tools/src/figma-data.

Good fit Use it when rebuilding Figma components in the specified Vue project and checking their layout against reference images.

Compare 6 cursor rules from other repositories ↓
Install

Getting it into your agent

There is no command for this one: it runs only inside a plugin, and the catalogue could not identify which plugin ships it. The source is linked below.

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for figma-restoration-rules

README.md
[![agentmods](https://agentmods.dev/badge/rules/tianmuji/figma-restoration-tools/figma-restoration-rules/github.svg)](https://agentmods.dev/rules/tianmuji/figma-restoration-tools/figma-restoration-rules)
Your own site
<a href="https://agentmods.dev/rules/tianmuji/figma-restoration-tools/figma-restoration-rules"><img src="https://agentmods.dev/badge/rules/tianmuji/figma-restoration-tools/figma-restoration-rules/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for figma-restoration-rules

Your own site · 80×15
<a href="https://agentmods.dev/rules/tianmuji/figma-restoration-tools/figma-restoration-rules"><img src="https://agentmods.dev/badge/rules/tianmuji/figma-restoration-tools/figma-restoration-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 6,043 This file is loaded in full into every session.
When invoked 6,043 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.06043 $0.06043
Opus 5 $0.03021 $0.03021
Sonnet 5 $0.01209 $0.01209
Haiku 4.5 $0.00604 $0.00604

Measured 10d ago against content hash 73ec30efb5cf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

figma-restoration-rules scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/figma-restoration-rules.mdc · 393 lines

How it starts

The opening of the file, as written. The whole thing — 393 lines — stays where its author put it; the contents beside it link to each section on GitHub.

🔄 持续生效规则:Figma组件还原流程

工作目录范围

你始终在 figma-restoration-mcp-vue-tools目录下的文件工作

Figma组件还原流程规则

概述

当用户要求还原Figma组件并提供Figma链接时,严格按照以下7步流程执行。

⭐ 核心优势提示: 你是Claude AI,具备强大的图像元素识别能力。在Figma组件还原流程中,专注利用你的视觉识别能力来:

  • 直接识别expected.png中的视觉元素: 无需依赖文件读取,直接观察和识别图片中的所有可见元素
  • 智能过滤冗余元素: 基于视觉验证,准确判断原始Figma JSON中的哪些元素在图片中真正可见、哪些是冗余的
  • 确定真实元素层级: 通过观察图片中的视觉层级关系,优化JSON中可能不合理的嵌套结构
  • 视觉元素精确映射: 将JSON中的技术描述与图片中的实际视觉效果进行准确对应

重要说明:

  • 图片对比工作由专门的对比工具完成,Claude专注于元素识别和结构优化
  • 原始Figma JSON只能保证视觉呈现正确,但无法保证元素层级合理性和去除冗余元素
  • Claude的价值在于基于视觉真实性优化JSON结构,确保最终实现更精确、更简洁

流程步骤

步骤1: 获取Figma数据

  • 使用工具获取Figma JSON数据
  • 参数设置:
    • fileKey: 从Figma链接中提取
    • nodeId: 从Figma链接中提取
    • ⭐ savePath: 必须使用绝对路径 /Users/yujie_wu/Documents/study/11111/figma-restoration-mcp-vue-tools/src/figma-data
  • 🆕 文件命名规范: 工具会自动保存JSON到指定目录,文件名包含node-id便于快速查找
    • 格式:figma-{fileKey}-{nodeId}-{timestamp}.json
    • 示例:figma-Mbz0mgLIVbz46bxPwBFnSl-4211-72472-2025-07-24T03-22-23-609Z.json

步骤2: 下载预期截图获取视觉目标

⭐ 首先获取视觉标准 - 在分析JSON之前先获取实际视觉效果:

  • 使用 mcp_figma-context_download_figma_images 下载原始组件节点的PNG截图
  • 参数设置:
    • fileKey: 与步骤1相同的fileKey
    • nodeId: 与步骤1相同的nodeId
    • localPath: 必须使用绝对路径到results目录 /Users/yujie_wu/Documents/study/11111/figma-restoration-mcp-vue-tools/src/components/{ComponentName}/results
    • fileName: 必须命名为 "expected.png"
    • pngScale: 3 (高分辨率)

⭐ 重要:3倍图理解与尺寸设置

  • 图片缩放关系: expected.png和actual.png都是3倍分辨率图片
  • CSS尺寸计算: 实际CSS尺寸 = 图片显示尺寸 ÷ 3
  • 尺寸来源优先级:
    1. layout-analysis.json (1倍设计尺寸) - 主要依据 ✅
    2. Figma JSON boundingBox (1倍设计尺寸) - 验证依据
    3. 图片观察 (视觉识别) - 辅助判断,不用于数值设置
  • 图片用途明确:
    • expected.png: 视觉目标参考、元素识别、结构分析
    • diff.png: 像素差异可视化(橙色/红色 = 差异区域,非设计颜色)
  • ⭐ 关键经验: 参考 /src/restoration-tips/截图对比-3倍图缩放与样式尺寸设置.md

步骤3: 结合expected.png和原始figma.json分析得到layout-analysis

⭐ 视觉驱动的智能分析 - 结合视觉目标和技术数据进行分析:

第一步:视觉元素识别 ⭐ 重要提示: 你是Claude AI,具备直接分析图片内容的能力。无需依赖read_file读取图片,可以直接查看和分析图片的视觉内容。

Read the full file on GitHub · 393 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 393 lines · 6,043 tokens per session scan A 73ec30efb5cf

Subscribe to this mod's changes

figma-restoration-rules is a cursor rule published in the GitHub repository tianmuji/figma-restoration-tools (0 stars, last pushed 1y ago), licensed MIT. It adds 6,043 tokens to every session, about $0.0302 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.