Back to list
get2knowio

maverick-python-async

by get2knowio

Highway to the agent zone!

0🍴 0📅 Jan 25, 2026

SKILL.md


name: maverick-python-async description: Python async/await patterns and asyncio best practices version: 1.0.0 triggers:

  • async def
  • await
  • asyncio
  • async with
  • async for
  • coroutine
  • Task
  • gather
  • create_task
  • aiohttp
  • aiofiles

Python Async/Await Skill

Expert guidance for asynchronous Python programming with asyncio.

Core Concepts

Async Functions (Coroutines)

async def fetch_data(url: str) -> dict:
    """Async function returns a coroutine."""
    async with aiohttp.ClientSession() as session:
        async with session.get(url) as response:
            return await response.json()

Running Async Code

import asyncio

# Python 3.7+
asyncio.run(main())

# Or event loop (older style)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Common Patterns

Concurrent Execution

# gather - run concurrently, wait for all
results = await asyncio.gather(
    fetch_data(url1),
    fetch_data(url2),
    fetch_data(url3),
)

# create_task - run in background
task1 = asyncio.create_task(fetch_data(url1))
task2 = asyncio.create_task(fetch_data(url2))
result1 = await task1
result2 = await task2

Timeouts

try:
    result = await asyncio.wait_for(
        slow_operation(),
        timeout=5.0
    )
except asyncio.TimeoutError:
    print("Operation timed out")

Async Context Managers

async with aiohttp.ClientSession() as session:
    async with session.get(url) as response:
        data = await response.text()

Async Iterators

async for item in async_generator():
    process(item)

Antipatterns

❌ Blocking Calls in Async Functions

# BAD - blocks event loop
async def bad():
    time.sleep(1)  # BLOCKS!
    response = requests.get(url)  # BLOCKS!

# GOOD - use async alternatives
async def good():
    await asyncio.sleep(1)
    async with aiohttp.ClientSession() as session:
        response = await session.get(url)

❌ Not Awaiting Coroutines

# BAD - coroutine never executes
async def bad():
    fetch_data()  # Missing await!

# GOOD
async def good():
    await fetch_data()

❌ Creating Too Many Tasks

# BAD - creates 10000 tasks at once
tasks = [asyncio.create_task(fetch(url)) for url in urls]

# GOOD - use semaphore to limit concurrency
async def fetch_with_limit(url, semaphore):
    async with semaphore:
        return await fetch(url)

semaphore = asyncio.Semaphore(10)
tasks = [fetch_with_limit(url, semaphore) for url in urls]

Review Severity

  • CRITICAL: Blocking calls in async functions (time.sleep, requests.get)
  • MAJOR: Missing await on coroutines, not handling asyncio.CancelledError
  • MINOR: Not using async context managers, inefficient gather usage

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon