api-client

Manage authentication, token refresh, and request deduplication for TanStack Query API clients.

783|62|Updated Jan 19, 2026
One-click install
npx skills add https://github.com/dadbodgeoff/drift --skill api-client-dadbodgeoff
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-client
Source: https://github.com/dadbodgeoff/drift/tree/main/drift%20v1%20depreciated/skills/api-client
Command: npx skills add https://github.com/dadbodgeoff/drift --skill api-client-dadbodgeoff

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a robust and type-safe way to interact with backend APIs, handling common challenges like authentication, token refresh, and error management automatically.

Core Features & Use Cases

  • Type Safety: Ensures requests and responses are correctly typed, reducing runtime errors.
  • Automatic Token Refresh: Handles expired access tokens by refreshing them in the background without interrupting the user.
  • Request Deduplication: Prevents multiple identical requests from being sent simultaneously, especially during token refresh.
  • TanStack Query Integration: Seamlessly integrates with TanStack Query for efficient data caching and state management.
  • Use Case: When building a dashboard that fetches user data, posts updates, and requires authentication, this client ensures a smooth and secure experience by managing API calls and token validity.

Quick Start

Use the api-client skill to fetch the current user's profile.

Frequently Asked Questions about api-client

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

FAQPage Schema
How do I handle token refresh automatically in a TypeScript API client?

A TypeScript API client can handle token refresh automatically by intercepting expired token responses and refreshing them in the background. This prevents user interruption while maintaining secure authentication.

What is the best way to prevent duplicate HTTP requests during authentication?

To prevent duplicate HTTP requests during authentication, an API client can implement request deduplication. This mechanism prevents multiple identical requests from being sent simultaneously, which is especially critical during token refresh cycles.

How do I integrate a type-safe API client with TanStack Query?

You integrate a type-safe API client with TanStack Query by connecting the centralized client to manage data fetching and caching. This integration ensures type safety for requests and responses while leveraging efficient state management.

Does this API client approach work for managing authentication in frontend dashboards?

Yes, this API client approach works for frontend dashboards by centralizing authentication, managing token validity, and handling errors automatically. It ensures a secure experience when fetching user data or posting updates.

Why do I need request deduplication when building an API client?

You need request deduplication in an API client to prevent multiple identical requests from being sent simultaneously. This optimizes network usage and avoids race conditions, particularly when multiple components trigger the same token refresh.