
Python Pro
Apply production-grade asyncio patterns—gather, TaskGroup, and typed error handling—while building Python services and scripts.
Overview
Python Pro is an agent skill for the Build phase that teaches asyncio and structured-concurrency patterns for production Python backends.
Install
npx skills add https://github.com/jeffallan/claude-skills --skill python-proWhat is this skill?
- async/await basics with asyncio.run and typed coroutine signatures
- Concurrent fan-out with asyncio.gather and return_exceptions for partial failure
- Python 3.11+ TaskGroup patterns for structured concurrency and batch processing
- Error-splitting recipes that separate successes from exceptions in parallel work
- TaskGroup examples target Python 3.11+
Adoption & trust: 3.5k installs on skills.sh; 9.7k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your agent keeps writing blocking or fragile concurrent Python when you need reliable async I/O for APIs and workers.
Who is it for?
Indie builders implementing async Python APIs, scrapers, or job runners who want agent output to match modern asyncio idioms.
Skip if: Beginners who have not run asyncio.run once yet, or teams standardized on sync-only Django views without an async migration plan.
When should I use this skill?
You are implementing or refactoring async Python I/O and need gather, TaskGroup, and typed error-handling patterns—not sync shortcuts.
What do I get? / Deliverables
You get copy-ready asyncio, gather, and TaskGroup snippets with typing and error-handling choices aligned to your concurrency design.
- Async function and batch-processing code aligned to project types
- Exception policy for parallel tasks (fail-fast vs partial success)
Recommended Skills
Journey fit
Build is the canonical shelf because the skill teaches implementation patterns for async Python backends and workers, not launch or ops runbooks. Backend subphase fits I/O-bound APIs, concurrent fetch pipelines, and structured concurrency in application code.
How it compares
Pattern cookbook for asyncio in-agent—not a pytest suite, FastAPI scaffold, or deployment skill.
Common Questions / FAQ
Who is python-pro for?
Solo developers building Python backends or CLIs who want their coding agent to emit correct asyncio, gather, and TaskGroup code.
When should I use python-pro?
During Build backend work whenever you implement concurrent HTTP calls, batch processors, or Python 3.11+ structured concurrency.
Is python-pro safe to install?
It is documentation-style patterns with no mandated shell or network hooks; still review the Security Audits panel on this page before installing from third-party repos.
SKILL.md
READMESKILL.md - Python Pro
# Async Programming Patterns ## Basic Async/Await ```python import asyncio from collections.abc import Coroutine # Basic async function async def fetch_data(url: str) -> dict[str, str]: await asyncio.sleep(1) # Simulate I/O return {"url": url, "status": "ok"} # Running async code async def main() -> None: result = await fetch_data("https://api.example.com") print(result) if __name__ == "__main__": asyncio.run(main()) # Multiple concurrent operations async def fetch_all(urls: list[str]) -> list[dict[str, str]]: tasks = [fetch_data(url) for url in urls] return await asyncio.gather(*tasks) # Error handling with gather async def safe_fetch_all(urls: list[str]) -> list[dict[str, str] | None]: tasks = [fetch_data(url) for url in urls] results = await asyncio.gather(*tasks, return_exceptions=True) return [r if not isinstance(r, Exception) else None for r in results] ``` ## Task Groups (Python 3.11+) ```python from asyncio import TaskGroup # Task groups for structured concurrency async def process_batch(items: list[int]) -> list[int]: results: list[int] = [] async with TaskGroup() as tg: tasks = [tg.create_task(process_item(item)) for item in items] # All tasks complete before this line return [task.result() for task in tasks] # Error handling with TaskGroup async def robust_processing(items: list[str]) -> tuple[list[str], list[Exception]]: results: list[str] = [] errors: list[Exception] = [] try: async with TaskGroup() as tg: for item in items: tg.create_task(process_item_safe(item)) except ExceptionGroup as eg: for exc in eg.exceptions: errors.append(exc) return results, errors ``` ## Async Context Managers ```python from typing import Self from collections.abc import AsyncIterator class AsyncDatabaseConnection: def __init__(self, url: str) -> None: self.url = url self._conn: Connection | None = None async def __aenter__(self) -> Self: self._conn = await connect(self.url) return self async def __aexit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: Any, ) -> None: if self._conn: await self._conn.close() async def query(self, sql: str) -> list[dict[str, Any]]: if not self._conn: raise RuntimeError("Not connected") return await self._conn.execute(sql) # Usage async def get_users() -> list[dict[str, Any]]: async with AsyncDatabaseConnection("postgresql://...") as db: return await db.query("SELECT * FROM users") # Async context manager with contextlib from contextlib import asynccontextmanager @asynccontextmanager async def get_db_session() -> AsyncIterator[Session]: session = await create_session() try: yield session await session.commit() except Exception: await session.rollback() raise finally: await session.close() ``` ## Async Generators ```python from collections.abc import AsyncIterator # Async generator for streaming data async def read_lines(filepath: str) -> AsyncIterator[str]: async with aiofiles.open(filepath) as f: async for line in f: yield line.strip() # Process stream async def process_file(filepath: str) -> int: count = 0 async for line in read_lines(filepath): await process_line(line) count += 1 return count # Async generator with cleanup async def fetch_paginated(url: str) -> AsyncIterator[dict[str, Any]]: page = 1 session = await create_session() try: while True: data = await session.get(f"{url}?page={page}") if not data: break yield data page += 1 finally: await session.close() ``` ## Async Comprehensions ```python # Async list comprehension async def fetch_all_users(u