api-request

Automate HTTP API integration and error handling in Vue 2 projects using Axios.

Updated Jan 16, 2025
One-click install
npx skills add https://github.com/cctyl/bili-rec-web --skill api-request-cctyl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-request
Source: https://github.com/cctyl/bili-rec-web/tree/main/.claude/skills/api-request-skill
Command: npx skills add https://github.com/cctyl/bili-rec-web --skill api-request-cctyl

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automation standardizes HTTP API request development for frontend projects, streamlining API definitions, invocation, and consistent response/error handling to reduce boilerplate and ensure reliability.

Core Features & Use Cases

  • Centralized API definitions in src/api/index.js and a unified Axios wrapper in src/api/ajax.js, with utility helpers in plugins/utils.js for messaging.
  • Uniform response format with code, message, and data to simplify error handling and UI state management.
  • Clear conventions for API methods (GET/POST/PUT/DELETE), parameter passing (path, query, body), and practical usage patterns in Vue 2 projects.

Quick Start

Add a new API method in src/api/index.js, call it from a component, and handle the standard response with code, message, and data.

Frequently Asked Questions about api-request

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I centralize API requests and standardize error handling in a Vue 2 frontend?

To centralize API requests in a Vue 2 frontend, define API methods in a dedicated module and use a unified Axios wrapper to automate HTTP calls. This establishes a standard response format with code, message, and data, simplifying error handling across components.

What is the best way to structure Axios API calls for consistent HTTP response handling?

The best way to structure Axios API calls for consistent HTTP response handling is to use a unified wrapper that enforces a standard response format containing code, message, and data. This standardizes UI state management and reduces boilerplate error handling code.

How do I define GET, POST, PUT, and DELETE API methods with path, query, and body parameters?

To define GET, POST, PUT, and DELETE API methods, establish clear conventions for API interface design in a centralized module. Pass parameters via path, query, or body based on the HTTP method, routing them through a unified Axios wrapper for execution.

Can I use this centralized Axios wrapper for frontend API integration without additional dependencies?

Yes, you can use the centralized Axios wrapper for frontend API integration without external dependencies. It relies on a standardized response format and utility helpers for messaging, requiring only a centralized API module and the Axios wrapper itself.

Why does my frontend API integration require a standardized response format with code, message, and data?

Frontend API integration requires a standardized response format with code, message, and data to simplify error handling and UI state management. Enforcing this structure across all HTTP API requests ensures reliability and reduces boilerplate code in components.

When do I need to add a new API method to my centralized frontend API module?

You need to add a new API method to your centralized frontend API module whenever a component requires a new HTTP request. Define the method using standard GET, POST, PUT, or DELETE conventions, then call it from the component to handle the standard response.