Back to skills
SKILL.md
Python Async Runtime
ASecurityWrite 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.
- 549 stars
- 0 votes
- 0 copies
- 2 views
- Added September 5, 2026
Works with
Security analysis
100/100Pro scans all 3 files and shows the line behind each finding
npx -y skills add HoangNguyen0403/agent-skills-standard --skill python-async-runtime --agent claude-codeAre you the author of Python Async Runtime?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-python-async-runtime-c1cc4334)---
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)
Files in this skill
- SKILL.md
- evals/evals.json
- references/async-boundaries.md
Attribution
Comments
Loading comments…