antdv-next/x/x-request

Claude Code and agent skill by antdv-next/x

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Focus on explaining the practical configuration and usage of XRequest, providing accurate configuration instructions based on official documentation

Install

npx vskill@latest install antdv-next/x/x-request

SKILL.md

🎯 Skill Positioning

This skill focuses on solving: How to correctly configure XRequest to adapt to various streaming interface requirements.

Table of Contents

πŸš€ Quick Start

Dependency Management

πŸ“‹ System Requirements
PackageVersion RequirementAuto InstallPurpose
@antdv-next/x-sdkβ‰₯2.2.2βœ…Core SDK, includes XRequest tool
πŸ› οΈ One-click Installation
bash
# Recommended to use tnpm
tnpm install @antdv-next/x-sdk
# Or use npm
npm add @antdv-next/x-sdk
# Check version
npm ls @antdv-next/x-sdk

Basic Configuration

Simplest Usage
typescript
import { XRequest } from "@antdv-next/x-sdk";
// Minimal configuration: only need to provide API URL
const request = XRequest("https://api.example.com/chat");
// For manual control (used in Provider scenarios)
const providerRequest = XRequest("https://api.example.com/chat", {
manual: true, // Usually only this needs explicit configuration
});
πŸ’‘ Tip: XRequest has built-in reasonable default configurations. In most cases, you only need to provide the API URL to use it.

πŸ“¦ Technology Stack Overview

πŸ—οΈ Technology Stack Architecture

mermaid
graph TD
A[XRequest] --> B[Network Requests]
A --> C[Authentication Management]
A --> D[Error Handling]
A --> E[Streaming Processing]
B --> F[fetch Wrapper]
C --> G[Token Management]
D --> H[Retry Mechanism]
E --> I[Server-Sent Events]

πŸ”‘ Core Concepts

ConceptRole PositioningCore ResponsibilitiesUsage Scenarios
XRequest🌐 Request ToolHandle all network communication, authentication, error handlingUnified request management
Global Configβš™οΈ Config CenterConfigure once, use everywhereReduce duplicate code
Streaming ConfigπŸ”„ Streaming ProcessingSupport SSE and JSON response formatsAI conversation scenarios

πŸ”§ Core Configuration Details

Core functionality reference content CORE.md

πŸ›‘οΈ Security Guide

Environment Security Configuration

🌍 Security Strategies for Different Environments
Runtime EnvironmentSecurity LevelConfiguration MethodRisk Description
Browser FrontendπŸ”΄ High Risk❌ Prohibit key configurationKeys will be directly exposed to users
Node.js Backend🟒 Safeβœ… Environment variable configurationKeys stored on server side
Proxy Service🟒 Safeβœ… Same-origin proxy forwardingKeys managed by proxy service
πŸ” Authentication Methods Comparison
Authentication MethodApplicable EnvironmentConfiguration ExampleSecurity
Bearer TokenNode.jsBearer ${process.env.API_KEY}βœ… Safe
API Key HeaderNode.jsX-API-Key: ${process.env.KEY}βœ… Safe
Proxy ForwardingBrowser/api/proxy/serviceβœ… Safe
Direct ConfigurationBrowserBearer sk-xxx❌ Dangerous

πŸ” Debugging and Testing

Debug Configuration

πŸ› οΈ Debug Templates

Node.js Debug Configuration:

typescript
// Safe debug configuration (Node.js environment)
const debugRequest = XRequest("https://your-api.com/chat", {
headers: {
Authorization: `Bearer ${process.env.DEBUG_API_KEY}`,
},
params: { query: "test message" },
});

Frontend Debug Configuration:

typescript
// Safe debug configuration (frontend environment)
const debugRequest = XRequest("/api/debug/chat", {
params: { query: "test message" },
});

Configuration Validation

βœ… Security Check Tools
typescript
// Security configuration validation function
const validateSecurity = (config: any) => {
const isBrowser = typeof window !== "undefined";
const hasAuth =
config.headers?.Authorization || config.headers?.authorization;
if (isBrowser && hasAuth) {
throw new Error(
"❌ Frontend environment prohibits Authorization configuration, risk of key leakage!",
);
}
console.log("βœ… Security configuration check passed");
return true;
};
// Usage example
validateSecurity({
headers: {
// Do not include Authorization
},
});

πŸ“‹ Usage Scenarios

Standalone Usage

🎯 Direct Request Initiation
typescript
import { XRequest } from "@antdv-next/x-sdk";
// Test interface availability
const testRequest = XRequest("https://httpbin.org/post", {
params: { test: "data" },
});
// Send request immediately
const response = await testRequest();
console.log(response);

Integration with Other Skills

πŸ”„ Skill Collaboration Workflow
mermaid
graph TD
A[x-request] -->|Configure Request| B[x-chat-provider]
A -->|Configure Request| C[use-x-chat]
B -->|Provide Provider| C
A --> D[Direct Request]
Usage MethodCooperating SkillPurposeExample
StandaloneNoneDirect network request initiationTest interface availability
With x-chat-providerx-chat-providerConfigure requests for custom ProviderConfigure private API
With use-x-chatuse-x-chatConfigure requests for built-in ProviderConfigure OpenAI API
Complete AI Applicationx-request β†’ x-chat-provider β†’ use-x-chatConfigure requests for entire systemComplete AI conversation application
⚠️ useXChat Integration Security Warning

Important Warning: useXChat is only for frontend environments, XRequest configuration must not contain Authorization!

❌ Incorrect Configuration (Dangerous):

typescript
// Extremely dangerous: keys will be directly exposed to browser
const unsafeRequest = XRequest("https://api.openai.com/v1/chat/completions", {
headers: {
Authorization: "Bearer sk-xxxxxxxxxxxxxx", // ❌ Dangerous!
},
manual: true,
});

βœ… Correct Configuration (Safe):

typescript
// Frontend security configuration: use proxy service
const safeRequest = XRequest("/api/proxy/openai", {
params: {
model: "gpt-3.5-turbo",
stream: true,
},
manual: true,
});

🚨 Development Rules

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

βœ… Configuration Checklist

Before using XRequest, please confirm the following configurations are correctly set:

πŸ” Configuration Checklist
Check ItemStatusDescription
API URLβœ… Must ConfigureXRequest('https://api.xxx.com')
Auth Info⚠️ Environment RelatedFrontend❌Prohibited, Node.jsβœ…Available
manual Configβœ… Provider ScenarioIn Provider needs to be set to true, other scenarios need to be set according to actual situation
Other Config❌ No Need to ConfigureBuilt-in reasonable default values
Interface Availabilityβœ… Recommended TestVerify with debug configuration
πŸ› οΈ Quick Verification Script
typescript
// Check configuration before running
const checkConfig = () => {
const checks = [
{
name: "Global Configuration",
test: () => {
// Check if global configuration has been set
return true; // Check according to actual situation
},
},
{
name: "Security Configuration",
test: () => validateSecurity(globalConfig),
},
{
name: "Type Check",
test: () => {
// Run tsc --noEmit
return true;
},
},
];
checks.forEach(check => {
console.log(`${check.name}: ${check.test() ? "βœ…" : "❌"}`);
});
};

🎯 Skill Collaboration

mermaid
graph LR
A[x-request] -->|Configure Request| B[x-chat-provider]
A -->|Configure Request| C[use-x-chat]
B -->|Provide Provider| C
πŸ“Š Skill Usage Comparison Table
Usage ScenarioRequired SkillsUsage OrderCompletion Time
Test Interfacex-requestDirect Use2 minutes
Private API Adaptationx-request β†’ x-chat-providerConfigure request first, then create Provider10 minutes
Standard AI Applicationx-request β†’ use-x-chatConfigure request first, then build interface15 minutes
Complete Customizationx-request β†’ x-chat-provider β†’ use-x-chatComplete workflow30 minutes

πŸ”— Reference Resources

πŸ“š Core Reference Documentation

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

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

Source

Popularity

Repository stars
67
Repository forks
10
7-day trend score
21

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/x-request/badge)](https://verified-skill.com/skills/antdv-next/x/x-request)

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