← ClaudeAtlas

py-async-patternslisted

Review Python async code for event-loop blocking, missing await, incorrect task/gather usage, swallowed cancellation, missing timeouts, and sync/async boundary mistakes. Use when reviewing asyncio, FastAPI, aiohttp, httpx async clients, background tasks, or concurrent I/O.
CodeSigils/py-review-skill · ★ 0 · AI & Automation · score 62
Install: claude install-skill CodeSigils/py-review-skill
# Python Async Review Use these rules only for async or concurrent I/O code. Prefer concrete event-loop or cancellation risks over general async style suggestions. ## Review Rules ### Rule: async-blocking-call **Impact:** CRITICAL **Applies when:** Code inside `async def` performs sleeping, HTTP, database, filesystem, subprocess, or CPU-heavy work. **Skip when:** The operation is explicitly offloaded to a thread/process or is known non-blocking. **Python:** any **Tools:** ruff | project-configured **Review signal:** `time.sleep`, `requests`, sync database clients, or CPU loops appear inside `async def`. **Incorrect:** ```python async def fetch_data(url: str) -> dict: time.sleep(1) return requests.get(url).json() ``` **Correct:** ```python async def fetch_data(url: str) -> dict: await asyncio.sleep(1) async with httpx.AsyncClient() as client: response = await client.get(url) return response.json() ``` **Reason:** Blocking calls stop the event loop and degrade every concurrent request or task. ### Rule: async-missing-await **Impact:** HIGH **Applies when:** Changed code calls an async function. **Skip when:** The coroutine is intentionally scheduled with `asyncio.create_task` and its lifecycle is handled. **Python:** any **Tools:** pyright | mypy | ruff | project-configured **Review signal:** A coroutine-returning function is called without `await`, `create_task`, `gather`, or equivalent scheduling. **Incorrect:** ```python async def handler(