Agent skill

Frontend API Integration Patterns

by sickn33 in sickn33/agentic-awesome-skills

Production-ready patterns for integrating frontend applications with backend APIs, including race condition handling, request cancellation, retry strategies, error normalization, and UI state…

MITAuto-check passedFrontend & Design

Install Frontend API Integration Patterns

skills CLI
$ npx skills add sickn33/agentic-awesome-skills --skill frontend-api-integration-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install sickn33/agentic-awesome-skills frontend-api-integration-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/sickn33/agentic-awesome-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/frontend-api-integration-patterns .claude/skills/frontend-api-integration-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
frontend-api-integration-patterns
GitHub stars
47k
Used in
1 other repo
Token cost
~1.9k tokens
SKILL.md length
384 words
Files
1
Skills in repo
1,394
Repo updated
First seen
Licence
MIT

At a glance

Production-ready patterns for integrating frontend applications with backend APIs, including race condition handling, request cancellation, retry strategies, error normalization, and UI state…

  • Works in 6 steps: API Layer (Separation of Concerns) → Race-Safe State Management → Request Cancellation (AbortController) → …
  • Tasks that involve Third-party API integration
  • SKILL.md covers Overview, When to Use This Skill, Core Patterns and Examples, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Frontend API Integration Patterns is an agent skill from sickn33/agentic-awesome-skills. Production-ready patterns for integrating frontend applications with backend APIs, including race condition handling, request cancellation, retry strategies, error normalization, and UI state management.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Frontend & Design, covering Third-party API integration, Async programming and State management. The repository describes itself as: AAS Core is the local, agent-first control plane for complete catalog discovery, agent-owned selection, stack validation, and planning, backed by 2,400+ agentic skills. Includes… The licence is MIT.

When your agent uses it

  • Tasks that involve Third-party API integration
  • Tasks that involve Async programming
  • Tasks that involve State management

Example prompts

  • “/frontend-api-integration-patterns”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. API Layer (Separation of Concerns)
  2. Race-Safe State Management
  3. Request Cancellation (AbortController)
  4. Retry with Exponential Backoff
  5. Debounced API Calls
  6. Request Deduplication

What it can do on your machine

Read from SKILL.md and the folder at commit 1e53ce2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are javascript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • developer.mozilla.org
    • react.dev
    • axios-http.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Frontend API Integration Patterns loads about 1.9k tokens when it runs. Until then it costs about 59 tokens; SKILL.md has 384 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~59
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from sickn33/agentic-awesome-skills at commit 1e53ce2, republished under its MIT licence (© sickn33). 384 words, ~1,926 tokens.

Download SKILL.mdSave it as .claude/skills/frontend-api-integration-patterns/SKILL.md (or your agent's skills folder).
name
frontend-api-integration-patterns
description
Production-ready patterns for integrating frontend applications with backend APIs, including race condition handling, request cancellation, retry strategies, error normalization, and UI state management.
category
frontend
risk
safe
source
community
date_added
2026-04-23
author
avij1109
tags
frontend, api-integration, javascript, react, async
tools
claude, cursor, gemini, codex

Frontend API Integration Patterns

Overview

This skill provides production-ready patterns for integrating frontend applications with backend APIs.

Most frontend issues are not caused by APIs being difficult to call, but by incorrect handling of asynchronous behavior—leading to race conditions, stale data, duplicated requests, and poor user experience.

This skill focuses on correctness, resilience, and user experience, not just making API calls work.


When to Use This Skill

  • Connecting frontend apps (React, React Native, Vue, etc.) to backend APIs
  • Integrating ML/AI endpoints (/predict, /recommend)
  • Handling asynchronous data in UI
  • Fixing stale data, flickering UI, or duplicate requests
  • Designing scalable frontend API layers

Core Patterns

1. API Layer (Separation of Concerns)

Centralize API logic and normalize errors.

js
export class ApiError extends Error {
  constructor(message, status, payload = null) {
    super(message);
    this.name = "ApiError";
    this.status = status;
    this.payload = payload;
  }
}

export const apiClient = async (url, options = {}) => {
  const res = await fetch(url, {
    headers: { "Content-Type": "application/json" },
    ...options,
  });

  if (!res.ok) {
    let payload = null;
    try {
      payload = await res.json();
    } catch (_) {}

    throw new ApiError(
      payload?.message || "Request failed",
      res.status,
      payload
    );
  }

  // handle empty responses safely (e.g. 204 No Content)
  if (res.status === 204) return null;

  const text = await res.text();
  return text ? JSON.parse(text) : null;
};

2. Race-Safe State Management

Prevent stale responses from overwriting fresh data.

js
useEffect(() => {
  let cancelled = false;

  const load = async () => {
    try {
      setLoading(true);
      setError(null);

      const result = await getUser();

      if (!cancelled) setData(result);
    } catch (err) {
      if (!cancelled) setError(err.message);
    } finally {
      if (!cancelled) setLoading(false);
    }
  };

  load();

  return () => {
    cancelled = true;
  };
}, []);

Use a cancellation flag for non-fetch async logic. For network requests, prefer AbortController.


3. Request Cancellation (AbortController)

Cancel in-flight requests to avoid memory leaks and stale updates.

js
useEffect(() => {
  const controller = new AbortController();

  const load = async () => {
    try {
      const data = await getUser({ signal: controller.signal });
      setData(data);
    } catch (err) {
      if (err.name === "AbortError") return;
      setError(err.message);
    }
  };

  load();
  return () => controller.abort();
}, [userId]);

4. Retry with Exponential Backoff

Retry only transient failures (5xx or network errors).

js
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));

const fetchWithBackoff = async (fn, retries = 3, delay = 300) => {
  try {
    return await fn();
  } catch (err) {
    const isAbort = err.name === "AbortError";
    const isHttpError = typeof err.status === "number";
    const isRetryable = !isAbort && (!isHttpError || err.status >= 500);

    if (retries <= 0 || !isRetryable) throw err;

    const nextDelay = delay * 2 + Math.random() * 100;
    await sleep(nextDelay);

    return fetchWithBackoff(fn, retries - 1, nextDelay);
  }
};

5. Debounced API Calls

Avoid excessive API calls (e.g., search inputs).

js
const useDebounce = (value, delay = 400) => {
  const [debounced, setDebounced] = useState(value);

  useEffect(() => {
    const t = setTimeout(() => setDebounced(value), delay);
    return () => clearTimeout(t);
  }, [value, delay]);

  return debounced;
};

6. Request Deduplication

Prevent duplicate API calls across components.

js
const inFlight = new Map();

export const dedupedFetch = (key, fn) => {
  if (inFlight.has(key)) return inFlight.get(key);

  const promise = fn().finally(() => inFlight.delete(key));
  inFlight.set(key, promise);
  return promise;
};

Examples

Example 1: ML Prediction with Cancellation
js
const controllerRef = useRef(null);

const handlePredict = async (input) => {
  controllerRef.current?.abort();
  controllerRef.current = new AbortController();

  try {
    const result = await fetchWithBackoff(() =>
      apiClient("/predict", {
        method: "POST",
        body: JSON.stringify({ text: input }),
        signal: controllerRef.current.signal,
      })
    );

    setOutput(result);
  } catch (err) {
    if (err.name === "AbortError") return;
    setError(err.message);
  }
};

js
const debouncedQuery = useDebounce(query, 400);

useEffect(() => {
  if (!debouncedQuery) return;

  const controller = new AbortController();

  searchAPI(debouncedQuery, { signal: controller.signal })
    .then(setResults)
    .catch((err) => {
      if (err.name !== "AbortError") {
        setError("Search failed. Please try again.");
      }
    });

  return () => controller.abort();
}, [debouncedQuery]);

Example 3: Optimistic UI Update
js
const deleteItem = async (id) => {
  const previous = items;

  setItems((curr) => curr.filter((item) => item.id !== id));

  try {
    await apiClient(`/items/${id}`, { method: "DELETE" });
  } catch (err) {
    setItems(previous);
    setError("Delete failed. Please try again.");
  }
};

Best Practices

  • ✅ Centralize API logic in a dedicated layer
  • ✅ Normalize errors using a custom error class
  • ✅ Always handle loading, error, and success states
  • ✅ Use AbortController for request cancellation
  • ✅ Retry only transient failures (5xx)
  • ✅ Use debouncing for input-driven APIs
  • ✅ Deduplicate identical requests

Show full SKILL.md (141 more words)Show less

Anti-Patterns

  • ❌ Retrying 4xx errors
  • ❌ No request cancellation (memory leaks)
  • ❌ Race-condition-prone state updates
  • ❌ Swallowing errors silently
  • ❌ Global loading/error state for multiple requests
  • ❌ Calling APIs directly inside components repeatedly

Common Pitfalls

Problem: UI shows stale data Solution: Use cancellation or guard against outdated responses

Problem: Too many API calls on input Solution: Use debouncing + cancellation

Problem: Duplicate requests from multiple components Solution: Use request deduplication

Problem: Server overload during retry Solution: Use exponential backoff

Problem: State updates after component unmount Solution: Use AbortController cleanup


Limitations

  • These examples use vanilla JavaScript patterns; adapt them to your framework's data-fetching library when using React Query, SWR, Apollo, Relay, or similar tools.
  • Do not retry non-idempotent mutations unless the backend provides idempotency keys or another duplicate-safe contract.
  • Do not expose privileged API keys in frontend code; proxy sensitive requests through a backend.

Additional Resources


© sickn33, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/frontend-api-integration-patterns of sickn33/agentic-awesome-skills.

Open the folder on GitHubat commit 1e53ce2

Used in 1 other repository

We found 5 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in sickn33/agentic-awesome-skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Frontend API Integration Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Frontend API Integration Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Frontend API Integration Patterns this skillsickn33/agentic-awesome-skills47k1 repos~1.9kAutomated safety check: PassMIT
Phase 6 UI Integrationww-w-ai/bkit-claude-code600—~4.3kAutomated safety check: NotesApache-2.0
Tanstack Querybskimball/tanstack-hono1191 repos~5.4kAutomated safety check: PassMIT
Dsh CI Test ReliabilityZhou-Yujing114514/deepseek-harness-linux116—~2.4kAutomated safety check: PassMIT
Alego CI Test Reliabilitysingula-ai/alego109—~2.4kAutomated safety check: PassMIT
Frontend Engineeringmagnus919/agent-skills111—~1.5kAutomated safety check: PassMIT

Similar skills

  • Phase 6 UI Integration

    ww-w-ai/bkit-claude-code

    Implement frontend UI and integrate with backend APIs — state management and API clients.

    600 GitHub stars~4.3k tokensUpdated 10 days ago
    Frontend & DesignAuto-check: notes
  • Tanstack Query

    bskimball/tanstack-hono

    Powerful asynchronous state management, server-state utilities, and data fetching for TS/JS, React, Vue, Solid, Svelte & Angular.

    119 GitHub starsUsed in 1 repo~5.4k tokens
    Frontend & DesignAuto-check passed
  • Dsh CI Test Reliability

    Zhou-Yujing114514/deepseek-harness-linux

    Design, review, and diagnose DeepSeek Harness tests and fixtures that can fail nondeterministically under CI concurrency, shared host resources, clocks, process-global state, subprocesses, network…

    116 GitHub stars~2.4k tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • Design, review, and diagnose Alego tests and fixtures that can fail nondeterministically under CI concurrency, shared host resources, clocks, process-global state, subprocesses, network listeners…

    109 GitHub stars~2.4k tokensUpdated 9 days ago
    Frontend & DesignAuto-check passed
  • Frontend Engineering

    magnus919/agent-skills

    Build and maintain web frontends — component architecture, state management, API integration, responsive layout, client-side performance, and frontend testing patterns.

    111 GitHub stars~1.5k tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • AI Client

    Opentrons/opentrons

    Conventions for the opentrons-ai-client React/TypeScript frontend — project structure, API integration, state management (Jotai), feature flags, types, and testing.

    521 GitHub stars~1.6k tokensUpdated today
    Backend & APIsAuto-check passed

More from sickn33/agentic-awesome-skills

All 1,394 skills in this repo
  • Liuguang Banlan UI

    sickn33/agentic-awesome-skills

    Implements an interface in one of two named color modes, iridescent white or colorful black, from a parameterized starter that reports measured color intensity.

    47k GitHub starsUsed in 1 repo~2.5k tokens
    Auto-check passed
  • User Thoughts Memory

    sickn33/agentic-awesome-skills

    Saves a user's project decisions, rules and preferences into a project-local mdbase so later sessions and other agents can recover the intent.

    47k GitHub starsUsed in 1 repo~2.5k tokens
    Auto-check passed
  • Using LWC Memory and Graphs

    sickn33/agentic-awesome-skills

    Keeps project decisions, research and verified results available across coding-agent sessions through LWC memory, a document Wiki graph and a CodeGraph code index.

    47k GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed
  • Find Complementary Founders

    sickn33/agentic-awesome-skills

    Guides an agent through assessing its own owner for cofounder fit, publishing an approved profile, and ranking complementary profiles other agents published for their owners.

    47k GitHub starsUsed in 1 repo~4.8k tokens
    Auto-check passed
  • Whatsapp Cloud API

    sickn33/agentic-awesome-skills

    Integracao com WhatsApp Business Cloud API (Meta). An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub starsUsed in 2 repos~4.5k tokens
    Auto-check passed
  • Cline Pilot

    sickn33/agentic-awesome-skills

    Acts as a proxy for the Cline CLI, dispatching coding tasks one at a time, monitoring runs by hard evidence, relaying decisions to you and learning per-project preferences.

    47k GitHub starsUsed in 1 repo~4.6k tokens
    Auto-check passed

Questions about Frontend API Integration Patterns

What does Frontend API Integration Patterns do?

Production-ready patterns for integrating frontend applications with backend APIs, including race condition handling, request cancellation, retry strategies, error normalization, and UI state…. Frontend API Integration Patterns is an agent skill from sickn33/agentic-awesome-skills. Production-ready patterns for integrating frontend applications with backend APIs, including race condition handling, request cancellation, retry strategies, error normalization, and UI state management.

When should I use Frontend API Integration Patterns?

Frontend API Integration Patterns fits situations like: tasks that involve Third-party API integration; tasks that involve Async programming; tasks that involve State management.

How do I install Frontend API Integration Patterns in Claude Code?

Run `npx skills add sickn33/agentic-awesome-skills --skill frontend-api-integration-patterns -a claude-code`. Or copy the skill folder (skills/frontend-api-integration-patterns in sickn33/agentic-awesome-skills) into .claude/skills/frontend-api-integration-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Frontend API Integration Patterns in Codex?

Run `npx skills add sickn33/agentic-awesome-skills --skill frontend-api-integration-patterns -a codex`. Or copy the skill folder (skills/frontend-api-integration-patterns in sickn33/agentic-awesome-skills) into .agents/skills/frontend-api-integration-patterns in your project. Codex loads it when a task matches its description.

Can I use Frontend API Integration Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add sickn33/agentic-awesome-skills --skill frontend-api-integration-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/frontend-api-integration-patterns, .gemini/skills/frontend-api-integration-patterns, .github/skills/frontend-api-integration-patterns and .opencode/skills/frontend-api-integration-patterns in your project.

What does Frontend API Integration Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: Frontend API Integration Patterns is instructions for the agent only.

Does Frontend API Integration Patterns access the network?

SKILL.md names 3 domains. As links in the text: developer.mozilla.org, react.dev and axios-http.com. This is read from the text; nothing was executed.

Is Frontend API Integration Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Frontend API Integration Patterns use?

Frontend API Integration Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Frontend API Integration Patterns use?

About 1.9k tokens (SKILL.md is roughly 7.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Frontend API Integration Patterns?

Skills that share tags, products or a category with Frontend API Integration Patterns: Phase 6 UI Integration (ww-w-ai/bkit-claude-code, 600 stars), Tanstack Query (bskimball/tanstack-hono, 119 stars), Dsh CI Test Reliability (Zhou-Yujing114514/deepseek-harness-linux, 116 stars) and Alego CI Test Reliability (singula-ai/alego, 109 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Frontend API Integration Patterns?

sickn33 (a GitHub user) maintains it in sickn33/agentic-awesome-skills, which has 47,304 GitHub stars. The repository holds 1,394 skills in this directory. The repository was last updated on October 6, 2026.

Source: sickn33/agentic-awesome-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.