Skip to content
Back to skills

Concurrency Async

ASecurity

``` ┌─────────────┐ ers ││ Tim ← setTimeout, setInterval ├─────────────┤ │ Pending │ ← I/O callbacks ├─────────────┤ │ Idle │ ← node internal ├─────────────┤ │ Poll │ ← I/O ├─────────────┤ │ Check │ ← setImmediate ├─────────────┤ │ Close CB │ ← socket.close └─────────────┘ ``` ```typescript // Parallel execution const [users, posts, comments] = await Promise.all([ getUsers(), getPosts(), getComments(), ]) // Race condition preve

  • 21 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 7, 2026
developmenttypescriptnode

Security analysis

A100/100

Scanned September 7, 2026

npx -y skills add modbender/skill-library-mcp --skill concurrency-async --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Concurrency Async?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Concurrency Async
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/modbender-concurrency-async/badge)](https://www.skillsdirectory.com/skills/modbender-concurrency-async)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Concurrency & Async Programming

## Event Loop Model

```
┌─────────────┐
ers    ││   Tim ← setTimeout, setInterval
├─────────────┤
│   Pending   │ ← I/O callbacks
├─────────────┤
│   Idle      │ ← node internal
├─────────────┤
│   Poll      │ ← I/O
├─────────────┤
│   Check     │ ← setImmediate
├─────────────┤
│  Close CB   │ ← socket.close
└─────────────┘
```

## Promise Patterns

```typescript
// Parallel execution
const [users, posts, comments] = await Promise.all([
  getUsers(),
  getPosts(),
  getComments(),
])

// Race condition prevention
async function fetchWithTimeout(url: string, ms: number) {
  const timeout = new Promise((_, reject) => 
    setTimeout(() => reject(new Error('Timeout')), ms)
  )
  return Promise.race([fetch(url), timeout])
}

// Retry with backoff
async function retry<T>(
  fn: () => Promise<T>,
  attempts = 3,
  delay = 1000
): Promise<T> {
  try {
    return await fn()
  } catch (err) {
    if (attempts <= 1) throw err
    await new Promise(r => setTimeout(r, delay))
    return retry(fn, attempts - 1, delay * 2)
  }
}
```

## Async Error Handling

```typescript
// Always catch async errors
app.get('/users', async (req, res, next) => {
  try {
    const users = await getUsers()
    res.json(users)
  } catch (err) {
    next(err) // Pass to error middleware
  }
})
```

## Checklist

- [ ] Understand event loop phases
- [ ] Use Promise.all for parallel ops
- [ ] Handle promise rejections
- [ ] Implement timeouts
- [ ] Add retry logic

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.