Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

a2ui-catalog

БесплатноЗапускает вложенные скриптыНе проверен

Turns an app's existing React components into a CopilotKit Gen UI 2.0 generative UI (A2UI 1.0, `createGenerativeUI` on top of `standardUI`), with fixed-schema…

CopilotKitот CopilotKit★ 39 079 звёзд на GitHub

Об этом скилле

A2UI catalog: from your React components to Gen UI 2.0 in CopilotKit

Built in a2ui-playground (123 components: CopilotKit's 69 standard ones plus 54 of the app's own; Next 16, CopilotKit 1.85 Gen UI 2.0, A2UI 1.0). Fixed surfaces paint in ~1.4 to 3 s, dynamic in ~3 s first paint with progressive streaming (measured on the v0.9 build of the same pipeline; re-measure after porting). Every step below links to a reference with the real code.

Quick start (minimum path)

One custom component rendering in CopilotKit chat, with the runtime giving a stock agent the render_ui tool. The playground's /minimal page is this path (src/app/minimal/page.tsx, src/app/api/minimal/...slug/route.ts).

  1. Install: pnpm add @copilotkit/react-core @copilotkit/runtime @copilotkit/shared zod (zod 3.25+, or zod 4.2+).
  2. Define the component (React-free file). The schema describes the literal value only: the engine resolves { "@path" } bindings and { "@call" } functions at any depth before it validates.
    export const definitions = {
      Stat: {
        description: "One KPI: label, short value, optional delta like '+4%'.",
        props: z.object({
          label: z.string(),
          value: z.string(),
          delta: z.string().optional(),
        }),
      },
    };
    
  3. Render it and build the UI (client file). Your component receives the resolved props directly:
    import {
      createGenerativeUI,
      standardUI,
    } from "@copilotkit/react-core/v2/generative-ui";
    export const ui = createGenerativeUI({
      id: "https://example.dev/catalogs/main/v1",
      extends: [standardUI],
      components: {
        Stat: {
          ...definitions.Stat,
          component: ({ label, value, delta }) => (
            <div className="card">
              <span>{label}</span>
              <strong>{value}</strong>
              {delta}
            </div>
          ),
        },
      },
    });
    
  4. Pass it to the provider: <CopilotKitProvider runtimeUrl="/api/copilotkit" generativeUI={{ ui }}><CopilotChat /></CopilotKitProvider>. Every run then carries the catalog in forwardedProps.copilotkit.ui (the tool transport is the default).
  5. Serve a stock agent from a catch-all route (app/api/copilotkit/...slug/route.ts):
    const runtime = new CopilotRuntime({
      agents: {
        default: new BuiltInAgent({
          model: "openai:gpt-5.5",
          prompt: "Answer with UI: call render_ui with A2UI 1.0 operations.",
        }),
      },
    });
    const handler = createCopilotRuntimeHandler({
      runtime,
      basePath: "/api/copilotkit",
    });
    export const GET = handler;
    export const POST = handler;
    
    No runtime option is needed: a tool-transport envelope makes the runtime apply GenerativeUIMiddleware, which injects render_ui, validates each streamed operation against your catalog, and commits it as a generative-ui-surface activity that the chat paints.

That path has the primary model write the whole surface, and each operation paints when it closes. The workflow below adds what made the playground fast and robust: fixed templates, a dedicated streaming composer, server-side repair, geocoding, and in-place updates.

Workflow

  1. Inventory components. Run scripts/scan-components.ts <componentsDir> to draft Zod definitions from the TypeScript props. Keep components an agent would pick to answer a question (cards, charts, tables, inputs). Check standardUI first: it already has layout, text, form, Chart, Map, Table and List (69 components), and a name can come from one place only. Drop internals (DialogOverlay, SelectTrigger). -> references/definitions-and-descriptions.md
  2. Write definitions. One Zod object + one tight description per component, React-free so the server can import them. Props describe literal values. Child references are child() / childList(). Callbacks are events (onAction). Inputs declare writable: ["value"]. -> same reference
  3. Write renderers. Display renderers read resolved props; children arrive rendered. Input renderers bind two-way: useBound(props.value, props.setValue, fallback). The onAction event arrives as action(). Never throw on partial data. Use container queries, not viewport breakpoints. -> references/renderers-and-data-binding.md
  4. Create the generative UI. createGenerativeUI({ id, extends: [standardUI], components }) plus a theme for the standard components. Restyle a standard component with overrides, or drop it with standardUI.omit([...]) and define your own. -> references/wiring-and-runtime.md
  5. Wire provider + runtime. <CopilotKitProvider generativeUI={{ ui, theme, transport: "tool" }}> on the client; app/api/copilotkit/...slug/route.ts with CopilotRuntime({ generativeUI: false }) when your agent writes its own surfaces. Catch-all route or /info 404s. -> references/wiring-and-runtime.md
  6. **Fixed-schema surfaces + t
Полный SKILL.md на GitHub

Установить a2ui-catalog в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/definitions-and-descriptions.mdreferences/dynamic-schema.mdreferences/fixed-schema.mdreferences/performance.mdreferences/renderers-and-data-binding.mdreferences/streaming-visuals.mdreferences/troubleshooting.mdreferences/wiring-and-runtime.mdscripts/scan-components.tstemplates/blueprint.tsxtemplates/catalog-prompt.tstemplates/catalog.tstemplates/definitions-shared.tstemplates/events.tstemplates/geo.tstemplates/node-rects.tstemplates/reference/agent.tstemplates/reference/composer.tstemplates/reference/fixed-templates.tstemplates/reference/route.tstemplates/reference/tools.tstemplates/reference/use-send.tstemplates/renderer-types.tstemplates/repair.tstemplates/static-surface.tsxtemplates/stream-parse.tstemplates/surface-mirror.tsxtemplates/surface.tstemplates/use-bound.ts

FAQ

Что делает скилл a2ui-catalog?

Turns an app's existing React components into a CopilotKit Gen UI 2.0 generative UI (A2UI 1.0, `createGenerativeUI` on top of `standardUI`), with fixed-schema templates for common asks and a streaming dynamic-schema sub-agent for everything else. Use when the user wants the agent to answer with their own components, asks to "add A2UI", "build an A2UI catalog", "createGenerativeUI", "render_ui", "make the agent render our design system", "fixed vs dynamic schema", "generate_a2ui is slow", "migrate from A2UI v0.9", or to debug "Couldn't display this part" / rejected operations / surfaces that never paint. Don't use for open-ended HTML generation (Open Generative UI), for useComponent/useRenderTool controlled gen UI only, or for MCP Apps.

Как установить скилл a2ui-catalog?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл a2ui-catalog запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить a2ui-catalog с