npx skills add https://github.com/b-open-io/prompts --skill generative-ui生成式 UI 是指 AI 根据预定义组件目录生成JSON 规范。AI 从不编写任意的 JSX——它生成结构化的 JSON,然后由渲染器将其转换为真实的 UI。这为您带来:
这不是“AI 编写任意代码”。它是在严格边界内的结构化生成。
| 使用静态组件的情况 | 使用生成式 UI 的情况 |
|---|---|
| 布局在构建时已知 | 布局因用户/上下文而异 |
| 内容是固定的或由 CMS 驱动 | AI 决定显示什么内容 |
| 性能至关重要(SSR/SSG) | 个性化比首次输入延迟更重要 |
| 简单的 CRUD 表单 | 根据模式生成的动态表单 |
| 营销/落地页面 | 带有丰富卡片响应的 AI 聊天 |
决策规则: 如果由人类设计一次布局且很少更改,则使用静态组件。如果布局需要适应数据、用户上下文或 AI 决策,则使用生成式 UI。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
核心概念(参见 json-render-core 技能):
defineSchema() 定义规范必须遵循的结构defineCatalog() 将组件名称映射到经过 Zod 验证的定义defineRegistry() 将目录条目映射到渲染器实现工作流程:
defineSchema 定义一个模式defineCatalog 创建一个目录(仅选择您需要的组件)| 需求 | 包 | 技能 |
|---|---|---|
| Web 应用 UI | @json-render/react | json-render-react |
| shadcn/ui 组件 | @json-render/shadcn | json-render-shadcn |
| 移动端原生 | @json-render/react-native | json-render-react-native |
| 视频合成 | @json-render/remotion | json-render-remotion |
| HTML 邮件 | @json-render/react-email | json-render-react-email |
| OG/社交图片 | @json-render/image | json-render-image |
| Vue Web 应用 | @json-render/vue | (暂无技能) |
| PDF 文档 | @json-render/react-pdf | (暂无技能) |
请始终调用特定渲染器的技能以获取实现细节。本技能涵盖何时以及为何使用;渲染器技能涵盖如何实现。
shadcnComponentDefinitions 中明确选择组件。切勿将所有 36 个组件全部引入您的目录。@json-render/shadcn/catalog(服务器端安全的模式)和 @json-render/shadcn(React 实现)。在生成式 UI 工作流中生成视觉资源:
| 资源类型 | 技能 | 用例 |
|---|---|---|
| 横幅图片、背景 | generate-image | 仪表板头部、卡片背景 |
| 徽标、矢量图形 | generate-svg | 生成 UI 中的品牌元素 |
| 应用图标 | generate-icon | 平台特定的图标集 |
| 后期处理 | edit-image | 对生成的图片进行裁剪、调整大小、风格迁移 |
| 视频背景 | generate-video | 带有 AI 视频的 Remotion 合成 |
| 风格探索 | browsing-styles | 在生成前浏览 169 种视觉风格 |
流程: browsing-styles(选择风格) -> generate-image(创建) -> edit-image(优化) -> optimize-images(压缩)
AI 流式传输包含 Card、Table、Chart 等组件的规范。<Renderer> 组件在聊天消息中内联渲染它们。
用户偏好 + 数据 -> AI 生成仪表板规范 -> 渲染器通过实时数据绑定显示它。
模式定义 -> AI 根据自然语言生成表单规范 -> 表单渲染并带有验证。
相同的目录定义,不同的注册表。一份规范可渲染为 Web(React)、移动端(React Native)和电子邮件(React Email)。
生成式 UI 规范可以通过 MCP 应用 直接交付到聊天主机(Claude、ChatGPT、VS Code Copilot)内部。json-render React 渲染器运行在通过 Vite 打包的单文件 HTML 中,作为 ui:// 资源提供。
交付路径:
structuredContent 返回(主机在 UI 中渲染的结构化 JSON 响应,与模型看到的文本分开)ontoolresult 接收它<Renderer> 组件将规范渲染为交互式 UI这结合了生成式 UI 的护栏约束输出与 MCP 应用的上下文保持和双向数据流。无需切换标签页,无需单独的 Web 应用。
AI 生成规范 → MCP 工具返回 structuredContent
→ 主机在 iframe 中渲染 ui:// 资源
→ 视图使用 json-render <Renderer> 渲染规范
→ 用户交互 → 视图调用工具 → 新规范
要构建交付生成式 UI 的 MCP 应用,请使用 Skill(bopen-tools:mcp-apps)。
| 渲染器 | 包 | 交付渠道 |
|---|---|---|
| Web | @json-render/react | Web 应用 或 MCP 应用(ui:// 资源) |
| shadcn/ui | @json-render/shadcn | Web 应用 或 MCP 应用(ui:// 资源) |
| 移动端 | @json-render/react-native | React Native 应用 |
| 视频 | @json-render/remotion | 视频文件 |
| 邮件 | @json-render/react-email | 电子邮件(HTML) |
| 图片 | @json-render/image | 图片文件(PNG/SVG) |
MCP 应用交付适用于任何面向浏览器的渲染器(React、shadcn)。使用 Vite + vite-plugin-singlefile 将渲染器 + 目录 + 注册表打包到单个 HTML 文件中,作为 ui:// 资源提供。
references/renderer-guide.md —— 深入探讨每个渲染器的 API 和模式references/component-libraries.md —— 可用的组件和自定义组件模式每周安装数
1
代码仓库
GitHub 星标数
7
首次出现
1 天前
安全审计
已安装于
windsurf1
amp1
cline1
opencode1
cursor1
kimi-cli1
Generative UI is AI generating JSON specs constrained to a catalog of predefined components. The AI never writes arbitrary JSX — it produces structured JSON that a renderer turns into real UI. This gives you:
This is NOT "AI writes arbitrary code." It's structured generation within strict boundaries.
| Use Static Components When | Use Generative UI When |
|---|---|
| Layout is known at build time | Layout varies per user/context |
| Content is fixed or CMS-driven | AI determines what to show |
| Performance is critical (SSR/SSG) | Personalization matters more than TTI |
| Simple CRUD forms | Dynamic forms from schemas |
| Marketing/landing pages | AI chat with rich card responses |
Decision rule: If a human designs the layout once and it rarely changes, use static. If the layout adapts to data, user context, or AI decisions, use generative UI.
Core concepts (see json-render-core skill):
defineSchema() defines the structure specs must followdefineCatalog() maps component names to Zod-validated definitionsdefineRegistry() maps catalog entries to renderer implementationsWorkflow:
defineSchemadefineCatalog (pick only the components you need)| Need | Package | Skill |
|---|---|---|
| Web app UI | @json-render/react | json-render-react |
| shadcn/ui components | @json-render/shadcn | json-render-shadcn |
| Mobile native | @json-render/react-native | json-render-react-native |
| Video compositions |
Always invoke the renderer-specific skill for implementation details. This skill covers when and why; the renderer skills cover how.
shadcnComponentDefinitions. Never spread all 36 into your catalog.@json-render/shadcn/catalog (server-safe schemas) and @json-render/shadcn (React implementations).Generate visual assets within generative UI workflows:
| Asset Type | Skill | Use Case |
|---|---|---|
| Hero images, backgrounds | generate-image | Dashboard headers, card backgrounds |
| Logos, vector graphics | generate-svg | Brand elements within generated UI |
| App icons | generate-icon | Platform-specific icon sets |
| Post-processing | edit-image | Crop, resize, style-transfer on generated images |
| Video backgrounds | generate-video |
Pipeline: browsing-styles (pick style) -> generate-image (create) -> edit-image (refine) -> optimize-images (compress)
AI streams a spec containing Card, Table, Chart components. The <Renderer> component renders them inline in the chat message.
User preferences + data -> AI generates a dashboard spec -> Renderer displays it with real-time data binding.
Schema definition -> AI generates form spec from natural language -> Form renders with validation.
Same catalog definition, different registries. One spec renders to web (React), mobile (React Native), and email (React Email).
Generative UI specs can be delivered directly inside chat hosts (Claude, ChatGPT, VS Code Copilot) via MCP Apps. The json-render React renderer runs inside a Vite-bundled single-file HTML served as a ui:// resource.
Delivery path:
structuredContent (a structured JSON response the host renders in the UI, separate from the text the model sees)ontoolresult<Renderer> component renders the spec as interactive UIThis combines generative UI's guardrailed output with MCP Apps' context preservation and bidirectional data flow. No tab switching, no separate web app.
AI generates spec → MCP tool returns structuredContent
→ Host renders ui:// resource in iframe
→ View renders spec with json-render <Renderer>
→ User interacts → View calls tools → fresh spec
For building MCP Apps that deliver generative UI, use Skill(bopen-tools:mcp-apps).
| Renderer | Package | Delivery Channel |
|---|---|---|
| Web | @json-render/react | Web app or MCP App (ui:// resource) |
| shadcn/ui | @json-render/shadcn | Web app or MCP App (ui:// resource) |
| Mobile | @json-render/react-native | React Native app |
| Video | @json-render/remotion |
MCP Apps delivery is available for any renderer that targets the browser (React, shadcn). Bundle the renderer + catalog + registry into a single HTML file with Vite + vite-plugin-singlefile, serve it as a ui:// resource.
references/renderer-guide.md — Deep dive on each renderer's API and patternsreferences/component-libraries.md — Available components and custom component patternsWeekly Installs
1
Repository
GitHub Stars
7
First Seen
1 day ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
windsurf1
amp1
cline1
opencode1
cursor1
kimi-cli1
超能力技能使用指南:AI助手技能调用优先级与工作流程详解
45,100 周安装
@json-render/remotionjson-render-remotion |
| HTML email | @json-render/react-email | json-render-react-email |
| OG/social images | @json-render/image | json-render-image |
| Vue web apps | @json-render/vue | (no skill yet) |
| PDF documents | @json-render/react-pdf | (no skill yet) |
| Remotion compositions with AI video |
| Style exploration | browsing-styles | Browse 169 visual styles before generating |
| Video file |
@json-render/react-email | Email (HTML) |
| Images | @json-render/image | Image file (PNG/SVG) |