api-hook-wiring

Wire frontend components to backend APIs using Axios and React Query hooks.

1|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/spuneiartur/claude-agent-specs --skill api-hook-wiring
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-hook-wiring
Source: https://github.com/spuneiartur/claude-agent-specs/tree/main/next-js/skills/skills/api-hook-wiring
Command: npx skills add https://github.com/spuneiartur/claude-agent-specs --skill api-hook-wiring

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Connect frontend features to backend APIs using the project's Axios + React Query system. The project provides custom hooks that wrap React Query with automatic URL building, toast notifications, query invalidation, and router redirects.

Core Features & Use Cases

  • API Service: create api/{resource}.js to define HTTP calls using axiosAuth for admin endpoints and axios for public endpoints.
  • Data fetching: useQuery and useInfiniteQuery wrappers simplify data fetching and pagination, with automatic URL construction and query parameter handling.
  • Mutations and navigation: useMutation-based create/update/delete actions that invalidate lists, show toasts, and support optional redirects.

Quick Start

Create api/{resource}.js, define get/list functions, and wire them to useQuery/useMutation hooks in your components to fetch and mutate data.

Frequently Asked Questions about api-hook-wiring

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

FAQPage Schema
How do I connect React Query to backend APIs with Axios?

To connect React Query to APIs with Axios, create an api/{resource}.js service module defining HTTP calls, then wire them to useQuery and useMutation hooks in your components to fetch and mutate data.

What is the best way to handle cache invalidation and toasts with React Query mutations?

The best way to handle cache invalidation with React Query mutations is using custom useMutation wrappers that automatically invalidate query lists, show toast notifications, and support optional router redirects.

How does useInfiniteQuery work for paginated data fetching in React?

useInfiniteQuery wrappers simplify paginated data fetching in React by automatically constructing URLs and handling query parameters, streamlining pagination across pages and components.

Do I need separate Axios instances for admin and public endpoints?

Yes, you need separate Axios instances for endpoint security: use axiosAuth for admin endpoints and standard axios for public endpoints when defining HTTP calls in your api/{resource}.js module.

Can I automatically redirect users after a React Query mutation?

Yes, you can redirect users after a React Query mutation because the custom useMutation hooks support optional router redirects alongside automatic cache invalidation and toast notifications.

Why does my React Query hook fail to build the correct API URL?

React Query hooks fail to build API URLs when bypassing the provided custom wrappers, which handle automatic URL construction and query parameter handling based on your api/{resource}.js definitions.