integrate-api-client

Connect frontend code to backend APIs using typed clients, caching, and error handling.

Updated Feb 10, 2026
One-click install
npx skills add https://github.com/vesviet/agent-skills --skill integrate-api-client-vesviet
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: integrate-api-client
Source: https://github.com/vesviet/agent-skills/tree/main/core/skills/frontend/integrate-api-client
Command: npx skills add https://github.com/vesviet/agent-skills --skill integrate-api-client-vesviet

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Frontend features often break when API integrations are wired inconsistently: untyped responses, duplicated request logic, missing loading or error states, and unsafe retries. This Skill guides the integration of backend APIs into frontend code following the repository's existing request, caching, auth, and state-management patterns. ## Core Features & Use Cases - Typed API Contracts: Enforce type safety between API contracts and frontend usage with Zod schemas, Orval, or openapi-typescript generated types. - TanStack Query v5 Patterns: Centralize query keys and fetchers in queryOptions factories, and implement full optimistic mutation lifecycles with rollback handlers. - React 19 Integration: Use the use() hook for RSC streaming and useActionState for straightforward form mutations, reserving useMutation for complex cache manipulation. - Use Case: When adding a dashboard page that reads and mutates backend data, use this Skill to build a typed client hook, wire loading and error states, and add tests covering success, failure, and cache invalidation paths. ## Quick Start Use the integrate-api-client skill to connect this new settings page to the backend profile API with typed responses and proper error handling.

Frequently Asked Questions about integrate-api-client

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

FAQPage Schema
How do I connect a React frontend to a backend API with type safety?▼

Define the request and response contract first, then generate types with Orval or openapi-typescript from the OpenAPI spec, or validate responses with Zod schemas. Build a narrow client hook that reuses the repo's existing data-fetching pattern rather than duplicating request logic.

TanStack Query vs React 19 use() hook for data fetching?▼

Use React 19's use() hook in Server Components for RSC streaming and initial page load data. Keep TanStack Query for interactive client-side operations needing cache invalidation, background refetching, or request deduplication.

How do I implement optimistic updates with TanStack Query v5?▼

Implement the full lifecycle: onMutate cancels in-flight queries, snapshots state, and applies the update; onError rolls back from the snapshot; onSettled invalidates the query. Use functional updater syntax in setQueryData to avoid stale state captures.

Should I retry failed POST or DELETE API requests?▼

Non-idempotent mutations like POST or DELETE must not be retried without an explicit idempotency key. Require the key on every such mutation and reject retry logic that omits it to prevent duplicate side effects.

When should I use useActionState instead of useMutation?▼

Use React 19's useActionState for straightforward form actions and state updates. Keep TanStack Query's useMutation for complex mutations requiring advanced cache manipulation, pagination updates, or optimistic UI responses.