agentic-ui-development
14
总安装量
14
周安装量
#24016
全站排名
安装命令
npx skills add https://github.com/antdigital-ai/agentic-ui --skill agentic-ui-development
Agent 安装分布
opencode
14
gemini-cli
14
claude-code
14
github-copilot
14
amp
14
codex
14
Skill 文档
Agentic UI Development Skill
é¢åæºè½ä½ç UI ç»ä»¶åºå¼åæè½ï¼æä¾æºè½åçç»ä»¶æ¨èã代ç çæåè®¾è®¡ç³»ç»æ¯æã
Quick Start
pnpm install # å®è£
ä¾èµ
pnpm start # å¯å¨ææ¡£ç«ç¹ (http://localhost:8000)
pnpm test # è¿è¡åå
æµè¯
pnpm run build # æå»ºé¡¹ç®
Quick Reference – Search Commands
# æç´¢ç»ä»¶
python .cursor/skills/agentic-ui-development/scripts/search.py "chat bubble"
# æåæç´¢
python .cursor/skills/agentic-ui-development/scripts/search.py "chart" --domain plugin
python .cursor/skills/agentic-ui-development/scripts/search.py "scroll" --domain hook
python .cursor/skills/agentic-ui-development/scripts/search.py "color" --domain token
# è·åæ¨èæ¹æ¡
python .cursor/skills/agentic-ui-development/scripts/search.py "ai assistant" --recommend
# çæå®æ´è®¾è®¡ç³»ç» (æ¨è)
# -p æ¯ --project-name çç®åï¼ç¨äºæå®é¡¹ç®åç§°
python .cursor/skills/agentic-ui-development/scripts/search.py "ai chat" --design-system --project-name "My App"
# æä¹
åè®¾è®¡ç³»ç» (Master + Overrides 模å¼)
python .cursor/skills/agentic-ui-development/scripts/search.py "ai chat" --design-system --persist --project-name "My App" --page "chat"
Skill Activation
å½ç¨æ·è¯·æ±ä»¥ä¸ä»»å¡æ¶èªå¨æ¿æ´»ï¼
| 触åå ³é®è¯ | ç»ä»¶/åè½ |
|---|---|
bubble, chat, message |
å¯¹è¯æ°æ³¡ç»ä»¶ |
thought chain, thinking, reasoning |
æç»´é¾å¯è§å |
tool use, tool call, api call |
å·¥å ·è°ç¨å±ç¤º |
markdown, editor, rich text |
Markdown ç¼è¾å¨ |
input, multimodal, voice |
夿¨¡æè¾å ¥æ¡ |
workspace, file, browser |
å·¥ä½åºé¢æ¿ |
task, progress, step |
ä»»å¡å表 |
history, conversation |
ä¼è¯åå² |
layout, agentic |
å¸å±æ¡æ¶ |
agent, run, control |
æºè½ä½è¿è¡æ§å¶ |
button, icon, action |
æé®ç»ä»¶ |
animation, typing, gradient |
å¨ç»ææ |
i18n, locale, language |
å½é å |
How It Works
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â 1. USER REQUEST â
â "å建ä¸ä¸ªå¸¦æç»´é¾ç AI å¯¹è¯æ°æ³¡" â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â
â¼
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â 2. DESIGN SYSTEM GENERATION (--design-system) â
â ⢠BM25 search across 4 domains (component, plugin, hook, â
â token) â
â ⢠Apply reasoning rules from reasoning-rules.json â
â ⢠Generate complete recommendation with anti-patterns â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â
â¼
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â 3. COMPONENT SEARCH (Multi-domain) â
â ⢠Component matching (37 components) â
â ⢠Props API lookup â
â ⢠Style token recommendations â
â ⢠Related hooks & utilities â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â
â¼
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â 4. CODE GENERATION â
â ⢠Apply component template â
â ⢠Use design tokens (not hardcoded values) â
â ⢠Include TypeScript types â
â ⢠Add proper event handlers â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â
â¼
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â 5. PRE-DELIVERY CHECKLIST â
â [ ] Uses Ant Design tokens (no hardcoded colors) â
â [ ] TypeScript types complete (no `any`) â
â [ ] Event handlers use `on` prefix â
â [ ] CSS-in-JS with createStyles â
â [ ] Tests included (â¥80% coverage) â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Design System Generation (NEW)
Generate Complete Recommendation
ä½¿ç¨ --design-system çæå®æ´çç»ä»¶æ¨èæ¹æ¡ï¼
python .cursor/skills/agentic-ui-development/scripts/search.py "ai chat assistant" --design-system --project-name "My AI App"
è¾åºå å«ï¼
- æ¨èç»ä»¶å表
- æ¨è Hooks
- æ¨èæä»¶
- å ³é®è®¾è®¡ä»¤ç
- æ ·å¼ä¼å 级
- 忍¡å¼è¦å
- 交ä»åæ£æ¥æ¸ å
Persist with Master + Overrides Pattern
æä¹ å设计系ç»å°æä»¶ï¼æ¯æåå±è¦çï¼
# å建 MASTER.md
python .cursor/skills/agentic-ui-development/scripts/search.py "ai chat" --design-system --persist --project-name "My App"
# åæ¶å建页é¢è¦çæä»¶
python .cursor/skills/agentic-ui-development/scripts/search.py "ai chat" --design-system --persist --project-name "My App" --page "chat"
çææä»¶ç»æï¼
design-system/my-app/
âââ MASTER.md # å
¨å±è®¾è®¡è§å (Source of Truth)
âââ pages/
âââ chat.md # 页é¢ç¹å®è¦çè§å
å屿£ç´¢é»è¾ï¼
- æå»ºé¡µé¢æ¶ï¼å
æ£æ¥
design-system/<project>/pages/[page].md - 妿页颿件åå¨ï¼å ¶è§åè¦ç Master æä»¶
- 妿ä¸åå¨ï¼ä¸¥æ ¼ä½¿ç¨
design-system/<project>/MASTER.md
Component Categories
ð¤ AI Core Components
| Component | Purpose | Source |
|---|---|---|
Bubble |
å¯¹è¯æ°æ³¡ (AI/User) | src/Bubble/ |
ThoughtChainList |
æç»´é¾å¯è§å | src/ThoughtChainList/ |
ToolUseBar |
å·¥å ·è°ç¨å±ç¤º | src/ToolUseBar/ |
TaskList |
ä»»å¡ç¶æå表 | src/TaskList/ |
AnswerAlert |
ç»æç¶ææç¤º | src/AnswerAlert/ |
AgentRunBar |
æºè½ä½è¿è¡æ§å¶ | src/AgentRunBar/ |
âï¸ Editor Components
| Component | Purpose | Source |
|---|---|---|
MarkdownEditor |
æµå¼ Markdown ç¼è¾å¨ | src/MarkdownEditor/ |
MarkdownInputField |
夿¨¡æè¾å ¥æ¡ | src/MarkdownInputField/ |
SchemaForm |
JSON Schema 表å | src/Schema/ |
ð Layout Components
| Component | Purpose | Source |
|---|---|---|
AgenticLayout |
æºè½ä½åºç¨å¸å± | src/AgenticLayout/ |
ChatLayout |
对è¯çé¢å¸å± | src/ChatLayout/ |
ChatBootPage |
对è¯å¯å¨é¡µ | src/ChatBootPage/ |
Workspace |
夿 ç¾å·¥ä½å° | src/Workspace/ |
ð¨ Utility Components
| Component | Purpose | Source |
|---|---|---|
History |
ä¼è¯åå² | src/History/ |
WelcomeMessage |
欢è¿å¼å¯¼ | src/WelcomeMessage/ |
SuggestionList |
建议å表 | src/Components/SuggestionList/ |
Loading |
å è½½ç¶æ | src/Components/Loading/ |
Robot |
æºå¨äººå¤´å | src/Components/Robot/ |
GradientText |
æ¸åæåææ | src/Components/GradientText/ |
TextAnimate |
æåå¨ç» | src/Components/TextAnimate/ |
TypingAnimation |
æåæºå¨ç» | src/Components/TypingAnimation/ |
I18n |
å½é 忝æ | src/I18n/ |
ð Button Components
| Component | Purpose | Source |
|---|---|---|
IconButton |
徿 æé® | src/Components/Button/IconButton/ |
SwitchButton |
忢æé® | src/Components/Button/SwitchButton/ |
ToggleButton |
æ¿æ´»æé® | src/Components/Button/ToggleButton/ |
ActionIconBox |
æä½å¾æ ç | src/Components/ActionIconBox/ |
ActionItemBox |
æä½é¡¹å®¹å¨ | src/Components/ActionItemBox/ |
ð Plugin System
| Plugin | Purpose | Source |
|---|---|---|
chart |
å¾è¡¨æ¸²æ (Chart.js) | src/Plugins/chart/ |
code |
代ç é«äº® (ACE) | src/Plugins/code/ |
katex |
æ°å¦å ¬å¼ | src/Plugins/katex/ |
mermaid |
å¾è¡¨æ¸²æ | src/Plugins/mermaid/ |
formatter |
ä»£ç æ ¼å¼å | src/Plugins/formatter/ |
Design System Rules
â DO (Best Practices)
// 1. Use Ant Design tokens
const useStyles = createStyles(({ token }) => ({
container: {
padding: token.padding, // â
Not '16px'
color: token.colorText, // â
Not '#000'
borderRadius: token.borderRadius, // â
Not '6px'
},
}));
// 2. Complete TypeScript types
interface MyComponentProps {
onSelect?: (item: Item) => void; // â
on prefix
config?: MyConfig; // â
Config suffix
}
// 3. CSS-in-JS pattern
import { createStyles } from '@ant-design/cssinjs';
â DON’T (Anti-Patterns)
// 1. Hardcoded values
padding: '16px', // â Use token.padding
color: '#1890ff', // â Use token.colorPrimary
backgroundColor: 'white', // â Use token.colorBgContainer
// 2. Any types
props: any // â Define proper interface
// 3. Inline styles
style={{ padding: 16 }} // â Use createStyles
// 4. Wrong event naming
handleClick // â Use onClick
File Structure Pattern
ComponentName/
âââ components/ # åç»ä»¶
âââ hooks/ # èªå®ä¹ Hook (useXxx.ts)
âââ types/ # ç±»åå®ä¹
âââ __tests__/ # æµè¯æä»¶ (ComponentName.test.tsx)
âââ index.tsx # 主ç»ä»¶å
¥å£
âââ style.ts # CSS-in-JS æ ·å¼
Pre-Delivery Checklist
Before completing any component task:
[ ] Uses @ant-design/cssinjs createStyles
[ ] All colors from token system
[ ] TypeScript types complete (no `any`)
[ ] Event handlers with `on` prefix
[ ] BEM class naming (.component__element--modifier)
[ ] Unit tests included
[ ] Proper error boundaries
[ ] Accessibility (aria-* attributes)
[ ] Performance (React.memo, useMemo, useCallback)
Search Command Reference
Available Domains
| Domain | Content | Example Keywords |
|---|---|---|
component |
37 个 UI ç»ä»¶ | bubble, chat, layout, editor, thought, task, workspace |
plugin |
5 个 Markdown æä»¶ | chart, code, katex, mermaid, formatter |
hook |
12 个 React Hooks | scroll, size, speech, click, language, intersection |
token |
51 个设计令ç | color, padding, font, border, shadow, motion |
Command Options
# åºæ¬æç´¢
python .cursor/skills/agentic-ui-development/scripts/search.py "query"
# æå®åæç´¢
python .cursor/skills/agentic-ui-development/scripts/search.py "query" --domain component
# è·åæ¨èæ¹æ¡
python .cursor/skills/agentic-ui-development/scripts/search.py "query" --recommend
# çæè®¾è®¡ç³»ç» (--project-name å¯ç®å为 -p)
python .cursor/skills/agentic-ui-development/scripts/search.py "query" --design-system --project-name "Project"
# æä¹
å设计系ç»
python .cursor/skills/agentic-ui-development/scripts/search.py "query" --design-system --persist --project-name "Project" --page "page"
# è¾åºæ ¼å¼ (--format å¯ç®å为 -f)
python .cursor/skills/agentic-ui-development/scripts/search.py "query" --format json # JSON
python .cursor/skills/agentic-ui-development/scripts/search.py "query" --format markdown # Markdown
python .cursor/skills/agentic-ui-development/scripts/search.py "query" --format ascii # ASCII (default)
# éå¶ç»ææ°é (--limit å¯ç®å为 -n)
python .cursor/skills/agentic-ui-development/scripts/search.py "query" --limit 3
Example: Design System Output
+------------------------------------------------------------------------------------------+
| TARGET: MY AI APP - AGENTIC UI RECOMMENDATION
+------------------------------------------------------------------------------------------+
|
| QUERY: ai chat assistant
| RULE MATCHED: ai-assistant
|
| RECOMMENDED COMPONENTS:
| Bubble.AIBubble, ThoughtChainList, ToolUseBar, WelcomeMessage
|
| RECOMMENDED HOOKS:
| useAutoScroll, useSpeechSynthesis
|
| RECOMMENDED PLUGINS:
| N/A
|
| KEY TOKENS:
| colorPrimary, colorSuccess, motionDurationMid
|
| STYLE PRIORITY:
| modern, glassmorphism, dark-mode
|
| ANTI-PATTERNS (AVOID):
| â No thought chain for AI
| â Missing streaming support
| â No tool call visibility
|
| PRE-DELIVERY CHECKLIST:
| [ ] Uses @ant-design/cssinjs createStyles
| [ ] All colors from token system
| [ ] TypeScript types complete (no any)
| [ ] Event handlers with 'on' prefix
| [ ] BEM class naming
| [ ] Unit tests included (â¥80% coverage)
| [ ] Proper error boundaries
|
+------------------------------------------------------------------------------------------+
Data Files
| File | Content |
|---|---|
data/components.csv |
37 个ç»ä»¶æ°æ® |
data/plugins.csv |
5 个æä»¶æ°æ® |
data/hooks.csv |
12 个 Hooks æ°æ® |
data/tokens.csv |
51 个设计令ç |
data/reasoning-rules.json |
15 æ¡æ¨çè§å |
Design Tokens (Quick Reference)
ä½¿ç¨ Ant Design Token ç³»ç»ï¼ç¦æ¢ç¡¬ç¼ç å¼ã
Color Tokens
| Token | Description |
|---|---|
colorPrimary |
ä¸»è² |
colorSuccess |
æåè² |
colorWarning |
è¦åè² |
colorError |
éè¯¯è² |
colorText |
ä¸»ææ¬ |
colorTextSecondary |
æ¬¡è¦ææ¬ |
colorBgContainer |
容å¨èæ¯ |
colorBorder |
è¾¹æ¡è² |
Spacing Tokens
| Token | Value |
|---|---|
paddingXS |
8px |
paddingSM |
12px |
padding |
16px |
paddingLG |
24px |
Usage
const useStyles = createStyles(({ token }) => ({
container: {
padding: token.padding, // DO: token
color: token.colorText, // DO: token
// padding: '16px', // DON'T: hardcode
},
}));
Plugins (Quick Reference)
| Plugin | Purpose | Usage |
|---|---|---|
chart |
å¾è¡¨æ¸²æ | <LineChart data={...} /> |
code |
代ç é«äº® | <CodeBlock code={...} language="ts" /> |
katex |
æ°å¦å ¬å¼ | <Katex formula="E=mc^2" /> |
mermaid |
å¾è¡¨æ¸²æ | <Mermaid chart={...} /> |
<MarkdownEditor plugins={['code', 'katex', 'mermaid', 'chart']} />
Component API Examples
Bubble
import { Bubble } from '@ant-design/agentic-ui';
<Bubble.AIBubble
content="åæå®æ"
thoughtChain={[
{ type: 'thought', content: 'åæéæ±' },
{ type: 'action', content: 'æ§è¡æ¥è¯¢' },
]}
status="success"
streaming={true}
/>
<Bubble.UserBubble content="è¯·åææ°æ®" avatar={{ src: '/avatar.png' }} />
ThoughtChainList
import { ThoughtChainList } from '@ant-design/agentic-ui';
<ThoughtChainList
items={[
{ type: 'thought', title: 'åæ', status: 'completed' },
{ type: 'action', title: 'æ§è¡', status: 'loading', costMillis: 234 },
]}
collapsed={false}
onToggle={(collapsed) => {}}
/>
ToolUseBar
import { ToolUseBar } from '@ant-design/agentic-ui';
<ToolUseBar
name="æç´¢å·¥å
·"
status="success"
params={{ query: 'React' }}
result={{ items: [...], count: 10 }}
costMillis={1234}
/>
MarkdownEditor
import { MarkdownEditor } from '@ant-design/agentic-ui';
<MarkdownEditor
value={markdown}
onChange={setMarkdown}
plugins={['code', 'katex', 'mermaid']}
toolbar={{ bold: true, italic: true, code: true }}
/>
Workspace
import Workspace from '@ant-design/agentic-ui';
<Workspace
activeKey="file"
tabs={[
{ key: 'browser', title: 'æµè§å¨', content: <BrowserPreview /> },
{ key: 'file', title: 'æä»¶', content: <FileViewer /> },
]}
onTabChange={(key) => {}}
/>
Code Templates
Component Template
import React from 'react';
import { createStyles } from '@ant-design/cssinjs';
export interface {{ComponentName}}Props {
className?: string;
children?: React.ReactNode;
onSelect?: (value: string) => void;
}
const useStyles = createStyles(({ token }) => ({
container: {
padding: token.padding,
backgroundColor: token.colorBgContainer,
borderRadius: token.borderRadius,
},
}));
export const {{ComponentName}}: React.FC<{{ComponentName}}Props> = ({
className, children, onSelect,
}) => {
const { styles, cx } = useStyles();
return <div className={cx(styles.container, className)}>{children}</div>;
};
Hook Template
import { useState, useCallback } from 'react';
export const use{{HookName}} = (defaultValue = '') => {
const [value, setValue] = useState(defaultValue);
const reset = useCallback(() => setValue(defaultValue), [defaultValue]);
return { value, setValue, reset };
};
Test Template
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { describe, it, expect, vi } from 'vitest';
describe('{{ComponentName}}', () => {
it('should render', () => {
render(<{{ComponentName}} />);
expect(screen.getByRole('button')).toBeInTheDocument();
});
it('should handle click', async () => {
const onClick = vi.fn();
render(<{{ComponentName}} onClick={onClick} />);
await userEvent.click(screen.getByRole('button'));
expect(onClick).toHaveBeenCalledTimes(1);
});
});
Test Commands
pnpm test # åå
æµè¯
pnpm test:coverage # 带è¦çç (>=80%)
pnpm test:e2e # E2E æµè¯
Commit Convention
<type>(<scope>): <description>
Types: feat | fix | docs | style | refactor | perf | test | chore
Scopes: bubble | editor | workspace | history | plugin | core
Examples:
feat(bubble): add streaming text animationfix(editor): resolve cursor position issuetest(thought-chain): add unit tests for ToolCall