typescript-api-client

Build type-safe REST API clients using Zod schemas and ky.

92|14|Updated Jan 22, 2026
One-click install
npx skills add https://github.com/AbianS/rustrak --skill typescript-api-client
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-api-client
Source: https://github.com/AbianS/rustrak/tree/main/.claude/skills/typescript-api-client
Command: npx skills add https://github.com/AbianS/rustrak --skill typescript-api-client

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers build robust TypeScript REST API clients by enforcing a schema-first approach with Zod, a resource-based architecture, and a lightweight HTTP client (ky). It reduces boilerplate, improves type safety at compile time and runtime, and provides a maintainable pattern for APIs with pagination and retries.

Core Features & Use Cases

  • Schema-first development: define schemas with Zod and infer TS types to ensure runtime validation.
  • Resource-based client: organize code into resources per API group with a common BaseResource for shared logic.
  • Ky-powered HTTP with built-in retry and structured error handling, including a typed error hierarchy.
  • Use Case: quickly scaffold a typed SDK for internal services or public APIs, with pagination support and robust error handling.

Quick Start

Install dependencies (zod, ky) and create a client following the patterns in this skill, then instantiate and call an endpoint to verify end-to-end type safety.

Frequently Asked Questions about typescript-api-client

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

FAQPage Schema
How do I build a type-safe REST API client in TypeScript with runtime validation?

Build a type-safe REST API client in TypeScript by enforcing a schema-first approach with Zod for runtime validation and inferring types. Organize API groups into resources using a BaseResource pattern to share logic and reduce boilerplate.

What is the best way to handle pagination and retries in a TypeScript SDK?

Handle pagination and retries in a TypeScript SDK by leveraging the ky HTTP client. It provides built-in retry semantics and structured error handling, ensuring robust request management for paginated API endpoints.

How does a schema-first approach improve TypeScript API client development?

A schema-first approach improves TypeScript API client development by using Zod schemas to enforce runtime validation and infer TypeScript types. This ensures compile-time and runtime type safety, reducing errors and boilerplate.

Can I use ky and Zod together to structure API client errors?

Yes, you can use ky and Zod together to structure API client errors. This combination supports a comprehensive typed error hierarchy with retry semantics, providing clear error handling and maintainable SDK patterns.

Do I need a resource-based architecture for my TypeScript REST client?

You need a resource-based architecture for your TypeScript REST client to maintain organized, scalable code. Structuring code into resources per API group with a common BaseResource ensures shared logic is maintainable across expanding endpoints.

Why should I choose ky for building a TypeScript API client over other HTTP libraries?

Choose ky for building a TypeScript API client to gain a lightweight HTTP client with built-in retry mechanisms. It pairs effectively with Zod schemas to provide structured error handling and type safety for robust SDK development.