async-concurrency

Reviews and guides Python async/await code for correct concurrency, timeouts, and error handling.

Updated Sep 2, 2026
One-click install
npx skills add https://github.com/Dazlarus/karl-code --skill async-concurrency-dazlarus
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: async-concurrency
Source: https://github.com/Dazlarus/karl-code/tree/main/.agents/skills/async-concurrency
Command: npx skills add https://github.com/Dazlarus/karl-code --skill async-concurrency-dazlarus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing correct asynchronous Python code is error-prone: blocking calls stall the event loop, unhandled exceptions vanish in gather calls, and missing timeouts cause indefinite hangs. This Skill provides concrete patterns and a review checklist for asyncio-based code. ## Core Features & Use Cases - Async Pattern Guidance: Covers ten core principles including task creation with asyncio.create_task, timeouts with asyncio.wait_for, semaphores for rate limiting, and async context managers. - Code Review Format: Produces structured reviews flagging blocking calls, missing awaits, and lost exceptions with line-level fixes. - Use Case: When refactoring a script that fetches hundreds of URLs sequentially, apply this Skill to convert it to concurrent tasks with a semaphore limit, proper timeouts, and exception collection via return_exceptions=True. ## Quick Start Review my async Python code for blocking calls, missing timeouts, and improper task management.

Frequently Asked Questions about async-concurrency

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run multiple async tasks concurrently in Python?▼

Create tasks with asyncio.create_task for each coroutine, then await them together with asyncio.gather. This runs operations concurrently instead of awaiting each one sequentially in a loop.

How to add a timeout to an async function in asyncio?▼

Wrap the awaitable with asyncio.wait_for and a timeout in seconds, or use the asyncio.timeout context manager on Python 3.11+. Catch TimeoutError to handle expired operations explicitly.

Why does my async code run slowly or block the event loop?▼

Blocking calls like open(), time.sleep, or CPU-heavy work stall the event loop. Use aiofiles for file I/O, asyncio.sleep for delays, and run_in_executor with a thread or process pool for blocking work.

When should I not use async/await in Python?▼

Avoid async for purely synchronous scripts, simple sequential operations, and CPU-bound tasks. CPU-bound work belongs in multiprocessing, not asyncio, since async only helps I/O-bound concurrency.

How do I limit concurrent requests with asyncio?▼

Use asyncio.Semaphore with a maximum concurrency value and acquire it inside each task via async with. This caps simultaneous operations, preventing servers or connection pools from being overwhelmed.