react-vite-dashboard
它能做什么
这项技能使用 React、Vite 和数据加载工具,根据 Stitch 页面构建仪表盘网页应用。适合制作数据密集型管理或分析界面的前端开发者。
适用场景
- ✓当你想根据 Stitch 设计构建数据仪表盘的时候。
- ✓当你的仪表盘需要从 API 加载并刷新数据的时候。
- ✓当你希望颜色和间距遵循 DESIGN.md 文件时。
技能链接
https://github.com/google-labs-code/stitch-skills/blob/main/plugins/stitch-build/skills/react-vite-dashboard/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请根据我的 Stitch 页面构建一个 React 和 Vite 仪表盘,并从我们的 API 加载销售数据。”
每周 5 个新技能,1 分钟读完。
工作原理
它下载 Stitch 页面,把设计令牌映射为 CSS 变量,并将代码拆分为组件、页面和数据钩子。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Stitch to React + Vite Dashboard
You are a frontend engineer building data-dense dashboards from Stitch screens. Target stack: React 18, Vite, TypeScript, TanStack Query, React Router, and optional ethers v6 or viem for on-chain reads.
Prerequisites
- Stitch MCP configured (setup guide)
- A project
DESIGN.md(see thedesign-mdskill) for token fidelity - Vite + React + TypeScript scaffold (
npm create vite@latest)
Workflow
- Discover MCP prefix — run
list_tools, note the Stitch prefix (e.g.stitch:). - Fetch screen —
[prefix]:get_screenwith project and screen IDs. - Download assets — persist HTML/screenshot under
.stitch/designs/{screen}.htmland.png. - Read DESIGN.md — map
colors.*,typography.*,spacing.*to CSS variables insrc/index.css. - Generate components — split into
src/components/,src/pages/,src/hooks/. - Wire data — use TanStack Query for async fetches; keep presentational components pure.
HTML → React mapping
| Pattern | Implementation |
|---|---|
| Layout grid / flex | Tailwind utilities or CSS modules aligned to DESIGN.md spacing tokens |
| Cards / panels | <section> with tokenized border-radius and elevation fallbacks for forced-colors |
| Tables | Semantic <table> or TanStack Table; never div-only grids for tabular data |
| Buttons | <button type="button"> with visible focus ring (preserve browser default unless DESIGN.md defines focus tokens) |
| Forms | <label htmlFor> + <input id>; associate errors with aria-describedby |
| Loading | Skeleton components; aria-busy on containers during fetch |
| Wallet connect | Isolate in WalletProvider; never embed private keys in generated code |
DESIGN.md integration
/* src/index.css — example token bridge */
:root {
--color-primary: /* from DESIGN.md colors.primary */;
--font-body: /* typography.body-md.fontFamily */;
}
Run the design.md linter locally before shipping UI:
npx @google/design.md lint DESIGN.md
Web3 dashboard conventions
- Read-only contract calls via
useReadContract(viem/wagmi) or ethersContract+ TanStack QueryqueryFn. - Format token amounts with
formatUnits; show network name and chain ID in settings footer. - Surface transaction errors in plain language; link to block explorer when
txHashexists. - Gas-sensitive flows: batch reads, avoid redundant
eth_callin render loops.
File structure
src/
├── components/ # Presentational UI from Stitch
├── pages/ # Route-level screens
├── hooks/ # useQuery wrappers, wallet hooks
├── lib/ # ABI helpers, formatters
└── styles/ # Token CSS variables
Quality checklist
- WCAG 2.2 AA: contrast from DESIGN.md component pairs passes linter
- Keyboard navigable: focus order matches visual order
- Responsive: test at 375px and 1280px widths
- No secrets in repo: RPC URLs from env (
VITE_*prefix only for public endpoints) - TypeScript strict: no
anyon contract ABIs
Stitch docs note
When following links on stitch.withgoogle.com/docs, use the full https://stitch.withgoogle.com/docs/... URL if relative navigation redirects incorrectly.
常见问题
什么是 TanStack Query?
它是一个为 React 页面加载、缓存和刷新数据的库。
需要 DESIGN.md 文件吗?
有这个文件效果最好,因为这项技能会用它来匹配颜色、字体和间距。
它支持区块链数据吗?
支持。它提到可以选择使用 ethers 或 viem 读取链上数据。
详情
作者的原始描述
Convert Stitch designs into production React + Vite dashboards with TanStack Query, accessible tokens from DESIGN.md, and Web3-ready patterns (ethers/viem).
热度
- GitHub 星标
- 8.7k
- 排名
- #12339
- 许可证
- Apache-2.0
- 更新时间
- 2026/8/17
评论
- …
同一仓库的更多技能
stitch::react-components
8.7k帮你的智能体把 Stitch 设计转换为 React 和 Vite 组件,或更新现有组件以匹配最新设计,并进行检查。
stitch::react-native
8.7k帮你的智能体把 Stitch 网页设计转换为手机应用用的 React Native 组件,或更新现有的移动端界面以匹配较新的设计。
shadcn-ui
8.7k帮你的智能体查找、安装并自定义 shadcn/ui 组件,这是一组使用 Radix 或 Base UI 以及 Tailwind CSS 构建、可直接复制到项目中的界面组件。
stitch::code-to-design
8.7k帮你的智能体把现有的网页应用(例如 React、Vue 或 Angular 应用)转移到 Stitch 设计中,让你可以在那里继续改进。