Write correct async Python runtime code with explicit blocking-I/O boundaries, cancellation, and timeout handling. Use when editing `asyncio` workflows, background loops, async services, or mixed sync/async integrations.
Scanned 9/4/2026
Install to Claude Code
npx -y skills add gabrielmoreira/agent-skills-mirror --skill python-async-runtime --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Python Async Runtime?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-python-async-runtime)More formats (shields.io, HTML) on the badges page.
---
name: python-async-runtime
description: Write correct async Python runtime code with explicit blocking-I/O boundaries, cancellation, and timeout handling. Use when editing `asyncio` workflows, background loops, async services, or mixed sync/async integrations.
metadata:
triggers:
files:
- "**/*.py"
keywords:
- asyncio
- async
- await
- background task
- cancellation
- timeout
---
# Python Async Runtime
## **Priority: P1 (HIGH)**
## Rules
- Keep blocking DB, subprocess, and legacy HTTP calls out of event-loop code.
- Use `asyncio.to_thread` only as an explicit boundary around blocking libraries.
- Make timeout and cancellation behavior visible in the call path.
- Track long-lived tasks, cleanup, and retries deliberately.
## Recipe
1. **Use async-native clients first**.
2. **Wrap blocking calls once** at the adapter seam.
3. **Propagate cancellation and timeout context** instead of swallowing it.
4. **Separate poll loop logic from work-item processing**.
5. **Test the timeout and error path**, not only the happy path.
## Anti-Patterns
- **No direct blocking I/O inside `async def`**.
- **No hidden infinite loops** without stop condition or observability.
- **No broad `except Exception` around await chains** that erases task state.
- **No orphan background tasks** without lifecycle ownership.
## References
- [Framework Map](../references/framework-map.md)
- [Async Boundaries](references/async-boundaries.md)
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!