Engineering PythonAsyncType Hints

Python Pro

Advanced Python patterns: async/await, metaclasses, decorators, type hints, packaging, virtual environments, and performance optimization.

An expert Python practitioner covering the full language depth: async concurrency with asyncio, descriptor and metaclass machinery, parametric decorators, PEP 695 type parameter syntax, and packaging with pyproject.toml. Diagnoses performance bottlenecks using cProfile and memory_profiler, and guides strict mypy adoption without breaking existing code.

Added Mar 20, 2026

$npx skills add johnefemer/skillfish --skill python-pro

What This Skill Can Do

Concrete capabilities you get when you install this skill.

Design async pipelines with asyncio, aiohttp, and TaskGroup

Write parametric decorators, descriptors, and metaclasses

Annotate codebases with mypy-compatible type hints incrementally

Profile CPU and memory bottlenecks with cProfile and tracemalloc

Package and publish libraries to PyPI with pyproject.toml and Hatch

Migrate from requirements.txt to modern dependency management (uv, Poetry)

Real Conversations

See how the Python Pro skill responds to actual requests. These are representative examples of what your AI agent will produce.

You

I need a retry decorator for async functions that does exponential backoff with jitter, a max retry count, and only retries on specific exception types. How should I implement this?

Agent

Here's a production-grade async retry decorator:

import asyncio
import random
from functools import wraps
from typing import Type

def async_retry(
    max_attempts: int = 3,
    base_delay: float = 0.5,
    max_delay: float = 30.0,
    exceptions: tuple[Type[Exception], ...] = (Exception,),
):
    def decorator(func):
        @wraps(func)
        async def wrapper(*args, **kwargs):
            last_exc: Exception | None = None
            for attempt in range(max_attempts):
                try:
                    return await func(*args, **kwargs)
                except exceptions as exc:
                    last_exc = exc
                    if attempt == max_attempts - 1:
                        raise
                    delay = min(base_delay * (2 ** attempt), max_delay)
                    jitter = random.uniform(0, delay * 0.25)
                    await asyncio.sleep(delay + jitter)
            raise last_exc  # unreachable, satisfies type checker
        return wrapper
    return decorator

# Usage
@async_retry(max_attempts=4, base_delay=1.0, exceptions=(aiohttp.ClientError, TimeoutError))
async def fetch_data(url: str) -> dict:
    async with aiohttp.ClientSession() as session:
        async with session.get(url, timeout=aiohttp.ClientTimeout(total=10)) as resp:
            return await resp.json()

Key decisions: @wraps(func) preserves docstrings and __name__; exceptions as a tuple means you can pass multiple types; jitter is 0–25% of the delay to prevent thundering-herd on concurrent retries.

Get Started

How to install and use this skill in your preferred environment.

Skills are designed for AI coding agents (Claude Code, Cursor, Windsurf) and IDE-based workflows where the agent can read files, run scripts, and act on your codebase.

Models & Context

Which AI models and context windows work best with this skill.

Recommended Models

Claude Sonnet 4 or GPT-4o handles Python idioms and async edge cases well. Avoid smaller models for metaclass or descriptor explanations.

Context Window

SKILL.md is ~5KB. Comfortable in 32K context for most tasks; large codebase refactors benefit from 64K+.

Pro tips for best results

1

Be specific

Include numbers — users, budget, RPS — so the skill can size the architecture.

2

Share constraints

Compliance needs, team size, and existing stack all improve the output.

3

Iterate

Start with a high-level design, then ask follow-ups for IaC, cost analysis, or security review.

4

Combine skills

Pair with companion skills below for end-to-end coverage.

Works Great With

These skills complement Python Pro for end-to-end coverage. Install them together for better results.

$ skillfish add johnefemer/skillfish --all # install all skills at once

Ready to try Python Pro?

Install the skill and start getting expert-level guidance in your workflow — any agent, any IDE.

$npx skills add johnefemer/skillfish --skill python-pro
← Browse all skills