coding/python-async-patterns/SKILL.md
Async Python patterns for building non-blocking I/O with asyncio and async/await: task orchestration, cancellation, timeouts, backpressure, rate limiting, and safe sync/async boundaries. Use when implementing concurrent network/DB workflows or async services.
npx skillsauth add aeondave/malskill python-async-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill focuses on practical asyncio patterns for I/O-bound concurrency.
time.sleep(), no sync HTTP/DB in async code).gather() can turn memory into a queue.to_thread() when necessary.Prefer asyncio.TaskGroup (Python 3.11+) for structured concurrency with clear failure propagation.
async with asyncio.TaskGroup() as tg:
tg.create_task(fetch_url(url1))
tg.create_task(fetch_url(url2))
# All tasks joined; exceptions aggregated
For concurrency limits, add a semaphore:
sem = asyncio.Semaphore(10)
async def bounded():
async with sem:
return await fetch_url(url)
asyncio.timeout() (3.11+) for scoped timeouts.asyncio.CancelledError only to clean up, then re-raise.asyncio.to_thread().Load on demand:
references/foundations.md — event loop, coroutines vs tasks, TaskGroup vs gatherreferences/cancellation-timeouts.md — cancellation semantics and timeout patternsreferences/backpressure-rate-limit.md — queues, semaphores, producer/consumer, rate limitingreferences/sync-async-interop.md — to_thread, executors, avoiding hidden blockingreferences/testing.md — testing async code patterns (pytest-asyncio) and flake avoidancedevelopment
Auth/lab ref: Unicorn Engine CPU-only emulation for shellcode, decryptors, custom VM handlers, instruction tracing, memory hooks, and register-level experiments.
development
Auth/lab ref: Renode board and SoC simulation for MCU/RTOS firmware, UART/GPIO/peripheral modeling, GDB remote debugging, REPL platforms, and RESC scripts.
development
Auth/lab ref: Qiling OS-layer binary emulation for PE/ELF/Mach-O/UEFI/shellcode with rootfs, syscall/API hooks, filesystem mapping, and runtime patching.
databases
Auth/lab ref: QEMU user-mode and full-system emulation for cross-arch binaries, firmware, kernels, disks, serial consoles, networking, and GDB stubs.