async-python-patternslisted
Install: claude install-skill SoluDevTech/ai-driven
# Async Python Patterns
Comprehensive guidance for implementing asynchronous Python applications using asyncio, concurrent programming patterns, and async/await for building high-performance, non-blocking systems.
## Use this skill when
- Building async web APIs (FastAPI, aiohttp, Sanic)
- Implementing concurrent I/O operations (database, file, network)
- Creating web scrapers with concurrent requests
- Developing real-time applications (WebSocket servers, chat systems)
- Processing multiple independent tasks simultaneously
- Building microservices with async communication
- Optimizing I/O-bound workloads
- Implementing async background tasks and queues
## Do not use this skill when
- The workload is CPU-bound with minimal I/O.
- A simple synchronous script is sufficient.
- The runtime environment cannot support asyncio/event loop usage.
## Core concepts (summary)
- **Event loop**: Single-threaded cooperative scheduler that runs coroutines and handles I/O without blocking.
- **Coroutines**: `async def` functions that can be paused at `await` points and resumed by the event loop.
- **Tasks**: Scheduled coroutines running concurrently on the loop (created via `asyncio.create_task`).
- **Futures**: Low-level objects representing eventual results of async operations.
- **Async context managers**: Objects supporting `async with` for safe resource setup/teardown.
- **Async iterators**: Objects supporting `async for` to consume data from async sources (e.g., generators with `