python-async
Async Python patterns via asyncio and aiohttp for I/O-bound concurrency. Use when adding async APIs, handling concurrent I/O, or debugging async code.
Works with
---
name: python-async
description: Async Python patterns via asyncio and aiohttp for I/O-bound concurrency. Use when adding async APIs, handling concurrent I/O, or debugging async code.
license: MIT
---
# Async Python Patterns
asyncio and async/await patterns for Python applications.
## Quick Start
```python
import asyncio
async def main():
print("Hello")
await asyncio.sleep(1)
print("World")
asyncio.run(main())
```
## When To Use
- Building async web APIs (FastAPI, aiohttp)
- Implementing concurrent I/O operations
- Creating web scrapers with concurrent requests
- Developing real-time applications (WebSockets)
- Processing multiple independent tasks simultaneously
- Building microservices with async communication
## When NOT To Use
- CPU-bound optimization - use python-performance instead
- Testing async code - use python-testing async module
## Modules
This skill uses progressive loading. Content is organized into focused modules:
- See `modules/basic-patterns.md` - Core async/await, gather(), and task management
- See `modules/concurrency-control.md` - Semaphores and locks for rate limiting
- See `modules/error-handling-timeouts.md` - Error handling, timeouts, and cancellation
- See `modules/advanced-patterns.md` - Context managers, iterators, producer-consumer
- See `modules/testing-async.md` - Testing with pytest-asyncio
- See `modules/real-world-applications.md` - Web scraping and database operations
- See `modules/pitfalls-best-practices.md` - Common mistakes and best practices
Load specific modules based on your needs, or reference all for detailed guidance.
## Exit Criteria
- Async patterns applied correctly
- No blocking operations in async code
- Proper error handling implemented
- Rate limiting configured where needed
- Tests pass with pytest-asyncio
## Troubleshooting
### Common Issues
**RuntimeError: no current event loop**
Use `asyncio.run()` as the entry point. Avoid `get_event_loop()` in Python 3.10+.
**Blocking call in async context**
Move sync I/O to `asyncio.to_thread()` or `loop.run_in_executor()`.
**Tests hang indefinitely**
Ensure pytest-asyncio is installed and test functions are decorated with `@pytest.mark.asyncio`.More Debugging skills
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.
explore-code
lllllllama/rigorpilot-skills
Rigor Improve implementation leaf skill for auditable candidate implementation in deep learning research repositories. Use when the researcher explicitly authorizes exploratory work on an isolated branch or worktree to transplant modules, adapt a backbone, add LoRA or adapter layers, replace a head, or stitch together meaningful low-risk migration ideas with rollback-aware records in `explore_outputs/`. Do not use for end-to-end exploration orchestration on top of `current_research`, trusted baseline reproduction, conservative debugging, environment setup, verified contribution claims, or default repository analysis.
safe-debug
lllllllama/rigorpilot-skills
Rigor Debug / Rigor Audit skill for deep learning research work. Use when the user pastes a traceback, terminal error, CUDA OOM, checkpoint load failure, shape mismatch, NaN loss symptom, or training failure and wants conservative diagnosis before any patching, with debug fixes clearly separated from research contributions. Do not use for broad refactoring, speculative adaptation, automatic exploratory patching, or general repository familiarization.

