antdv-next/x/use-x-chat

Claude Code and agent skill by antdv-next/x

Trust tier 2
  • community
LLM review pending
Source check pending

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, etc.

Install

npx vskill@latest install antdv-next/x/use-x-chat

SKILL.md

🎯 Skill Positioning

Core Positioning: Use the useXChat Hook to build professional AI conversation applications Prerequisites: Already have a custom Chat Provider (refer to x-chat-provider skill)

Table of Contents

πŸš€ Quick Start

1. Dependency Management

🎯 Automatic Dependency Handling
πŸ“‹ System Requirements
  • @antdv-next/x-sdk: latest version (automatically installed)
  • @antdv-next/x: latest version (UI components, automatically installed)
⚠️ Version Issue Auto-fix

If version mismatch is detected, the skill will automatically:

  • βœ… Prompt current version status
  • βœ… Provide fix suggestions
  • βœ… Use relative paths to ensure compatibility
🎯 Built-in Version Check

The use-x-chat skill has built-in version checking functionality, automatically checking version compatibility on startup:

πŸ” Auto-check Function The skill will automatically check if the @antdv-next/x-sdk version meets requirements on startup:

πŸ“‹ Check Contents:

  • βœ… Currently installed version
  • βœ… Whether it meets minimum requirements
  • βœ… Automatically provide fix suggestions
  • βœ… Friendly error prompts

πŸ› οΈ Version Issue Fix If version mismatch is detected, the skill will provide specific fix commands:

bash
# Auto-prompted fix commands
npm install @antdv-next/x-sdk@latest

2. Three-step Integration

Step 1: Prepare Provider

This part is handled by the x-chat-provider skill

ts
import { MyChatProvider } from "./MyChatProvider";
import { XRequest } from "@antdv-next/x-sdk";
// Recommended to use XRequest as the default request method
const provider = new MyChatProvider({
// Default use XRequest, no need for custom fetch
request: XRequest("https://your-api.com/chat"),
// When requestPlaceholder is set, placeholder message will be displayed before request starts
requestPlaceholder: {
content: "Thinking...",
role: "assistant",
timestamp: Date.now(),
},
// When requestFallback is set, fallback message will be displayed when request fails
requestFallback: (_, { error, errorInfo, messageInfo }) => {
if (error.name === "AbortError") {
return {
content: messageInfo?.message?.content || "Reply cancelled",
role: "assistant" as const,
timestamp: Date.now(),
};
}
return {
content:
errorInfo?.error?.message || "Network error, please try again later",
role: "assistant" as const,
timestamp: Date.now(),
};
},
});
Step 2: Basic Usage
tsx
import { defineComponent } from "vue";
import { useXChat } from "@antdv-next/x-sdk";
const ChatComponent = defineComponent(() => {
const { messages, onRequest, isRequesting } = useXChat({ provider });
return () => (
<div>
{messages.value.map(msg => (
<div key={msg.id}>
{msg.message.role}: {msg.message.content}
</div>
))}
<button onClick={() => onRequest({ query: "Hello" })}>Send</button>
</div>
);
});
Step 3: UI Integration
tsx
import { defineComponent } from "vue";
import { Bubble, Sender } from "@antdv-next/x";
import { useXChat } from "@antdv-next/x-sdk";
const ChatUI = defineComponent(() => {
const { messages, onRequest, isRequesting, abort } = useXChat({ provider });
return () => (
<div style={{ height: "600px" }}>
<Bubble.List items={messages.value} />
<Sender
loading={isRequesting.value}
onSubmit={content => onRequest({ query: content })}
onCancel={abort}
/>
</div>
);
});

🧩 Core Concepts

Technology Stack Architecture

mermaid
graph TD
A[useXChat Hook] --> B[Chat Provider]
B --> C[XRequest]
A --> D[Antdv Next X UI]
D --> E[Bubble Component]
D --> F[Sender Component]
Data Model
⚠️ Important Reminder: messages type is Ref<MessageInfo<MessageType>[]>, not direct MessageType. Access via messages.value.
ts
interface MessageInfo<Message> {
id: number | string; // Message unique identifier
message: Message; // Actual message content
status: MessageStatus; // Sending status
extraInfo?: AnyObject; // Extended information
}
// Message status enum
type MessageStatus =
"local" | "loading" | "updating" | "success" | "error" | "abort";

πŸ”§ Core Function Details

πŸ’‘ Tip: API may update with versions, it is recommended to check official documentation for the latest information

Core functionality reference content CORE.md

πŸ“‹ Prerequisites and Dependencies

⚠️ Important Dependencies

use-x-chat must depend on one of the following skills:

Dependency TypeSkillDescriptionRequired
Core Dependencyx-chat-providerProvides custom Provider instance, default uses XRequest, must be used with use-x-chatRequired
OrBuilt-in ProviderOpenAI/DeepSeek and other built-in Providers, default uses XRequestRequired
Recommended Dependencyx-requestConfigure request parameters and authentication, as the default request methodRecommended

🎯 Usage Scenario Comparison Table

Usage ScenarioRequired Skill CombinationUsage Order
Private API Adaptationx-chat-provider β†’ use-x-chatCreate Provider first, then use
Standard API Usageuse-x-chat (built-in Provider)Direct use
Authentication Configuration Neededx-request β†’ use-x-chatConfigure request first, then use
Complete Customizationx-chat-provider β†’ x-request β†’ use-x-chatComplete workflow

🚨 Development Rules

Before using use-x-chat, must confirm:

  • [ ] Has Provider source (choose one of the following):
  • [ ] Has created custom Provider with x-chat-provider
  • [ ] Decided to use built-in Provider (OpenAI/DeepSeek)
  • [ ] @antdv-next/x-sdk is installed
  • [ ] Understand MessageInfo data structure
  • [ ] UI components are ready
Test Case Rules
  • If the user does not explicitly need test cases, do not add test files
  • Only create test cases when the user explicitly requests them
Code Quality Rules
  • After completion, must check types: Run tsc --noEmit to ensure no type errors
  • Keep code clean: Remove all unused variables and imports

πŸ”— Reference Resources

πŸ“š Core Reference Documentation

  • API.md - Complete API reference documentation
  • EXAMPLES.md - All practical example code

🌐 SDK Official Documentation

πŸ’» Example Code

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
83
Repository forks
11
7-day trend score
22

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/antdv-next/x/use-x-chat/badge)](https://verified-skill.com/skills/antdv-next/x/use-x-chat)

Something wrong with this skill or its page? Tell us.