# Frontend async best practices > Use when async code has request waterfalls that could run in parallel. 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. ## Facts - Type: Agent skill - Discipline: Engineering - Author: Sergio Xalambri (https://github.com/sergiodxa) - Upstream: https://github.com/sergiodxa/agent-skills/blob/main/skills/frontend-async-best-practices/SKILL.md - Source file: https://raw.githubusercontent.com/sergiodxa/agent-skills/main/skills/frontend-async-best-practices/SKILL.md (3275 bytes, sha256:719046079e34261c96bc24ea28585b8a110991e6a0e473d5c7e1567c4995bbe8) - Licence: MIT - Upstream copy last changed: 2026-09-17 - Status: listed, not yet ruled on by the curator ## Use it I want to use the Frontend async best practices skill by Sergio Xalambri. This is what it does, in the author's own words: 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. Download the whole folder at https://github.com/sergiodxa/agent-skills/tree/main/skills/frontend-async-best-practices, SKILL.md and every file beside it, into your skills directory: ~/.claude/skills/frontend-async-best-practices/ for Claude Code, ~/.agents/skills/frontend-async-best-practices/ for Codex, ~/.cursor/skills/frontend-async-best-practices/ for Cursor. Get it from the author's repo, not from startupskills.dev. Then tell me the path you installed it to and how to invoke it. Nothing here is vendored: install from the author's repo, not from this site. A verbatim copy of the author's file follows for reading, under the licence reproduced after it; the current file is in the author's repo. ## Links - Page: https://startupskills.dev/sergiodxa/frontend-async-best-practices - Author: https://startupskills.dev/sergiodxa - Index: https://startupskills.dev/llms.txt ## The file itself --- 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 ( ); } // Good: layout shows immediately, content streams in function Page() { return ( }> ); } ``` ## Licence of the file above The file above is https://raw.githubusercontent.com/sergiodxa/agent-skills/main/skills/frontend-async-best-practices/SKILL.md, by Sergio Xalambri, reproduced without changes. - Source: https://github.com/sergiodxa/agent-skills/blob/main/skills/frontend-async-best-practices/SKILL.md - Copyright: Copyright (c) 2026 Sergio Xalambrí - Licence: MIT, https://raw.githubusercontent.com/sergiodxa/agent-skills/main/LICENSE The repo's licence file, verbatim from https://raw.githubusercontent.com/sergiodxa/agent-skills/main/LICENSE: MIT License Copyright (c) 2026 Sergio Xalambrí Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.