API Client

Codify type-safe API client patterns for Node.js and Python.

1|Updated Sep 14, 2025
One-click install
npx skills add https://github.com/CleanExpo/DR-NRPG --skill api-client-cleanexpo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: API Client
Source: https://github.com/CleanExpo/DR-NRPG/tree/main/.skills/custom/api-client
Command: npx skills add https://github.com/CleanExpo/DR-NRPG --skill api-client-cleanexpo

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill streamlines API interactions by providing type safety, automatic request/response transformations, and robust error handling, reducing boilerplate code and potential bugs.

Core Features & Use Cases

  • Type-Safe Fetch: Ensures requests and responses match predefined TypeScript or Pydantic models.
  • Interceptors: Centralizes logic for authentication, logging, and data transformation (e.g., snake_case to camelCase).
  • Automatic Retries: Implements retry logic for transient errors, respecting Retry-After headers.
  • Use Case: When building a new feature that consumes a backend API, use this Skill to create a typed client that automatically adds authentication tokens, logs requests, and retries on 429 errors, ensuring a consistent and reliable integration.

Quick Start

Use the api-client skill to create a typed fetch wrapper for the '/users' endpoint.

Frequently Asked Questions about API Client

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

FAQPage Schema
How do I create a type-safe fetch wrapper in TypeScript?

Type-safe fetch wrappers ensure requests and responses match predefined TypeScript models by codifying API client patterns. This approach centralizes data transformation logic, enforces strict typing for API payloads, and reduces boilerplate code. Interceptors manage authentication and logging dynamically.

How do you implement automatic retry logic for HTTP 429 errors?

Automatic retry logic for 429 errors handles rate-limited responses by implementing request interceptors that automatically retry failed requests. The system respects the Retry-After header to determine the wait time, ensuring reliable API integration without manual intervention.

Does this API client pattern work with Next.js server components?

Yes, the API client pattern provides specific implementations for Next.js server components. It supports both browser and server environments by codifying typed fetch wrappers that handle server-side data fetching while maintaining type safety and error normalization.

How do API interceptors handle snake_case to camelCase conversion?

API interceptors handle snake_case to camelCase conversion by centralizing data transformation logic within the request and response lifecycle. This utility automatically maps API payload fields to the desired case format, ensuring consistent data structures across your application.

How do I normalize API errors in a Python httpx client?

Normalizing API errors in a Python httpx client involves wrapping requests with interceptors that catch and standardize error responses. The Skill codifies robust error handling patterns for Python applications, transforming varied HTTP errors into a consistent format.

What is the best way to add authentication tokens to API requests?

The best way to add authentication tokens is using request interceptors to centralize logic. By attaching tokens dynamically within the interceptor pipeline before the fetch executes, you ensure consistent authentication headers across all API calls without duplicating code.