Use for interactive HTML prototypes (交互原型) with the real LobeHub UI stack. Excludes production UI implementation.
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-design-prototype-3e2ff7104101 ,按照其中的说明把「design-prototype」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
One HTML file, double-click to open, fully interactive, rendered by the actual
design system (@lobehub/ui 5.x + antd 6 + antd-style tokens, exact versions from
this repo's node_modules) — while the source stays production-style React
(import { Block } from '@lobehub/ui', createStyles(({ css, token }) => …), hooks,
memo). Promotion to production is mostly "split into files", not "rewrite".
Prototype code may be quick-and-dirty (one file, no i18n, inline data) — but the interaction must be complete: states, transitions, and affordances are the point of a prototype, not its code style.
one-time (~2s, cached): scripts/build-runtime.sh → lobe-prototype-runtime.js (IIFE global)
+ vendored babel.min.js
per prototype (no build): single HTML = <script runtime> + babel-standalone
+ <script type="text/babel"> with production-style React
react, react-dom/client, @lobehub/ui, @lobehub/ui/base-ui,
antd (curated subset), antd-style, lucide-react from the repo's own
node_modules — so tokens/components/versions match production, and react/emotion/
theme-context are singletons by construction.window.require shim + babel's transform-modules-commonjs lets the
prototype keep real import statements.ThemeProvider themeMode="auto" → light/dark follow the OS.⚠️ Don't re-attempt the pure-CDN route (esm.sh import maps). It was tried and rejected: esm.sh's CJS named-export analysis fails serially across antd's dep chain (
@ant-design/fast-color→@ant-design/colors→@rc-component/qrcode→ …), and?bundleleaks an unversionedreact-is404. Whack-a-mole, not a foundation.
Build the runtime into the prototype's directory (any dir works; /tmp is fine):
bash .agents/skills/design-prototype/scripts/build-runtime.sh /tmp/my-proto
Skip if lobe-prototype-runtime.js + babel.min.js are already there and the
design-system versions haven't bumped.
Copy references/template.html into the same dir,
rename, and replace the sample App with the real surface. Keep the runtime shim
block untouched.
Open it (open /tmp/my-proto/xxx.html) — no server, no build.
Headless-check it renders with zero console errors (the repo's e2e Playwright works):
// node /tmp/check.mjs — adjust paths
import { chromium } from '<repo>/e2e/node_modules/playwright/index.mjs';
const b = await chromium.launch();
const p = await b.newPage();
const errs = [];
p.on('pageerror', (e) => errs.push(String(e)));
await p.goto('file:///tmp/my-proto/xxx.html');
await p.waitForSelector('#root *', { timeout: 30000 });
await p.screenshot({ path: '/tmp/proto.png' }); // Read the screenshot yourself
console.log('errors:', errs);
await b.close();
Then Read the screenshot — a prototype is a visual deliverable; don't ship it
sight-unseen. Check light + dark (emulate prefers-color-scheme) and a narrow
viewport if the surface has a mobile story.
See assets/entry.mjs — the single source of truth. Currently:
@lobehub/icons: Amp, ClaudeCode, Codex, HermesAgent, OpenClaw, OpenCode@lobehub/ui: ActionIcon, Alert, Avatar, Block, Button, Center, Collapse,
ConfigProvider, DraggablePanel, Drawer, DropdownMenu, Empty, Flexbox, Highlighter, Hotkey, Icon,
Image, Input, InputNumber, Markdown, Modal, MotionProvider, NeuralNetworkLoading, Popover,
ScrollShadow, SearchBar, Segmented, Select, Skeleton, SortableList, Tabs, Tag,
Text, TextArea, ThemeProvider, Tooltip@lobehub/ui/base-ui: full namespace (Select, Modal, DropdownMenu, Switch, Toast,
FloatingSheet, …)antd: App, Badge, Checkbox, Divider, Dropdown, Progress, Radio, Slider, Space,
Steps, Tableantd-style, lucide-react, motion/react, motion/react-m, react,
react/jsx-runtime, react-dom, react-dom/client: full namespacesMissing a component → add to entry.mjs, rerun the build script (~2s). Sizes:
curated ≈ 16MB (fine from disk); a full export * from '@lobehub/ui' works too
(≈ 27MB) if you'd rather never curate.
Switch lives in @lobehub/ui/base-ui, not the root package (as do the other
base-ui primitives). Importing it from the root fails the runtime build.createStyles (runtime), not createStaticStyles — static extraction
needs a build step. This is the one sanctioned deviation from production style;
note it when handing the prototype to an implementer.<script src> chokes on export.Text type accepts only secondary|success|warning|danger|info; Tag color has
no primary (DESIGN.md "Applying tokens in components").A prototype is a surface — the ux checklists apply to what it demonstrates:
DraggablePanel
(collapse + drag-resize come free), loading follows the ux skill's feedback §4.1
scenario table (skeleton / base-ui Spin, variant="network" only for AI work), modals via createModal-style flows.cursor: zoom-in with no zoom, keycap
chips with no keys) — in an interactive prototype a dead affordance is a spec bug.