clean-typescript-async
Installation
SKILL.md
Clean Async TypeScript
Async code should make ordering, ownership, and failure behavior explicit. Race-prone behavior deserves small units and direct tests.
A1: Isolate Async Workflows
Keep orchestration separate from pure transformation. Parse, validate, map, and calculate in synchronous helpers when possible; let async functions coordinate I/O.
async function importUsers(file: FileHandle, repository: UserRepository) {
const rows = await file.readRows();
const users = rows.map(parseUserRow);
await repository.saveMany(users);
}
A2: Make Ordering Explicit
Use sequential await when order matters and Promise.all when operations are independent. Do not rely on array callbacks with hidden promise behavior.