Agent skill · Backend & API

api-client

Centralized TypeScript API client with typed namespaces, automatic token refresh with request deduplication, TanStack Query integration, and consistent error handling.

majiayu000github.com/majiayu000GitHub ↗
claude-codeMIT
Install
npx skills add majiayu000/claude-skill-registry --skill api-client --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 8 KB
Bundled scripts: none
Requires: TypeScript/JavaScript
Path: skills/api/api-client/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# TypeScript API Client Centralized API client with typed namespaces, automatic token refresh, and TanStack Query integration. ## When to Use This Skill - Building frontend applications that call backend APIs - Need type safety on requests and responses - Want automatic token refresh without duplicated logic - Using TanStack Query for caching and state management ## Core Concepts The pattern provides: - Typed namespaces (auth, users, billing, etc.) - Automatic token refresh with request deduplication - TanStack Query integration for caching - Consistent error handling with custom error class Architecture: ``` Component → useQuery/useMutation → API Client → Fetch ↓ 401? → Refresh → Retry ``` ## Implementation ### TypeScript ```typescript // lib/api/types.ts export class APIClientError extends Error { constructor( message: string, public code: string, public statusCode: number, public details?: Record<string, unknown> ) { super(message); this.name = 'APIClientError'; } } export interface TokenPair { accessToken: string; refreshToken: string; expiresAt: string; } // lib/api/client.ts interface RequestOptions { method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; body?: Record<string,

What's inside
Steps it walks through
  1. When to Use This Skill
  2. Core Concepts
  3. Implementation
  4. TypeScript
  5. TanStack Query Integration
  6. Usage Examples
  7. Component Usage
  8. Best Practices
  9. Common Mistakes
  10. Related Patterns
Ships with 1 file
  • metadata.json
More from claude-skill-registry
All skills →
About this skill
What does the api-client skill do?

Centralized TypeScript API client with typed namespaces, automatic token refresh with request deduplication, TanStack Query integration, and consistent error handling.

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill api-client --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going