python-idiomatic-asyncio
/python-idiomatic-asyncio
Use this skill when writing non-blocking asynchronous Python services using asyncio event loops, tasks, semaphores, and TaskGroups.
- Author
- nextboxis ↗
- Repository
- library-skill-agents ↗
- Licence
- MIT
- Last repository change
- 28.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 28.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use this skill when writing non-blocking asynchronous Python services using asyncio event loops, tasks, semaphores, and TaskGroups.
Original author description
Use this skill when writing non-blocking asynchronous Python services using asyncio event loops, tasks, semaphores, and TaskGroups.
How it works
- When to use
- Prerequisites
- Step-by-step workflow
- Commands / code examples
- Common mistakes & pitfalls
- Verification checklist
- Related skills
SKILL.md preview
---
name: python-idiomatic-asyncio
description: Use this skill when writing non-blocking asynchronous Python services using asyncio event loops, tasks, semaphores, and TaskGroups.
---
# Python Idiomatic asyncio
## When to use
Use this skill when you need to writing non-blocking asynchronous Python services using asyncio event loops, tasks, semaphores, and TaskGroups.
## Prerequisites
- Working knowledge of relevant programming language or database fundamentals.
- Access to testing environment or local runtime instance.
## Step-by-step workflow
1. **Analyze operational requirements**: Review performance boundaries, data integrity constraints, and query patterns.
2. **Design schema / interface**: Define explicit data contracts, types, or indexes supporting planned operations.
3. **Implement core routines**: Construct declarative, type-safe, or parameterized queries and functions.
4. **Validate performance**: Verify execution metrics using profilers, EXPLAIN plans, or benchmark test suites.
5. **Implement defensive controls**: Enforce timeout boundaries, connection pooling limits, and transaction safety.
## Commands / code examples
```python
import asyncio
from typing import List
async def fetch_metrics(service_id: str, sem: asyncio.Semaphore) -> dict:
async with sem:
# Simulate network I/O
await asyncio.sleep(0.05)
return {"service": service_id, "status": "healthy"}
async def gather_all_telemetry(services: List[str]) -> List[dict]:
sem = asyncio.Semaphore(5) # Limit concurrent tasks
async with asyncio.TaskGroup() as tg:
tasks = [tg.create_task(fetch_metrics(s, sem)) for s in services]
return [t.result() for t in tasks]
if __name__ == "__main__":
results = asyncio.run(gather_all_telemetry(["auth", "billing", "search"]))
print(results)
```
## Common mistakes & pitfalls
- Overlooking indexing strategies on foreign keys and frequently queried filter columns.
- Running unparameterized dynamic queries, creating severe SQL injection vulnerabilities.
- Holding open long-running database transactions during slow external network calls.
## Verification checklist
- [ ] Schema contracts and type signatures are strictly enforced.
- [ ] Queries are fully parameterized against injection vulnerabilities.
- [ ] Profiling or execution plans show optimal resource consumption.
- [ ] Error handling safely releases locks and rolls back aborted transactions.
## Related skills
- postgresql-query-optimization-explain
- sql-anti-patterns-remediation
- acid-transactions-isolation-levels
- secure-code-review-static-analysis-sast
Versions
The database has no other skills named python-idiomatic-asyncio.
Database snapshot: 13.11.2026 · package version 23454317f02d (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 95asyncio
asyncio patterns, concurrency pitfalls, and backpressure. Use when writing async Python services. - 100rc-python
Idiomatic typed Python 3.12+ — asyncio, dataclasses, pytest, ruff, uv. Use when writing or reviewing Python. Do not use for JS/TS or Go. - 100async-python-patterns
Structure asyncio code: task management, cancellation, rate limiting, blocking calls kept off the event loop. TRIGGER WHEN: building async APIs, concurrent or I/O-bound systems needing non-blocking operations, or choosing between asyncio, threading and multiprocessing. - 100async-python-patterns
Structure asyncio code: task management, cancellation, rate limiting, blocking calls kept off the event loop. TRIGGER WHEN: building async APIs, concurrent or I/O-bound systems needing non-blocking operations, or choosing between asyncio, threading and multiprocessing. - 90python
Python 3.11+ performance optimization guidelines (formerly python-311). This skill should be used when writing, reviewing, or refactoring Python code to ensure optimal performance patterns. Triggers on tasks involving asyncio, data structures, memory management, concurrency,… - 100performant-python
Strategies for high-performance Python systems (FastAPI, Asyncio, UVloop, Memory Optimization). Use when: python, fastapi, performance, asyncio, uvloop, pydantic, scalability, profiling.