parallel-awaits
БесплатноЗапускает вложенные скриптыНе проверенDeep-scan hot paths for unnecessary sequential async calls and parallelise the safe ones. Use when the user asks to find or fix sequential awaits, waterfalls…
от vvedantb★ 100 звёзд на GitHubОб этом скилле
Parallel awaits
Find awaits that run one after another but do not depend on each other. Fix the safe ones with Promise.all. Leave the rest, and say why.
1. Scan
Run from the repo root:
node .claude/skills/parallel-awaits/scan-awaits.cjs # whole repo
node .claude/skills/parallel-awaits/scan-awaits.cjs packages/backend/convex/mcp
node .claude/skills/parallel-awaits/scan-awaits.cjs --diff origin/main # changed files only
PAIR:const a = await Athenconst b = await B, and B uses nothing declared since A.LOOP: a loop that awaits reads one at a time.--allalso reports bareawait x();pairs. These are mostly ordered writes, so they are noisy.
The scanner sees only straight-line code. Read the real code for every hit before you change it.
2. Rank by hotness
Fix in this order:
- Action round trips:
ctx.runQuery,runMutation,runAction,runAsUser, sandboxexec, Vercel, GitHub,fetch. Each one costs a network round trip. - Shared helpers that many callers use, for example
gatherAccessibleRepos,getSandboxHandleandresolveSandboxCredentials. - Reactive queries: lists, chat status, team members, users, usage limits.
- Chat-turn prompt builds and MCP tool handlers, because agents call them all the time.
- Crons that fan out per sandbox.
Do not fix migrations, one-off scripts, demo animations or rare admin paths.
3. Rules: when you must not parallelise
- Writes and order. Never parallelise
insert,patch,delete,allocateNumId,createNotification, scheduler calls, or workflowstep.*calls. - Mutation read sets. An extra early read in a mutation adds to its read set. If that range changes often, OCC conflicts increase. Keep the read lazy.
- Lazy fallbacks. Do not turn "try A, then B if A is empty" into two reads when A usually hits. Example: an owner lookup by sandbox.
- Guards and errors. If A throws a user-visible error, B must not throw a different error first. Do not run side effects that the guard should block.
- Secrets. The authorisation check stays first when B reads or decrypts secrets.
- Loops. Skip loops that
breakorreturn, carry state, paginate, or poll. Also skip unbounded fan-out to external APIs, because of rate limits. Skip large-payload loops, because of memory. - Cheap calls.
ctx.auth.getUserIdentity()is local. A pair that starts with it is not worth a change.
4. Fix patterns
// Independent reads
const [task, user] = await Promise.all([ctx.db.get(taskId), ctx.db.get(userId)]);
// Keep A's error priority: start B, check A, then await B
const reposPromise = listRepos(ctx);
const session = await getSession(ctx, id);
if (!session) throw new Error("Session not found");
const repos = await reposPromise;
// Loop of independent reads, order kept
const rows = await Promise.all(ids.map((id) => ctx.db.get(id)));
- Pattern 2 risks an unhandled rejection if A throws while B also rejects. Use it only when B cannot reject, or attach
.catchto B. - Look for duplicate work as well as waterfalls. Examples: a credential resolve that the next helper repeats, or a second repo read after a helper that already returns the repo. Read the helper to confirm it before you delete the call.
- Repo rules still apply: no
any,unknown,asor!, no new deps, and keep diffs small.
5. Scale out (whole-repo runs only)
- Split the hits into groups that do not share files, for example sandbox actions, GitHub and MCP, and queries and mutations.
- Give each group to a fork with these rules. Forks do not run
tsc. - When the forks finish, review the riskiest edits yourself. Removed calls and changed error order come first.
6. Verify and report
- Run
tsc --noEmitfor each package you touched. Backend:cd packages/backend && npx tsc --noEmit -p convex. - Grep the diff for banned types.
- Report each fix: file, what now runs in parallel, and the saving (for example "1 runQuery round trip per sandbox start").
- List the notable hits you rejected, one line each, with the rule.
- Add a changelog entry for a medium or larger sweep.
Установить parallel-awaits в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл parallel-awaits?
Deep-scan hot paths for unnecessary sequential async calls and parallelise the safe ones. Use when the user asks to find or fix sequential awaits, waterfalls, "make these calls parallel", or "scan hot paths for slow async". Works on the whole repo, a path, or only the current diff.
Как установить скилл parallel-awaits?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл parallel-awaits запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic