Agent skill

React To Figma Make

by lintendo in lintendo/Axhub-Skills

A skill your agent uses when 需要把现有 React、Vite、Next.js、V0 或 AI Studio 页面转换为 Figma Make 可导入的 .fig 资产,或补齐、更新、验证已有 Figma Make 导出壳和 canvas.fig。

MITAuto-check passedFrontend & Design

Install React To Figma Make

skills CLI
$ npx skills add lintendo/Axhub-Skills --skill react-to-figma-make -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install lintendo/Axhub-Skills react-to-figma-make --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/lintendo/Axhub-Skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/react-to-figma-make .claude/skills/react-to-figma-make && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
react-to-figma-make
GitHub stars
127
Token cost
~4.2k tokens
SKILL.md length
949 words
Files
7 (incl. scripts, references, assets)
Skills in repo
13
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when 需要把现有 React、Vite、Next.js、V0 或 AI Studio 页面转换为 Figma Make 可导入的 .fig 资产,或补齐、更新、验证已有 Figma Make 导出壳和 canvas.fig。

  • Works in 2 steps: 项目结构转换(通用):将 React 项目改造为 Figma Make 目录规范… → canvas.fig 生成与验证:本技能内置了相关的操作脚本,位于技能自身的目录下
  • 需要把现有 React、Vite、Next.js、V0 或 AI Studio 页面转换为 Figma Make 可导入的 .fig 资产,或补齐、更新、验证已有 Figma Make 导出壳和 canvas.fig
  • SKILL.md covers 概述, 核心原则与当前能力边界, 何时使用 and 环境要求, plus 4 more sections
  • Runs JavaScript scripts from its folder; calls node and npm

What it does

React To Figma Make is an agent skill from lintendo/Axhub-Skills. Use when 需要把现有 React、Vite、Next.js、V0 或 AI Studio 页面转换为 Figma Make 可导入的 .fig 资产,或补齐、更新、验证已有 Figma Make 导出壳和 canvas.fig。

Its SKILL.md is about 4.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 9 other files, including scripts, reference files and assets (for example `references/meta-json-spec.md`, `references/project-structure.md` and `references/style-migration.md`).

It sits in Frontend & Design. It works with Figma, React, Vite and Next.js. The licence is MIT.

When your agent uses it

  • 需要把现有 React、Vite、Next.js、V0 或 AI Studio 页面转换为 Figma Make 可导入的 .fig 资产,或补齐、更新、验证已有 Figma Make 导出壳和 canvas.fig

Example prompts

  • “/react-to-figma-make”

Requirements

  • Node.js

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. 项目结构转换(通用):将 React 项目改造为 Figma Make 目录规范 — 任何环境均可执行
  2. canvas.fig 生成与验证:本技能内置了相关的操作脚本,位于技能自身的目录下

What it can do on your machine

Read from SKILL.md and the folder at commit 1e1c5bc. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (JavaScript), which the agent can run.

    Shell commands in SKILL.md call:

    • node
    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

React To Figma Make loads about 4.2k tokens when it runs, and up to ~7.5k if it reads all its reference files. Until then it costs about 35 tokens; SKILL.md has 949 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~35
When it runs · the whole SKILL.md, loaded when a task matches
~4.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~7.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from lintendo/Axhub-Skills at commit 1e1c5bc, republished under its MIT licence (© lintendo). 949 words, ~4,186 tokens.

Download SKILL.mdSave it as .claude/skills/react-to-figma-make/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
react-to-figma-make
description
Use when 需要把现有 React、Vite、Next.js、V0 或 AI Studio 页面转换为 Figma Make 可导入的 .fig 资产,或补齐、更新、验证已有 Figma Make 导出壳和 canvas.fig。

React 导出到 Figma Make

概述

本技能将帮助你把 React 组件或应用经过兼容改造后,转换为符合 Figma Make 项目规范的标准结构。转换完成后,项目将具备:

  • Figma Make 可编辑性:可在 Figma Make 平台中打开、编辑和迭代
  • .fig 导出能力:生成可下载的 .fig 文件
  • 双入口架构:同时支持独立运行和 Figma Make 导出
  • 设计 Token 保留:保持原始设计系统的 CSS 变量和主题定义
  • 资产完整性:包含 meta.json、ai_chat.json、images/ 等 Figma Make 要求的元文件

本技能产出一个完整的 Figma Make 兼容项目目录,并默认把可被宿主工具消费的产物写入通用 artifact 目录:

text
.axhub/make/artifacts/figma/<resource-id>/
├── canvas.fig
├── meta.json
├── ai_chat.json
├── canvas.code-manifest.json
├── manifest.json
├── images/
└── thumbnail.png            # 可选

如果目标项目使用 .axhub/make/project.json 描述资源,需要在对应 resources.prototypes[].artifacts.figma 中登记这些路径,便于 make-server 或其他宿主直接导出 .fig。

核心原则与当前能力边界

canvas-fig-sync.mjs pack 是模板节点同步器,不是通用的文件系统导入器。

  • pack 只更新 canvas.fig 中已经存在的 CODE_FILE.logicalPath。
  • 磁盘上新增但模板中不存在的路径不会自动变成新的 CODE_FILE。
  • 使用 --prune-missing 时,模板中存在、磁盘上不存在的路径会被删除。
  • 使用 --sanitize-for-export 时,聊天历史和代码快照会被清空;如果源码映射错误,无法依赖清理后的 .fig 恢复源码。
  • inspect 命令退出成功只证明二进制可解析,不证明源码完整或能够运行。

因此,首次生成前必须先 inspect 模板,并让导出源码路径与模板已有逻辑路径对齐。路径由实际 template manifest 决定,不是 Figma Make 的固定文件名。当前 bundled empty-canvas.fig 中可以确认的通用入口和可选路径包括:

磁盘路径(相对 --from)CODE_FILE.logicalPath职责
src/App.tsxApp.tsx当前模板的 Figma Make 入口,必须保留
src/styles/globals.cssstyles/globals.css当前模板已有的可选样式节点
src/<manifest 中已有路径>对应 logicalPath可选业务模块或其他资源

当前模板中的 components/Dashboard.tsx 只是一个历史示例槽位,不是通用规范,也不代表目标页面必须是 Dashboard。只有当本次转换明确选择该现有槽位时才能使用它。如果原页面依赖多个模板未覆盖的本地模块,优先使用项目现有构建工具把业务代码机械打包到 src/App.tsx,或打包到本次从 manifest 中明确选定的已有槽位。不要把业务逻辑手工重写成另一套实现;保留原页面入口,把导出壳作为可重复生成、可持续同步的独立适配层。

何时使用

  • 你有一个现成的 React 项目,希望导入 Figma Make 进行可视化编辑
  • 你需要从 React 代码生成 .fig 文件用于设计交付
  • 你希望在 Figma Make 和代码编辑器之间双向协作
  • 你有一个 V0 / AI Studio / 自建 React 项目,想把它纳入 Figma Make 生态

环境要求

本技能分为两部分:

  1. 项目结构转换(通用):将 React 项目改造为 Figma Make 目录规范 — 任何环境均可执行
  2. canvas.fig 生成与验证:本技能内置了相关的操作脚本,位于技能自身的目录下:
    • scripts/canvas-fig-sync.mjs:canvas.fig 回写与检查工具
    • assets/empty-canvas.fig:空白 canvas 模板
    • 脚本运行依赖 pako 和 kiwi-schema。先直接运行一次;如果出现 ERR_MODULE_NOT_FOUND,在脚本所属包中按宿主项目规定的包管理器安装依赖,不要向目标原型的运行时依赖中添加这两个包。

如果有额外的页面渲染验收脚本,也可以在此阶段执行。

引用文件

本技能附带以下参考文件,在转换特定技术领域时按需查阅:

  • references/project-structure.md:Figma Make 项目的完整目录结构和文件职责说明
  • references/meta-json-spec.md:meta.json 的完整字段定义和示例
  • references/style-migration.md:从各种 CSS 方案迁移到 Figma Make 样式体系的指南

转换工作流程

第 1 步:分析源项目

分析目标 React 项目的以下方面:

  1. 框架识别:

    • 纯 React(Vite / CRA / 自定义)
    • Next.js(需要移除 SSR、"use client"、next/image 等)
    • AI Studio(Import Map + CDN 模式)
    • 其他元框架
  2. 入口结构:

    • 主应用组件在哪里(通常是 App.tsx 或 page.tsx)
    • 挂载入口在哪里(main.tsx / index.tsx)
    • 是否有路由(多路由需收敛为单入口)
  3. 样式方案:

    • Tailwind CSS(CDN / PostCSS / v4)
    • CSS Modules
    • Styled Components / Emotion
    • 纯 CSS / SCSS
    • CSS 变量 / 设计 Token
  4. 依赖分析:

    • 核心依赖(React、ReactDOM — 外部化,不打包)
    • UI 框架(Ant Design、shadcn/ui、Radix 等 — 保留)
    • 图表库、动画库等 — 保留并确认兼容性
    • 框架特定依赖(Next.js、Vercel — 移除)
  5. 静态资源盘点(对大型项目尤其重要):

    • 图片:格式、数量、总大小、引用方式(import / public / CDN)
    • 字体:本地文件 vs CDN 引用
    • 视频/音频等其他媒体
    • SVG:是否作为 React 组件使用

输出一份转换清单,列出需要处理的各项转换任务。

第 2 步:创建 Figma Make 项目结构

在目标目录 <output-dir>/<page-name>/ 下创建以下固定结构;最终可消费产物同步到 .axhub/make/artifacts/figma/<resource-id>/:

text
<page-name>/
├── index.tsx              # 项目主入口
├── style.css              # 根入口样式(桥接层)
├── canvas.fig             # Figma 二进制设计数据(第 5 步生成)
├── meta.json              # 项目元数据
├── ai_chat.json           # AI 聊天历史(可为空 {})
├── canvas.code-manifest.json  # CODE_FILE 索引清单(第 5 步生成)
├── package.json           # Vite 项目依赖声明
├── vite.config.ts         # Vite 构建配置
├── index.html             # Vite HTML 入口
├── images/                # 设计稿图片资源
└── src/
    ├── App.tsx            # Figma Make 导出薄壳(导出入口)
    ├── main.tsx           # Vite 挂载层
    ├── index.css          # Figma Make 入口样式
    ├── components/        # 可选;仅使用 template manifest 已存在的路径
    ├── pages/             # 多页面(如需要)
    └── styles/
        └── globals.css    # 全局样式 / 设计 Token

.axhub/make/project.json 中的资源元数据示例:

json
{
  "artifacts": {
    "figma": {
      "resourceId": "home",
      "canvasFigPath": ".axhub/make/artifacts/figma/home/canvas.fig",
      "metaPath": ".axhub/make/artifacts/figma/home/meta.json",
      "aiChatPath": ".axhub/make/artifacts/figma/home/ai_chat.json",
      "codeManifestPath": ".axhub/make/artifacts/figma/home/canvas.code-manifest.json",
      "imagesDir": ".axhub/make/artifacts/figma/home/images",
      "manifestPath": ".axhub/make/artifacts/figma/home/manifest.json"
    }
  }
}

职责分层约束(这是验收约束,不是建议):

文件职责不应包含
index.tsx项目主入口页面视觉实现
src/App.tsxFigma 导出薄壳,复用共享组件独立于根入口的业务逻辑
src/main.tsxVite 开发挂载,ReactDOM.createRoot业务代码
src/components/**页面视觉与交互的真实主体入口适配逻辑
style.css根入口样式转发大量业务样式
src/index.cssFigma 入口样式层独立于 style.css 的独立样式
第 3 步:迁移和改造源代码
3.1 收敛入口

将源项目的所有页面逻辑收敛为两个薄入口 + 一套共享组件。

根目录 index.tsx(项目主入口):

tsx
/**
 * 项目主入口
 */
import './style.css';
import React from 'react';
import App from './src/App';

export default function PageName() {
  return <App />;
}

src/App.tsx(Figma Make 导出壳):

tsx
/**
 * Figma Make 导出薄壳
 * 将根入口及其本地依赖机械同步到这个入口,
 * 或同步到 template manifest 中明确存在的其他逻辑路径。
 */
import React from 'react';
import './styles/globals.css';

export default function App() {
  return <main>{/* 机械同步或打包后的页面主体 */}</main>;
}

src/main.tsx(Vite 挂载层):

tsx
/**
 * Vite 开发挂载层
 * 仅用于 Figma Make 独立开发预览
 */
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import './index.css';

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

关键原则:

  • 两个入口(index.tsx 和 src/App.tsx)必须渲染相同的页面内容
  • 页面主体可以直接机械打包到 src/App.tsx,也可以拆分到 template manifest 已存在的逻辑路径
  • 不要硬编码 Dashboard.tsx、AppContent.tsx 或其他项目语义文件名;先检查模板再选择路径
  • 不要创建模板中不存在的路径后假设 pack 会自动加入
  • 若源项目有多页路由,收敛为单页面或选择核心页面
3.2 处理框架特定代码

根据源项目的框架类型,进行针对性清理:

Next.js 项目:

typescript
// ❌ 移除
"use client"
import { useRouter } from 'next/navigation'
import Image from 'next/image'
import Link from 'next/link'
import type { Metadata } from 'next'

// ✅ 替换
// 删除 "use client"
// 删除 useRouter,改用 useState 管理页面状态
<img> 替代 <Image>
<a> 替代 <Link>

AI Studio 项目:

typescript
// ❌ 移除
// Import Map 依赖(CDN URL)
// index.html 中的 <script type="importmap">

// ✅ 替换
// CDN 导入改为 npm 包导入
// process.env.* 改为 import.meta.env.VITE_*

通用清理:

typescript
// ❌ 移除
import { Analytics } from '@vercel/analytics/next'
// 所有 SSR 相关代码

// ✅ 保留
// React Hooks
// 第三方 UI 组件
// 样式文件导入
3.3 处理路径别名

将所有非标准路径别名转换为相对路径:

typescript
// 源代码中的 @/ 别名
import { Button } from '@/components/ui/button'

// 转换为相对路径(基于文件位置)
import { Button } from './components/ui/button'   // 从 src/App.tsx
import { Button } from '../components/ui/button'  // 从 src/pages/xxx.tsx

如果源项目使用 package@version 格式的导入(Figma Make 导出特征),改为裸包名:

typescript
// ❌
import { motion } from 'framer-motion@11.0.0'

// ✅
import { motion } from 'framer-motion'
3.4 处理大型静态资源

React 项目通常包含大量图片、字体和其他二进制文件。转换时需要妥善处理这些资源:

图片资源迁移:

源项目引用方式迁移策略
import logo from './assets/logo.png'保留在 src/assets/,import 路径不变
<img src="/images/hero.png"> (public 目录)复制到 images/,更新路径为 ./images/hero.png
<img src="https://cdn.example.com/img.png"> (CDN)保留 CDN 链接不变
SVG 作为 React 组件 (import { ReactComponent as Icon })保留在 src/components/ 或 src/assets/
CSS 中的 url('./bg.png')保持相对路径正确即可

images/ 目录规则:

  • Figma Make 的 images/ 目录存放设计稿关联图片,通常以 hash 命名(如 a3f2c1d.png)
  • 源项目的业务图片优先保留在 src/assets/,不必强制移到 images/
  • 只有从 Figma Make 导入时自带的 images/ 内容才需要保留原始 hash 名

字体文件:

  • 本地字体文件放入 src/assets/fonts/
  • 在 src/styles/globals.css 中用 @font-face 引用
  • Google Fonts 等 CDN 字体直接保留 @import url(...) 链接

大文件注意事项:

  • canvas.fig 是二进制文件(通常几百 KB 到几 MB),不能手动编辑,只能通过工具生成
  • 不要把源项目的 node_modules/、build/、.next/ 等目录复制到产物中
  • 如果源项目的图片总量超过 50 张或 10 MB,考虑精简为核心页面所需的子集
3.5 迁移样式

目标:根入口 style.css 和导出入口 src/index.css 使用同一套样式来源。

style.css(根入口样式):

css
@import "tailwindcss";

/* 如果有 globals.css,通过 import 引入 */
@import "./src/styles/globals.css";

src/index.css(Figma 导出样式):

css
@import "tailwindcss";

/* 保持与 style.css 一致的样式来源 */
@import "./styles/globals.css";

src/styles/globals.css(主样式文件):

将源项目中的以下内容迁移到此文件:

  • CSS 变量 / 设计 Token
  • @theme 定义(Tailwind v4)
  • 全局基础样式
  • 自定义字体引用
  • 自定义动画定义

样式迁移策略(详细指南见 references/style-migration.md):

源样式方案迁移方式
Tailwind CSS v4直接保留 @import "tailwindcss" + @theme
Tailwind CSS v3迁移到 v4 语法,@theme inline 替代 @apply
CSS Modules合并到组件同级 CSS 文件,改用带前缀的普通类名
Styled Components / Emotion提取为 CSS 类,移除 JS-in-CSS 依赖
纯 CSS / SCSS直接迁移,SCSS 编译为 CSS
CSS 变量保留到 globals.css 的 :root 或 @theme 中

大型样式文件注意事项:

  • Figma Make 导出的 src/index.css 有时是 Tailwind 的完整编译产物(可达数万行),不要直接使用它作为最终样式
  • 应以 src/styles/globals.css 为主样式源,src/index.css 仅做样式桥接
第 4 步:创建 Figma Make 元文件
4.1 meta.json
json
{
  "client_meta": {
    "background_color": { "r": 0.96, "g": 0.96, "b": 0.96, "a": 1 },
    "thumbnail_size": { "width": 400, "height": 300 },
    "render_coordinates": { "x": 0, "y": 0, "width": 1280, "height": 960 }
  },
  "file_name": "<项目显示名称>",
  "developer_related_links": [],
  "exported_at": "<ISO 8601 时间>"
}
  • file_name:最终导出的 .fig 文件显示名称
  • render_coordinates:页面视口尺寸,根据实际页面调整 width 和 height(详见 references/meta-json-spec.md)
  • exported_at:使用当前 ISO 8601 时间(new Date().toISOString())
4.2 ai_chat.json
json
{}

新建项目时为空对象即可。

4.3 package.json
json
{
  "name": "<page-name>",
  "private": true,
  "version": "0.0.1",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
  },
  "devDependencies": {
    "vite": "^6.0.0",
    "@vitejs/plugin-react": "^4.0.0",
    "typescript": "^5.0.0"
  }
}

依赖规则:

  • 排除:react、react-dom、next、next-*、@vercel/*、next-themes
  • 保留:所有其他运行时依赖(UI 库、工具库、图标库等)
  • 使用项目所用的包管理器安装依赖(npm / yarn / pnpm 均可)
4.4 vite.config.ts
typescript
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      '@': '/src'
    }
  }
});
4.5 index.html
html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title><项目名称></title>
  </head>
  <body>
    <div id="root"></div>
    <script type="module" src="/src/main.tsx"></script>
  </body>
</html>
4.6 images/ 目录

创建空的 images/ 目录。此目录用于存放 Figma Make 设计稿关联的图片资源。

  • 如果是从 Figma Make 导入的项目,保留 images/ 下已有的 hash 命名图片
  • 源项目的业务图片建议保留在 src/assets/ 中,不必移入 images/
Show full SKILL.md (380 more words)Show less
第 5 步:生成 canvas.fig

在执行任何带 --prune-missing 的命令前,必须先完成导出壳和模板路径映射。不要用正式 canvas.fig 直接试错。

使用本技能自带的 canvas-fig-sync.mjs 脚本生成可导出的 .fig 文件。

以下命令假设你当前在终端中定位在目标项目根目录,且本技能的存放位置为 <skill-dir>:

首次生成(没有现有 canvas.fig)按以下顺序执行:

  1. inspect 空白模板,确认本次准备使用的逻辑路径确实存在。
  2. 在目标源码目录内创建并保留模板兼容的 src/** 导出壳。
  3. 将空白模板复制为候选文件,在候选文件上 pack。
  4. 验证候选文件的节点、引用和可运行性,通过后再替换正式 canvas.fig。
bash
# ① 检查模板已有 CODE_FILE 路径
node <skill-dir>/scripts/canvas-fig-sync.mjs inspect \
  --fig <skill-dir>/assets/empty-canvas.fig \
  --manifest <artifact-dir>/template.code-manifest.json

# ② 使用 Node 跨平台复制模板,避免覆盖正式产物
node -e "require('node:fs').copyFileSync(process.argv[1], process.argv[2])" \
  <skill-dir>/assets/empty-canvas.fig \
  <artifact-dir>/canvas.candidate.fig

# ③ 将已经对齐模板路径的源码写入候选文件
node <skill-dir>/scripts/canvas-fig-sync.mjs pack \
  --fig <artifact-dir>/canvas.candidate.fig \
  --from <source-dir> \
  --prune-missing \
  --sanitize-for-export \
  --manifest <artifact-dir>/canvas.pack-manifest.json

# ④ 生成候选文件的最终 CODE_FILE 清单
node <skill-dir>/scripts/canvas-fig-sync.mjs inspect \
  --fig <artifact-dir>/canvas.candidate.fig \
  --manifest <artifact-dir>/canvas.code-manifest.json

<source-dir> 是包含持久化 src/App.tsx 的页面源码目录;<artifact-dir> 是 .axhub/make/artifacts/figma/<resource-id>/。两者通常不是同一个目录。Make 服务端下载时会再次以 <source-dir> 执行 pack,因此不能在首次生成后删除导出壳。

在提升候选文件为正式 canvas.fig 前,读取两个 manifest 并强制满足:

  • canvas.pack-manifest.json.updatedLogicalPathCount > 0
  • canvas.code-manifest.json.summary.totalCodeFiles > 0
  • canvas.code-manifest.json.entries 包含 App.tsx 以及 App.tsx 的全部本地相对依赖
  • pack warnings 中不存在 Unresolved relative import
  • 除 App.tsx 外,只要求本次导出入口实际引用的模板已有路径;不要要求固定存在 Dashboard.tsx

任何一项不满足都必须停止,不要覆盖已有 canvas.fig,也不要把空壳记录为成功导出。验证通过后再用跨平台文件操作把 canvas.candidate.fig 替换为 canvas.fig。

参数说明:

  • <source-dir>:页面源码目录;脚本会从其 src/ 子目录读取代码
  • <artifact-dir>:Figma Make 资产目录,不等同于源码目录
  • --prune-missing:裁掉磁盘上不存在的旧 CODE_FILE 节点
  • --sanitize-for-export:清空旧聊天/历史缓存,重建 importedCodeFiles

canvas.fig 关键特性:

  • fig-make 专用二进制容器,内含 Figma 节点树和 CODE_FILE 节点;不是普通 ZIP
  • 不可手动编辑,仅能通过 canvas-fig-sync.mjs 的 pack / inspect / extract 命令操作
  • 文件大小通常在几百 KB 到几 MB,取决于代码文件数量
  • 每次页面内容变更后需要重新 pack,否则导出的 .fig 会与当前页面不一致
第 6 步:验证清单

转换完成后,逐项检查:

结构验证:

  • 项目目录符合固定结构(index.tsx + src/App.tsx + src/main.tsx + src/components/)
  • index.tsx 顶部有职责注释
  • src/App.tsx 顶部有职责注释:"Figma Make 导出薄壳"
  • src/main.tsx 顶部有职责注释:"Vite 挂载层"
  • 两个入口渲染同一套 src/components/** 中的共享组件

元文件验证:

  • meta.json 存在,包含 file_name、exported_at、client_meta
  • ai_chat.json 存在(至少为 {})
  • package.json 存在,不包含 react / react-dom 依赖
  • vite.config.ts 存在
  • index.html 存在
  • images/ 目录存在

canvas.fig 验证:

  • canvas.fig 存在
  • canvas.code-manifest.json 存在
  • inspect 命令可成功执行
  • pack manifest 的 updatedLogicalPathCount > 0
  • summary.totalCodeFiles > 0
  • manifest 包含入口及其全部本地相对依赖
  • pack warnings 不包含 Unresolved relative import
  • 用 extract 反向提取到临时目录,关键源码与导出壳内容一致
  • 实际下载接口返回的二进制与正式 canvas.fig 一致;不能只以 probe.hasMakeAssets === true 作为内容验收

样式验证:

  • style.css 和 src/index.css 使用同一套样式来源
  • 不直接搬运 Tailwind 构建产物作为最终样式

依赖验证:

  • 不依赖 @/ 或 package@version 别名才能运行
  • 不残留 Next.js / Vercel 特定代码
  • 所有必要依赖已安装

资源完整性验证:

  • 所有图片引用路径正确(无 404 断链)
  • 字体文件已复制或 CDN 链接可访问
  • 不包含 node_modules/、build/、.next/ 等冗余目录

渲染验证:

在目标项目目录中:

bash
cd <output-dir>/<page-name>
npm install   # 或 yarn / pnpm install
npm run dev   # 启动 Vite 开发服务器
# 浏览器中检查页面渲染是否正常
  • 页面正常渲染
  • 无控制台错误
  • 主视觉与原项目基本一致

常见场景

场景 A:纯 React + Vite 项目

这是最简单的场景,因为源项目和目标结构都基于 Vite。

  1. inspect 模板,确认可用的 CODE_FILE.logicalPath
  2. 保留原业务入口,创建模板兼容的薄导出壳
  3. 将业务主体及本地依赖机械打包到 src/App.tsx,或同步到本次选定的模板已有路径
  4. 创建根目录 index.tsx
  5. 迁移样式到 src/styles/globals.css
  6. 补齐元文件
  7. 生成 canvas.fig
场景 B:Next.js 项目(V0 等)
  1. 移除所有 Next.js 特定代码("use client"、next/image、next/link、路由等)
  2. 将 app/page.tsx 或 pages/index.tsx 的内容迁移到 src/components/
  3. 将 app/globals.css 迁移到 src/styles/globals.css
  4. 将 public/ 下的静态资源迁移到 src/assets/ 或 images/
  5. 排除 Next.js 专属依赖(next、@vercel/*),保留 UI 组件依赖
  6. 创建双入口(index.tsx + src/App.tsx),补齐元文件
场景 C:AI Studio 项目
  1. 从 index.html 的 Import Map 提取依赖,转为 npm 包安装
  2. 提取 <style> 标签内容到 src/styles/globals.css
  3. process.env.* 改为 import.meta.env.VITE_*
  4. CDN 图片引用可保留,或下载到 src/assets/
  5. 创建双入口,补齐元文件
场景 D:已有 Figma Make 导入的项目(补齐导出能力)

此时重点不是从头创建结构,而是确保现有项目的导出壳子与当前页面同步。

  1. 检查 index.tsx(根入口)和 src/App.tsx(导出壳子)是否同步
  2. 如果不同步,让 src/App.tsx 复用根入口的共享组件
  3. 不要删除已有的 canvas.fig、meta.json、images/ 等原始资产
  4. pack 到候选文件并完成严格验证,不要直接覆盖原始 canvas.fig
  5. 验证通过后替换正式文件,刷新 canvas.code-manifest.json 和 meta.json.exported_at

常见注意点

产物和资源
  • 不要把 src/index.css(Figma Make 的 Tailwind 构建产物)直接当最终 style.css,它可能有数万行
  • 如果目录内已有 canvas.fig、meta.json、images/ 等原始资产,不要删除它们
  • images/ 下的文件通常是 hash 命名的 Figma 关联图片,不要随意重命名
  • canvas.fig 是二进制文件,不能手动编辑
入口同步
  • 修改根目录页面后,必须同步更新 src/App.tsx,否则导出的 .fig 会与当前页面不一致
  • 两个入口长期不同步是最常见的"漂移"问题 — 保持 src/App.tsx 尽量薄,只做包装
  • 默认模板不能自动新增任意本地文件路径;新增拆分文件前先检查 template manifest
  • inspect 成功但 totalCodeFiles 为 0、入口依赖缺失或存在 unresolved import,仍然是失败产物
依赖和路径
  • 不要继续保留对 package@version alias 的运行时依赖
  • 不要把多页面路由壳层原封不动塞进最终页面组件
  • @/ 别名应通过 vite.config.ts 的 resolve.alias 配置,而非依赖外部构建环境

© lintendo, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 6 other files (scripts, references, assets) in skills/react-to-figma-make of lintendo/Axhub-Skills.

  • SKILL.md
  • assets/empty-canvas.fig
  • references/meta-json-spec.md
  • references/project-structure.md
  • references/style-migration.md
  • scripts/canvas-fig-sync.mjs
  • scripts/package.json

Open the folder on GitHubat commit 1e1c5bc

Compare with similar skills

React To Figma Make next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

React To Figma Make compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
React To Figma Make this skilllintendo/Axhub-Skills127—~4.2kAutomated safety check: PassMIT
Chakra UI v3 Builderchakra-ui/chakra-ui41k—~3.1kAutomated safety check: PassMIT
Creative Tim UI Blockscreativetimofficial/ui12k—~2.1kAutomated safety check: NotesMIT
Design To CodeMigoXLab/coderio1142 repos~1.2kAutomated safety check: PassApache-2.0
Convex Quickstartspokvulcan/poker-planning1146 repos~3.5kAutomated safety check: NotesMIT
DaleuiDaleStudy/daleui119—~675Automated safety check: PassMIT

Similar skills

  • Chakra UI v3 Builder

    chakra-ui/chakra-ui

    Builds responsive, accessible Chakra UI v3 components and layouts, sets up Chakra in new or existing projects, and designs themes with tokens, semantic tokens and recipes.

    41k GitHub stars~3.1k tokensUpdated 2 days ago
    Frontend & DesignAuto-check passed
  • Creative Tim UI Blocks

    creativetimofficial/ui

    Helps install, generate and review Creative Tim UI blocks: shadcn/ui-based React and Tailwind sections that follow a restrained, production-minded design philosophy.

    12k GitHub stars~2.1k tokensUpdated 6 mo ago
    Frontend & DesignAuto-check: notes
  • Design To Code

    MigoXLab/coderio

    Pixel-perfect Figma to React conversion using coderio. An agent skill from MigoXLab/coderio.

    114 GitHub starsUsed in 2 repos~1.2k tokens
    Frontend & DesignAuto-check passed
  • Convex Quickstart

    spokvulcan/poker-planning

    Creates or adds Convex to an app. An agent skill from spokvulcan/poker-planning.

    114 GitHub starsUsed in 6 repos~3.5k tokens
    Frontend & DesignAuto-check: notes
  • Daleui

    DaleStudy/daleui

    Use the daleui React design system with semantic Panda CSS tokens and accessible components.

    119 GitHub stars~675 tokensUpdated today
    Frontend & DesignAuto-check passed
  • Spotpatch

    huanglvjing/spotpatch

    为 React 项目建立从浏览器页面元素到精确 JSX/TSX 源码、结构化上下文与可审阅修改的 SpotPatch 工作流。用户提到 SpotPatch、截图沟通前端修改、页面元素定位源码、Vite 或 Next.js 接入、组件数据链路、结构化 Prompt、AI 补丁审阅、安装检查或故障排查时使用此技能。

    134 GitHub stars~998 tokensUpdated 10 days ago
    Frontend & DesignAuto-check passed

More from lintendo/Axhub-Skills

All 13 skills in this repo
  • Search Design System

    lintendo/Axhub-Skills

    A skill your agent uses when selecting an existing design system or theme for a product, page, prototype, or implementation through Axhub design knowledge indexes; not when creating or updating a…

    127 GitHub stars~643 tokensUpdated 1 mo ago
    Auto-check passed
  • Axhub Prototype Context

    lintendo/Axhub-Skills

    A skill your agent uses when an annotated prototype URL exposes PRD, directory, annotation, or source context that an AI Agent needs for review, implementation planning, production work, source…

    127 GitHub stars~684 tokensUpdated 1 mo ago
    Auto-check passed
  • Extract Axure Data

    lintendo/Axhub-Skills

    Extract structured data from Axure prototypes using Playwright — screenshots, design tokens, interaction maps, annotations, and page text.

    127 GitHub stars~1.9k tokensUpdated 1 mo ago
    Auto-check: warnings
  • Clone Page

    lintendo/Axhub-Skills

    高精度克隆网页。使用 Playwright 渐进式采集页面数据(DOM 结构、样式、截图、资源), 然后分阶段构建完整的 HTML/CSS 还原。支持快速还原和高精度还原两种模式。

    127 GitHub stars~1.3k tokensUpdated 1 mo ago
    Auto-check passed
  • Extract Page Data

    lintendo/Axhub-Skills

    Extract structured data from any web page using Playwright — screenshots, design tokens, page text as Markdown, interactive element maps, and full page data packs.

    127 GitHub stars~2.7k tokensUpdated 1 mo ago
    Auto-check: warnings
  • Figma Content Operator

    lintendo/Axhub-Skills

    用于处理涉及检查、读取、创建、编辑、导出或代码映射的 Figma 内容任务,也用于将 HTML/React/Vue 等网页复制到 Figma,尤其适用于当前选区、设计系统、Figma MCP、Drafito、Figwright 或需要避免 MCP 工具污染上下文的场景。当用户需要可批注 Figma 链接或要求同时绑定工作目录时,也应与 axhub-commentary 组合。

    127 GitHub stars~630 tokensUpdated 1 mo ago
    Auto-check passed

Questions about React To Figma Make

What does React To Figma Make do?

A skill your agent uses when 需要把现有 React、Vite、Next.js、V0 或 AI Studio 页面转换为 Figma Make 可导入的 .fig 资产,或补齐、更新、验证已有 Figma Make 导出壳和 canvas.fig。. React To Figma Make is an agent skill from lintendo/Axhub-Skills.

When should I use React To Figma Make?

React To Figma Make fits situations like: 需要把现有 React、Vite、Next.js、V0 或 AI Studio 页面转换为 Figma Make 可导入的 .fig 资产,或补齐、更新、验证已有 Figma Make 导出壳和 canvas.fig.

How do I install React To Figma Make in Claude Code?

Run `npx skills add lintendo/Axhub-Skills --skill react-to-figma-make -a claude-code`. Or copy the skill folder (skills/react-to-figma-make in lintendo/Axhub-Skills) into .claude/skills/react-to-figma-make in your project. Claude Code loads it when a task matches its description.

How do I install React To Figma Make in Codex?

Run `npx skills add lintendo/Axhub-Skills --skill react-to-figma-make -a codex`. Or copy the skill folder (skills/react-to-figma-make in lintendo/Axhub-Skills) into .agents/skills/react-to-figma-make in your project. Codex loads it when a task matches its description.

Can I use React To Figma Make in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add lintendo/Axhub-Skills --skill react-to-figma-make -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/react-to-figma-make, .gemini/skills/react-to-figma-make, .github/skills/react-to-figma-make and .opencode/skills/react-to-figma-make in your project.

What does React To Figma Make need to run?

Going by SKILL.md and its folder, React To Figma Make needs JavaScript for the scripts in its folder and the command-line tools its instructions call (node and npm). Our summary lists: Node.js.

Does React To Figma Make access the network?

SKILL.md contains no URLs. Its commands use npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is React To Figma Make safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does React To Figma Make use?

React To Figma Make is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does React To Figma Make use?

About 4.2k tokens (SKILL.md is roughly 17k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.3k tokens, read only when the agent opens those files.

What are the alternatives to React To Figma Make?

Skills that share tags, products or a category with React To Figma Make: Chakra UI v3 Builder (chakra-ui/chakra-ui, 41k stars), Creative Tim UI Blocks (creativetimofficial/ui, 12k stars), Design To Code (MigoXLab/coderio, 114 stars) and Convex Quickstart (spokvulcan/poker-planning, 114 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains React To Figma Make?

lintendo (a GitHub user) maintains it in lintendo/Axhub-Skills, which has 127 GitHub stars. The repository holds 13 skills in this directory. The repository was last updated on August 21, 2026.

Source: lintendo/Axhub-Skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.