building-api-clients

Installation
SKILL.md

Building Type-Safe API Clients

1. Architecture Overview

Feature API Layer (hello-api.ts, items-api.ts)
  | imports
Global API Layer (src/lib/api/)
  - api-client.ts        (typedGet/Post/Put/Delete, apiRequestWrapper)
  - api.types.ts         (ApiResult, ApiError, ErrorCode)
  - error-handler.ts     (extractMessage, dev error toasts)
  - query-utils.ts       (query strings, pagination)
  - validation-utils.ts  (Zod validation helpers)
  | fetch()
Backend API

Feature API files live alongside the feature they serve (e.g., src/mfes/items/api/items-api.ts). They import shared utilities from the global API layer at src/lib/api/. The global layer handles HTTP mechanics, error normalization, and validation. Feature layers handle endpoint-specific logic, Zod schemas, and type exports.

Installs
2
First Seen
Mar 22, 2026
building-api-clients — quick-brown-foxxx/coding_rules_ts