# asyncio-concurrency-patterns

A skill on Python concurrency: event loops, coroutines, tasks, semaphores and locks. Useful when you are writing an async service or client.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 489 installs · ★ 62
- Author: manutej
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/manutej/luxor-claude-marketplace/tree/HEAD/plugins/luxor-specialized-tools/skills/asyncio-concurrency-patterns/SKILL.md
- Updated: 2026-06-13
- HTML: https://affpapa.org/en/nevibecode/skills/asyncio-concurrency-patterns

## What it does

The skill walks through Python's `asyncio`: the event loop, coroutines defined with `async def`, tasks, futures, synchronization primitives and async context managers. It is organised by pattern rather than by API reference.

Four patterns come with code. `asyncio.gather` runs coroutines concurrently and returns results in input order. `asyncio.wait` lets you pick what to wait for: the first task done, the first exception, or all of them. `asyncio.Semaphore` caps how many operations run at once, and `asyncio.Lock` guards a critical section. The examples use `aiohttp`, so that library has to be installed before the code runs.

The payoff shows up wherever network calls pile up: parallel HTTP requests, websockets, database connection pools. The skill advises putting a semaphore in front of requests to an external API, because otherwise you hit its rate limits fast. The text cuts off inside the `Lock` section, so the remaining synchronization primitives are not covered.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill asyncio-concurrency-patterns -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/asyncio-concurrency-patterns/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/asyncio-concurrency-patterns/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill asyncio-concurrency-patterns -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/asyncio-concurrency-patterns/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill asyncio-concurrency-patterns -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/asyncio-concurrency-patterns/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install manutej/luxor-claude-marketplace asyncio-concurrency-patterns
```

2. **Manually: put the files in place**
- File: `.github/skills/asyncio-concurrency-patterns/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill asyncio-concurrency-patterns -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/manutej/luxor-claude-marketplace --path plugins/luxor-specialized-tools/skills/asyncio-concurrency-patterns
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/asyncio-concurrency-patterns/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill asyncio-concurrency-patterns -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/manutej/luxor-claude-marketplace/tree/HEAD/plugins/luxor-specialized-tools/skills/asyncio-concurrency-patterns/SKILL.md

## When to use it
- fire parallel HTTP requests and keep the responses in order
- cap how many calls hit an external API at once
- return as soon as one task finishes and cancel the rest
- protect a shared counter with an async lock
- write an async context manager that connects and disconnects

## Example prompts
- show me the gather pattern for parallel aiohttp requests
- how do I limit request concurrency with an asyncio semaphore
- write an async context manager for a database connection

## Similar
- [asyncio](https://affpapa.org/en/nevibecode/skills/asyncio.md) — skill · 476 installs
- [csharp-concurrency-patterns](https://affpapa.org/en/nevibecode/skills/csharp-concurrency-patterns.md) — skill · 1600 installs
- [async-python-patterns](https://affpapa.org/en/nevibecode/skills/async-python-patterns.md) — skill · 18055 installs
- [kotlin-concurrency-and-flow](https://affpapa.org/en/nevibecode/skills/kotlin-concurrency-and-flow.md) — skill · 1100 installs
- [m07-concurrency](https://affpapa.org/en/nevibecode/skills/m07-concurrency.md) — skill · 3500 installs
- [golang-concurrency-patterns](https://affpapa.org/en/nevibecode/skills/golang-concurrency-patterns.md) — skill · 408 installs

From the same set: [manutej/luxor-claude-marketplace](https://affpapa.org/en/nevibecode/by/manutej/luxor-claude-marketplace.md) — 31 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
