ant-design/x/use-x-chat
Claude Code and agent skill by ant-design/x
- community
Checking that the SKILL.md file is still in the repository.
Focus on explaining how to use the useXChat Hook, including custom Provider integration, message management, error handling, multi-conversation management, and more
Install
npx vskill@latest install ant-design/x/use-x-chatSKILL.md
The same SKILL.md was published earlier as ant-design/x/use-x-chat.
🎯 Skill Positioning
Core Positioning: Use theuseXChatHook to build professional AI conversation applications. Prerequisite: Already have a custom Chat Provider (refer to x-chat-provider skill)
Table of Contents
- 🚀 Quick Start
- 🧩 Core Concepts
- Data Model
- Configuration Options
- Return Values
- 🔧 Core Function Details
- 🗂️ Multi-conversation Management
- 📋 Prerequisites and Dependencies
- 🚨 Development Rules
- 🔗 Reference Resources
🚀 Quick Start
1. Dependency Management
- @ant-design/x-sdk: 2.2.2+
- @ant-design/x: latest version (UI components)
2. Three-step Integration
Step 1: Prepare Provider
Handled by the x-chat-provider skill. Note XRequest must pass manual: true:
Step 2: Basic Usage
Step 3: UI Integration
⚠️messagesisMessageInfo<ChatMessage>[]and cannot be passed directly toBubble.List. It must be mapped to{ key, role, content, loading }format. `Bubble.List` uses the `role` prop (notroles) to configure role styles.
When ChatMessage is an object type (not string)
When ChatMessage is a complex object (e.g., with content, attachments fields), use contentRender:
🧩 Core Concepts
Data Model
⚠️ Important:messagestype isMessageInfo<ChatMessage>[]; message content is inmsg.message
useXChat Configuration Options
| Option | Type | Description | |||
|---|---|---|---|---|---|
provider | AbstractChatProvider<ChatMessage, Input, Output> | Required, Provider instance | |||
conversationKey | string | Conversation unique identifier, required for multi-conversation | |||
defaultMessages | `DefaultMessageInfo[] \ | () => ... \ | async () => ...` | Default display messages, supports async loading | |
requestPlaceholder | `ChatMessage \ | (requestParams, { messages }) => ChatMessage` | Placeholder message during request | ||
requestFallback | `ChatMessage \ | (requestParams, { error, errorInfo, messages, messageInfo }) => ChatMessage \ | Promise<ChatMessage>` | Fallback message on request failure/abort | |
parser | `(message: ChatMessage) => BubbleMessage \ | BubbleMessage[]` | Convert ChatMessage to component-consumable format, supports one-to-many |
requestFallback'smessageInfotype isMessageInfo<ChatMessage>, the message being updated when the request fails.requestFallbackhandles both network errors (error) and user abort (error.name === 'AbortError').
useXChat Return Values
| Return Value | Type | Description | ||
|---|---|---|---|---|
messages | MessageInfo<ChatMessage>[] | Message list; must be mapped before passing to Bubble.List | ||
parsedMessages | MessageInfo<ParsedMessage>[] | Message list after parser transform (use this when parser is set) | ||
onRequest | (params: Partial<Input>, opts?: { extraInfo: AnyObject }) => void | Add message and trigger request | ||
isRequesting | boolean | Whether request is in progress | ||
abort | () => void | Abort current request | ||
setMessages | (messages: Partial<MessageInfo<ChatMessage>>[]) => void | Directly modify message list, no request triggered | ||
setMessage | `(id: string \ | number, info: Partial<MessageInfo<ChatMessage>>) => void` | Modify single message, no request triggered | |
removeMessage | `(id: string \ | number) => boolean` | Delete a message, returns whether deletion was successful | |
onReload | `(id: string \ | number, params: Partial<Input>, opts?: { extraInfo: AnyObject }) => void` | Regenerate an AI reply | |
queueRequest | `(conversationKey: string \ | symbol, params: Partial<Input>, opts?: { extraInfo: AnyObject }) => void` | Queue request, sent after conversation initializes | |
isDefaultMessagesRequesting | boolean | Whether default messages are async loading |
🔧 Core Function Details
Core functionality reference: CORE.md
🗂️ Multi-conversation Management
useXConversations Hook
useXConversations is a conversation list management Hook provided by @ant-design/x-sdk, used together with useXChat for multi-conversation:
Multi-conversation Full Pattern
queueRequest: Delayed Send After Conversation Switch
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpackages/x-skill/skills/use-x-chat/SKILL.md
Popularity
- Repository stars
- 4,706
- Repository forks
- 1,142
- 7-day trend score
- 42
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ant-design/x/use-x-chat)