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
npx skills add sergiodxa/agent-skills --skill frontend-async-best-practices -a claude-codeWhat 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-code2Manually: put the files in place
~/.claude/skills/frontend-async-best-practices/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/frontend-async-best-practices/
1Skills CLI (Vercel)
npx skills add sergiodxa/agent-skills --skill frontend-async-best-practices -a codex2Manually: put the files in place
.agents/skills/frontend-async-best-practices/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add sergiodxa/agent-skills --skill frontend-async-best-practices -a cursor2Manually: put the files in place
.cursor/skills/frontend-async-best-practices/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install sergiodxa/agent-skills skills/frontend-async-best-practices2Manually: put the files in place
.github/skills/frontend-async-best-practices/SKILL.md1Skills CLI (Vercel)
npx skills add sergiodxa/agent-skills --skill frontend-async-best-practices -a gemini-cli2Platform CLI
gemini skills install https://github.com/sergiodxa/agent-skills --path skills/frontend-async-best-practicesManually: put the files in place
.devin/skills/frontend-async-best-practices/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add sergiodxa/agent-skills --skill frontend-async-best-practices -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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