Skip to main content
skill CX Codex

frontend-async-best-practices — Claude Code skill

frontend-async-best-practices is a Claude Code skill for eliminating async waterfalls by parallelizing independent requests instead of awaiting them sequentially.

MIT 228 installs ★ 92 updated 2026-02-01

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add sergiodxa/agent-skills --skill frontend-async-best-practices -a claude-code
Open on GitHub

What frontend-async-best-practices does

A skill with five core rules for optimizing asynchronous JavaScript. The critical pattern: replace sequential awaits with Promise.all() for independent operations. Each extra await adds full network latency. The rules cover parallelizing requests, deferring await only where needed, chaining dependent operations without blocking independent ones, and using Suspense to show UI while data loads.

Apply it when writing and reviewing async code—in Remix loaders, data handlers, and Promise management. Spots waterfalls where a function waits for the first request before starting the second, even though they're independent. Shows when to move await inside a condition to skip unnecessary data, and how to structure chains so a user profile starts loading as soon as the ID arrives, not after the config finishes.

What it helps with

  • replace sequential network requests with parallel execution
  • find and fix waterfall patterns in loaders and actions
  • structure dependent async operations without blocking
  • cut response time when fetching from multiple sources
  • use Suspense to display UI while data streams in

Example prompts for the agent

  • These three API calls are independent—make them run in parallel instead of one after another
  • Review my loader for waterfalls. I think I'm waiting for the first result before starting the next one
  • Restructure this so the user profile loads in parallel with the config, not after it completes

How to install frontend-async-best-practices

1Skills CLI (Vercel)

npx skills add sergiodxa/agent-skills --skill frontend-async-best-practices -a claude-code

2Manually: put the files in place

~/.claude/skills/frontend-async-best-practices/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/frontend-async-best-practices/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about frontend-async-best-practices

How do I install frontend-async-best-practices in Claude Code?

Run npx skills add sergiodxa/agent-skills --skill frontend-async-best-practices -a claude-code, then open ~/.claude/skills/frontend-async-best-practices/SKILL.md in Claude Code.

What does this skill teach?

How to write async code without waterfalls—where requests run sequentially instead of in parallel. It covers Promise.all() for independent operations, moving await into conditional branches, and structuring dependencies so unrelated calls execute at the same time.

Which platforms support this skill?

Works with Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode. Each platform has its own install command.

Source text

SKILL.md · MIT
---
name: frontend-async-best-practices
description: Async/await and Promise optimization guidelines. Use when writing, reviewing, or refactoring asynchronous code to eliminate waterfalls and maximize parallelism. Triggers on tasks involving data fetching, loaders, actions, or Promise handling.
---

# Async Best Practices

Performance optimization patterns for asynchronous JavaScript code. Contains 5 rules focused on eliminating request waterfalls and maximizing parallelism.

**Impact: CRITICAL** - Waterfalls are the #1 performance killer. Each sequential await adds full network latency.

## When to Apply

Reference these guidelines when:

- Writing Remix loaders or actions
- Implementing data fetching logic
- Working with multiple async operations
- Reviewing code for waterfall patterns
- Optimizing response times

## Rules Summary

### parallel (CRITICAL) — @rules/parallel.md

Use `Promise.all()` for independent operations.

```typescript
// Bad: 3 sequential round trips
const user = await fetchUser();
const posts = await fetchPosts();
const comments = await fetchComments();

// Good: 1 parallel round trip
const [user, posts, comments] = await Promise.all([
  fetchUser(),
  fetchPosts(),
  fetchComments(),
]);
```

### defer-await (HIGH) — @rules/defer-await.md

Move await into branches where actually used.

```typescript
// Bad: always waits even when skipping
async function handle(skip: boolean) {
  let data = await fetchData();
  if (skip) return { skipped: true };
  return process(data);
}

// Good: only waits when needed
async function handle(skip: boolean) {
  if (skip) return { skipped: true };
  let data = await fetchData();
  return process(data);
}
```

### dependencies (CRITICAL) — @rules/dependencies.md

Chain dependent operations, parallelize independent ones.

```typescript
// Bad: profile waits for config unnecessarily
const [user, config] = await Promise.all([fetchUser(), fetchConfig()]);
const profile = await fetchProfile(user.id);

// Good: profile starts as soon as user resolves
const userPromise = fetchUser();
const profilePromise = userPromise.then((user) => fetchProfile(user.id));

const [user, config, profile] = await Promise.all([
  userPromise,
  fetchConfig(),
  profilePromise,
]);
```

### api-routes (CRITICAL) — @rules/api-routes.md

Start promises early, await late in loaders.

```typescript
// Bad: sequential execution
export async function loader() {
  let session = await auth();
  let config = await fetchConfig();
  return { session, config };
}

// Good: parallel execution
export async function loader() {
  let sessionPromise = auth();
  let configPromise = fetchConfig();
  const [session, config] = await Promise.all([sessionPromise, configPromise]);
  return { session, config };
}
```

### suspense-boundaries (HIGH) — @rules/suspense-boundaries.md

Use Suspense to show UI immediately while data loads.

```tsx
// Bad: entire page blocked by data
async function Page() {
  let data = await fetchData();
  return (
    <Layout>
      <Content data={data} />
    </Layout>
  );
}

// Good: layout shows immediately, content streams in
function Page() {
  return (
    <Layout>
      <Suspense fallback={<Skeleton />}>
        <Content />
      </Suspense>
    </Layout>
  );
}
```

© sergiodxa · MIT · sergiodxa/agent-skills

Similar skills

All skills for Frontend and UI →

From the same set11

The whole set →
frontend-react-best-practices frontend-react-best-practices — a skill with 33 React performance rules: fewer wasted re-renders, leaner bundles, cleaner component composition. Useful while writing or refactoring components. CX Codex +1 1,200installs frontend-accessibility-best-practices frontend-accessibility-best-practices is a Claude Code skill with WCAG patterns for React components. It activates when building UI, forms or interactive elements, or reviewing code for accessibility. CX Codex +1 926installs frontend-tailwind-best-practices frontend-tailwind-best-practices is a Claude Code skill with 10 Tailwind CSS rules for component styling, covering stack utilities, gap spacing, dark color schemes, and className merging. CX Codex +1 470installs frontend-react-router-best-practices frontend-react-router-best-practices is a Claude Code skill that sets React Router architecture rules for parallel loaders and secure mutation handlers without client waterfalls. CX Codex +1 406installs frontend-js-best-practices frontend-js-best-practices provides 17 performance and style rules for JavaScript and TypeScript. Helps agents optimize loops, reduce algorithmic complexity, and avoid array mutations. CX Codex +1 341installs ruby-on-rails-best-practices ruby-on-rails-best-practices is a Claude Code skill that provides 16 Basecamp Rails conventions for models, thin controllers, background jobs, and Turbo broadcasts. CX Codex +1 283installs frontend-internationalization-best-practices frontend-internationalization-best-practices is a Claude Code skill with best practices for React Router and remix-i18next, covering middleware, locale detection, and SSR hydration sync. CX Codex +1 195installs skill-writing-best-practices skill-writing-best-practices provides guidelines and structural patterns for authoring AI agent skills. Useful when packaging codebase conventions or reviewing rules in skills/. CX Codex +1 176installs

Project sponsors

Companies that keep this analytics open