Agent skill

X Card

by kqcoxn in kqcoxn/MaaPipelineEditor

当需要用 @ant-design/x-card 让 AI Agent 动态渲染富交互 UI 时使用——涵盖 XCard.Box、XCard.Card、A2UI v0.9 命令、数据绑定、Catalog、Actions 和流式渲染模式。

MITAuto-check passed

Install X Card

skills CLI
$ npx skills add kqcoxn/MaaPipelineEditor --skill x-card -a claude-code

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

GitHub CLI
$ gh skill install kqcoxn/MaaPipelineEditor x-card --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/kqcoxn/MaaPipelineEditor.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/ant-design-x/skills/x-card .claude/skills/x-card && 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
x-card
GitHub stars
408
Token cost
~2.1k tokens
SKILL.md length
316 words
Files
8
Skills in repo
12
Repo updated
First seen
Licence
MIT

At a glance

当需要用 @ant-design/x-card 让 AI Agent 动态渲染富交互 UI 时使用——涵盖 XCard.Box、XCard.Card、A2UI v0.9 命令、数据绑定、Catalog、Actions 和流式渲染模式。

  • Works in 5 steps: 定义 Catalog —— 注册本地 Catalog 或使用 A2UI… → 注册自定义组件 —— 通过 XCard.Box 的 components… → 构建 React 树 —— 用 XCard.Box 包裹,每个 Surface… → …
  • SKILL.md covers 目录导航, XCard.Box 属性, XCard.Card 属性 and ActionPayload, plus 2 more sections
  • Calls npm

What it does

X Card is an agent skill from kqcoxn/MaaPipelineEditor. 当需要用 @ant-design/x-card 让 AI Agent 动态渲染富交互 UI 时使用——涵盖 XCard.Box、XCard.Card、A2UI v0.9 命令、数据绑定、Catalog、Actions 和流式渲染模式。

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files (for example `reference/ACTIONS.md`, `reference/API.md` and `reference/CATALOG.md`).

It works with Ant Design. The repository describes itself as: ✨ 可视化构建 MaaFramework Pipeline 的下一代工作流 审阅&编辑&调试 工具,你的工程师牛牛! ✨. The licence is MIT.

Example prompts

  • “/x-card”

Requirements

  • Node.js

Workflow steps

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

  1. 定义 Catalog —— 注册本地 Catalog 或使用 A2UI Basic Catalog URL。
  2. 注册自定义组件 —— 通过 XCard.Box 的 components prop 传入。
  3. 构建 React 树 —— 用 XCard.Box 包裹,每个 Surface 对应一个 XCard.Card。
  4. 注入命令 —— 将 XAgentCommand_v0_9[] 传入 commands prop(通常来自 Agent 流式响应)。
  5. 处理 Action —— 在 onAction 中接收 ActionPayload,追加新命令作为响应。

What it can do on your machine

Read from SKILL.md and the folder at commit bbfe0d0. 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

    Shell commands in SKILL.md call:

    • npm

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

  • Network

    Links to these hosts (documentation or services it may open):

    • a2ui.org
    • github.com

    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

X Card loads about 2.1k tokens when it runs. Until then it costs about 31 tokens; SKILL.md has 316 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~31
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k

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); files beside SKILL.md are not scanned.

SKILL.md

The full file from kqcoxn/MaaPipelineEditor at commit bbfe0d0, republished under its MIT licence (© kqcoxn). 316 words, ~2,111 tokens.

Download SKILL.mdSave it as .claude/skills/x-card/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
x-card
description
当需要用 @ant-design/x-card 让 AI Agent 动态渲染富交互 UI 时使用——涵盖 XCard.Box、XCard.Card、A2UI v0.9 命令、数据绑定、Catalog、Actions 和流式渲染模式。
version
2.9.0

🎯 技能定位

本技能覆盖 @ant-design/x-card —— A2UI 协议的 React 实现,使 AI Agent 能够通过结构化 JSON 命令流动态渲染富交互 UI。

覆盖范围:

  • XCard.Box + XCard.Card 组件用法
  • A2UI v0.9 命令类型:createSurface、updateComponents、updateDataModel、deleteSurface
  • 自定义组件注册与 Catalog 管理
  • 通过 JSON Pointer 路径(RFC 6901)进行数据绑定
  • Action 处理 —— 将用户事件回传给 Agent
  • 流式渐进渲染模式
  • v0.8 ↔ v0.9 协议差异

范围说明:v0.9 是推荐协议,v0.8 仅为向后兼容保留——所有新功能请使用 v0.9。

目录导航

📦 技术栈概览

包名职责
@ant-design/x-cardA2UI 协议的 React 渲染器 —— XCard.Box、XCard.Card、Catalog API
@ant-design/x聊天 UI 组件(Bubble、Sender 等)—— 本技能不涉及
@ant-design/x-sdk数据 Provider、流式处理 —— 本技能不涉及
bash
npm install @ant-design/x-card

导出内容:

typescript
import {
  XCard,
  registerCatalog,
  loadCatalog,
  validateComponent,
  clearCatalogCache,
} from '@ant-design/x-card';
import type {
  XAgentCommand_v0_9,
  XAgentCommand_v0_8,
  ActionPayload,
  Catalog,
  CatalogComponent,
} from '@ant-design/x-card';

// 子组件
XCard.Box; // 容器:接收命令,持有 Catalog 映射
XCard.Card; // 渲染器:按 id 渲染单个 Surface

🗂️ 组件架构

XCard.Box
├── 持有:catalogMap、surfaceCatalogMap
├── 分发:commands → 所有 XCard.Card 子组件
├── 汇聚:所有 Card 的 onAction 事件
└── XCard.Card (id="surface-a")
│   ├── 持有:组件树、数据模型、commandVersion
│   └── 处理:数据绑定解析、Action 触发
└── XCard.Card (id="surface-b")
    └── ...

XCard.Box 属性

typescript
interface BoxProps {
  commands?: (XAgentCommand_v0_9 | XAgentCommand_v0_8)[];
  /** 组件名称必须以大写字母开头 */
  components?: Record<string, React.ComponentType<any>>;
  onAction?: (payload: ActionPayload) => void;
  children?: React.ReactNode; // 应包含 XCard.Card 元素
}

XCard.Card 属性

typescript
interface CardProps {
  id: string; // 要渲染的 surfaceId
}

ActionPayload

typescript
interface ActionPayload {
  name: string; // 来自 action.event.name
  surfaceId: string; // 触发动作的 Surface
  /**
   * 组件传递的上下文,已自动解析 path 引用
   *
   * 对于 action.event.context 中使用 { path: "xxx" } 格式的字段:
   * - X-Card 会自动将其解析为 { value: "实际值" } 格式
   * - 其他属性(如 label)会被保留
   *
   * 示例输入配置:
   *   { username: { path: "/form/username", label: "用户名" } }
   *
   * 示例解析后 context:
   *   { username: { value: "张三", label: "用户名" } }
   */
  context: Record<string, any>;
}

🚀 快速决策指南

当你需要...优先阅读
配置 XCard.Box + XCard.CardUSAGE.md → 基础配置
从 Agent 发送命令到卡片COMMANDS.md
注册自定义组件 CatalogCATALOG.md → 本地 Catalog
把组件属性绑定到实时数据DATA_BINDING.md
处理用户交互/表单提交ACTIONS.md
构建流式渐进 UIUSAGE.md → 流式渲染
从 v0.8 迁移到 v0.9COMMANDS.md → v0.8 vs v0.9
查询完整类型定义API.md

🛠 推荐工作流

  1. 定义 Catalog —— 注册本地 Catalog 或使用 A2UI Basic Catalog URL。
  2. 注册自定义组件 —— 通过 XCard.Box 的 components prop 传入。
  3. 构建 React 树 —— 用 XCard.Box 包裹,每个 Surface 对应一个 XCard.Card。
  4. 注入命令 —— 将 XAgentCommand_v0_9[] 传入 commands prop(通常来自 Agent 流式响应)。
  5. 处理 Action —— 在 onAction 中接收 ActionPayload,追加新命令作为响应。

最小可运行示例

tsx
import React, { useState } from 'react';
import { XCard, registerCatalog } from '@ant-design/x-card';
import type { XAgentCommand_v0_9, ActionPayload, Catalog } from '@ant-design/x-card';

// 1. 定义并注册本地 Catalog
const myCatalog: Catalog = {
  catalogId: 'local://my_catalog.json',
  components: {
    Text: {
      type: 'object',
      properties: { text: { type: 'string' }, variant: { type: 'string' } },
      required: ['text'],
    },
    Button: {
      type: 'object',
      properties: { text: { type: 'string' }, action: {} },
      required: ['text'],
    },
  },
};
registerCatalog(myCatalog);

// 2. 自定义组件实现
const Text: React.FC<{ text: string; variant?: string }> = ({ text, variant }) => (
  <p className={`text-${variant ?? 'body'}`}>{text}</p>
);

const Button: React.FC<{ text: string; onAction?: (ctx: any) => void; action?: any }> = ({
  text,
  onAction,
  action,
}) => <button onClick={() => onAction?.(action?.event?.context ?? {})}>{text}</button>;

// 3. 构建命令(来自 Agent 流)
const commands: XAgentCommand_v0_9[] = [
  {
    version: 'v0.9',
    createSurface: {
      surfaceId: 'welcome',
      catalogId: 'local://my_catalog.json',
    },
  },
  {
    version: 'v0.9',
    updateComponents: {
      surfaceId: 'welcome',
      components: [
        { id: 'root', component: 'Column', children: ['title', 'btn'] },
        { id: 'title', component: 'Text', text: { path: '/user/name' }, variant: 'h1' },
        {
          id: 'btn',
          component: 'Button',
          text: '开始',
          action: { event: { name: 'start', context: {} } },
        },
      ],
    },
  },
  {
    version: 'v0.9',
    updateDataModel: {
      surfaceId: 'welcome',
      path: '/user/name',
      value: 'Alice',
    },
  },
];

// 4. 渲染
export default function App() {
  const [cmdQueue, setCmdQueue] = useState<XAgentCommand_v0_9[]>(commands);

  const handleAction = (payload: ActionPayload) => {
    console.log('Action:', payload.name, payload.context);
    // 根据 Agent 响应追加新命令
    setCmdQueue((prev) => [...prev /* 新命令 */]);
  };

  return (
    <XCard.Box commands={cmdQueue} components={{ Text, Button }} onAction={handleAction}>
      <XCard.Card id="welcome" />
    </XCard.Box>
  );
}

🚨 开发规则

  • 每条命令必须包含 "version": "v0.9" —— 缺少会导致协议拒绝。
  • 每个 Surface 有且仅有一个 id: "root" 组件 —— 这是组件树的根节点。
  • 只用扁平邻接表 —— 不要把组件对象嵌套在其他组件对象内;子组件只能通过 id 字符串引用。
  • 结构与数据分离 —— updateComponents 负责布局,updateDataModel 负责内容/状态。
  • 挂载前先注册 Catalog —— 在组件树渲染之前调用 registerCatalog()。
  • components map 传给 XCard.Box,而不是 XCard.Card —— Box 负责向所有 Card 分发。
  • 不要内联重建 components 对象 —— 用 useMemo 或模块级常量保持稳定,避免不必要的重渲染。
  • 表单输入组件必须用 value: { path: "..." } 双向绑定 —— 字面量值不会更新数据模型。
  • 流式场景:追加新命令到数组而不是替换整个数组 —— Card 会增量处理差异。
  • action.event.context 中的路径是写入目标 —— 它们指向用户输入数据在数据模型中的存储位置,不要作为读取来源解析。
  • Action context 中的 path 引用会被自动解析 —— 触发 action 时,X-Card 会自动将 action 配置中的 { path: "xxx" } 转换为 { value: "实际值" } 格式。这适用于 v0.9(action.event.context = { key: { path } })和 v0.8(action.context = [{ key, value: { path } }])两种格式。
  • v0.8 的 action.context 是数组格式 —— [{ key, value: { path } }],与 v0.9 的对象格式 { key: { path } } 不同,混用会导致 action 数据丢失。

🤝 技能协作

场景技能组合
AI 对话 + 结构化卡片响应use-x-chat + x-components + x-card
独立的 Agent 表单 UI仅 x-card
流式 Markdown + 卡片侧边栏x-markdown + x-card
HTTP 流式 Agent 数据注入卡片x-request → 将响应作为命令传入

🔗 参考资源

  • USAGE.md —— 配置指南、流式模式、多 Surface 示例
  • COMMANDS.md —— 四种 A2UI v0.9 命令类型,v0.8 vs v0.9 差异
  • DATA_BINDING.md —— JSON Pointer 路径、动态类型、双向绑定、模板迭代
  • ACTIONS.md —— Action 定义、ActionPayload、表单提交模式
  • CATALOG.md —— 本地 Catalog 注册、远程 URL 加载、自定义组件 Schema
  • API.md —— Box、Card、命令、Catalog、Action 的完整 TypeScript 类型

官方文档

© kqcoxn, 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 7 other files in .agents/skills/ant-design-x/skills/x-card of kqcoxn/MaaPipelineEditor.

  • SKILL.md
  • reference/ACTIONS.md
  • reference/API.md
  • reference/CATALOG.md
  • reference/COMMANDS.md
  • reference/DATA_BINDING.md
  • reference/INTRODUCTION.md
  • reference/USAGE.md

Open the folder on GitHubat commit bbfe0d0

Compare with similar skills

X Card 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.

X Card compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
X Card this skillkqcoxn/MaaPipelineEditor408—~2.1kAutomated safety check: PassMIT
LobeHub Interactive Prototypelobehub/lobehub83k—~1.6kAutomated safety check: PassCustom licence
Version ReleaseNG-ZORRO/ng-zorro-antd9.2k—~3.1kAutomated safety check: PassMIT
Ant Design Mobile Releaseant-design/ant-design-mobile12k—~497Automated safety check: PassMIT
Lobe Designlobehub/lobe-ui2.2k—~2.2kAutomated safety check: PassMIT
Feature SyncNG-ZORRO/ng-zorro-antd9.2k—~840Automated safety check: PassMIT

Similar skills

  • Builds single-file interactive HTML prototypes rendered with the real LobeHub UI components and written as production-style React, so they can later be split into files.

    83k GitHub stars~1.6k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Version Release

    NG-ZORRO/ng-zorro-antd

    NG-ZORRO/ng-zorro-antd repository release workflow. An agent skill from NG-ZORRO/ng-zorro-antd.

    9.2k GitHub stars~3.1k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Ant Design Mobile Release

    ant-design/ant-design-mobile

    Prepares an npm release of ant-design-mobile up to the version commit, then tags and publishes the GitHub Release after you run the publish command yourself.

    12k GitHub stars~497 tokensUpdated 26 days ago
    DevelopmentAuto-check passed
  • Lobe Design

    lobehub/lobe-ui

    Build UI with the LobeHub design system — @lobehub/ui/base-ui, the controlled form at @lobehub/ui/base-ui/form, and the chat, mobile, dashboard, awesome, brand, mdx, and i18n namespaces, plus…

    2.2k GitHub stars~2.2k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Feature Sync

    NG-ZORRO/ng-zorro-antd

    Sync an Ant Design React component or feature into NG-ZORRO.

    9.2k GitHub stars~840 tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • Ant Design Vue UI

    lazzyfu/goInsight

    Build, refactor, or review production-grade admin interfaces with Vue 3 + JavaScript + Ant Design Vue 4.x.

    729 GitHub stars~2k tokensUpdated 6 mo ago
    DatabasesAuto-check passed

More from kqcoxn/MaaPipelineEditor

All 12 skills in this repo
  • Ant Design

    kqcoxn/MaaPipelineEditor

    Decision guide for antd 6.x, Ant Design Pro 5/ProComponents, Ant Design X v2, and the offline @ant-design/cli.

    408 GitHub starsUsed in 1 repo~1.1k tokens
    Auto-check passed
  • Maafw

    kqcoxn/MaaPipelineEditor

    MaaFramework 开发与集成指南。当任务涉及 MaaFramework 项目结构、Pipeline 协议、ProjectInterface V2 协议、自定义识别/动作(Custom/Agent)、Python/NodeJS/CSharp 等语言 Binding 集成、控制器配置、回调协议或运行时行为时使用。

    408 GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Mpe Background Art

    kqcoxn/MaaPipelineEditor

    为 MPE 桌面端策划、生成或修改版本主题背景图,复用机械动力牛牛与章鱼猫的定稿形象;也用于维护这两个角色的设定与三视图。不用于普通界面样式修改或无关插画。

    408 GitHub stars~410 tokensUpdated yesterday
    Auto-check passed
  • Use X Chat

    kqcoxn/MaaPipelineEditor

    专注讲解如何使用 useXChat Hook,包括自定义 Provider 的集成、消息管理、错误处理、多会话管理等. An agent skill from kqcoxn/MaaPipelineEditor.

    408 GitHub stars~3k tokensUpdated yesterday
    Auto-check passed
  • X Chat Provider

    kqcoxn/MaaPipelineEditor

    专注于自定义 Chat Provider 的实现,帮助将任意流式接口适配为 Ant Design X 标准格式. An agent skill from kqcoxn/MaaPipelineEditor.

    408 GitHub stars~3.1k tokensUpdated yesterday
    Auto-check passed
  • X Components

    kqcoxn/MaaPipelineEditor

    使用 @ant-design/x 组件库构建 AI 对话 UI 时使用 —— 涵盖 Bubble、Sender、Conversations、Prompts、ThoughtChain、Actions、Welcome、Attachments、Sources、Suggestion、Think、FileCard、CodeHighlighter、Mermaid、Folder、XProvider 和…

    408 GitHub stars~1.6k tokensUpdated yesterday
    Auto-check passed

Works with

Questions about X Card

What does X Card do?

当需要用 @ant-design/x-card 让 AI Agent 动态渲染富交互 UI 时使用——涵盖 XCard.Box、XCard.Card、A2UI v0.9 命令、数据绑定、Catalog、Actions 和流式渲染模式。. X Card is an agent skill from kqcoxn/MaaPipelineEditor.

How do I install X Card in Claude Code?

Run `npx skills add kqcoxn/MaaPipelineEditor --skill x-card -a claude-code`. Or copy the skill folder (.agents/skills/ant-design-x/skills/x-card in kqcoxn/MaaPipelineEditor) into .claude/skills/x-card in your project. Claude Code loads it when a task matches its description.

How do I install X Card in Codex?

Run `npx skills add kqcoxn/MaaPipelineEditor --skill x-card -a codex`. Or copy the skill folder (.agents/skills/ant-design-x/skills/x-card in kqcoxn/MaaPipelineEditor) into .agents/skills/x-card in your project. Codex loads it when a task matches its description.

Can I use X Card 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 kqcoxn/MaaPipelineEditor --skill x-card -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/x-card, .gemini/skills/x-card, .github/skills/x-card and .opencode/skills/x-card in your project.

What does X Card need to run?

Going by SKILL.md and its folder, X Card needs the command-line tools its instructions call (npm). Our summary lists: Node.js.

Does X Card access the network?

SKILL.md names 2 domains. As links in the text: a2ui.org and github.com. This is read from the text; nothing was executed.

Is X Card 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. Review the folder before installing.

What licence does X Card use?

X Card 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 X Card use?

About 2.1k tokens (SKILL.md is roughly 8.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to X Card?

Skills that share tags, products or a category with X Card: LobeHub Interactive Prototype (lobehub/lobehub, 83k stars), Version Release (NG-ZORRO/ng-zorro-antd, 9.2k stars), Ant Design Mobile Release (ant-design/ant-design-mobile, 12k stars) and Lobe Design (lobehub/lobe-ui, 2.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains X Card?

kqcoxn (a GitHub user) maintains it in kqcoxn/MaaPipelineEditor, which has 408 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on October 9, 2026.

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