Skip to content

LeandroBenjaminL/lend-ai / skills/frontend-api-integration

frontend-api-integration

Verified

Consumo de APIs en el frontend — TanStack Query, fetch, Axios. Caché, refetch, optimistic updates y manejo de errores. Trigger: Cuando necesitás consumir APIs desde el frontend, cachear respuestas, o manejar estados de carga/error.

FileKindSize
SKILL.mdskill md1.9 KB
---
name: frontend-api-integration
description: >
  Consumo de APIs en el frontend — TanStack Query, fetch, Axios.
  Caché, refetch, optimistic updates y manejo de errores.
  Trigger: Cuando necesitás consumir APIs desde el frontend, cachear respuestas, o manejar estados de carga/error.
license: MIT
metadata:
  author: Leandro Benjamin L.
  version: "2.0"
  model_tier: T3-balanced
---

# Skill: frontend-api-integration

APIs en el frontend. Que los datos lleguen sin romper la UI.

## Trigger

- Un componente necesita traer datos de una API
- Las llamadas se repiten sin cachear
- Querés hacer optimistic update (cambiar la UI antes de la respuesta)
- Hay que manejar loading, error y retry

## Workflow LEND

1. ANALIZAR
   ├── Stack: ¿TanStack Query ya está en el proyecto?
   ├── Tipo: ¿GETs, POSTs, suscripciones? ¿REST o GraphQL?
   ├── Caché: ¿los datos cambian seguido? ¿pueden ser stale?
   └── Errores: ¿cómo se muestran? ¿toast, inline, página de error?

2. OFRECER (Menú del Senior)
   ├── A) TanStack Query — caché, refetch, paginación, mutations
   ├── B) fetch nativo — sin dependencias, para apps chicas
   └── C) SWR — liviano, stale-while-revalidate, si no necesitás mutations complejas

3. ELEGIR → confirmación

4. HACER
   ├── TanStack Query: useQuery + useMutation con queryClient central
   ├── Caché: staleTime configurado (no dejar defaults de 0)
   ├── Errores: onError global + retry con backoff
   ├── Optimistic updates: onMutate actualiza caché, onError rollback
   ├── Loading: useQuery isLoading vs isFetching (la primera carga vs refetch)
   └── Tipado: respuesta tipada con genéricos (useQuery<Datos>)

5. VERIFICAR
   ├── Las llamadas se cachean correctamente (Network tab)
   ├── Los errores se muestran al usuario
   └── El refetch funciona después de una mutación (invalidateQueries)
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall