python-async
Master Python asyncio, concurrent programming, and async/await patternsfor high-performance applications.Triggers: asyncio, async/await, coroutines, concurrent programming, async API,I/O-bound, websockets, background tasks, semaphores, async context managersUse when: building async APIs, concurrent systems, I/O-bound applications,implementing rate limiting, async context managersDO NOT use when: CPU-bound optimization - use python-performance instead.DO NOT use when: testing async code - use python-testing async module.Consult this skill for async Python patterns and concurrency.
When & Why to Use This Skill
This Claude skill is a specialized guide for mastering Python's asynchronous programming ecosystem, specifically focusing on asyncio and concurrent patterns. It enables developers to build high-performance, scalable applications by providing expert implementation strategies for async/await syntax, I/O-bound optimization, and complex task orchestration. It helps ensure code efficiency by preventing common pitfalls like blocking operations in asynchronous loops.
Use Cases
- Developing Scalable Web APIs: Building high-concurrency backends with frameworks like FastAPI or aiohttp using non-blocking I/O patterns.
- High-Efficiency Data Acquisition: Creating high-speed web scrapers and crawlers that handle thousands of simultaneous network requests efficiently.
- Real-Time System Implementation: Designing and deploying WebSocket servers and event-driven architectures for live data streaming and instant messaging.
- Concurrency Control and Rate Limiting: Implementing semaphores and async context managers to manage resource-intensive tasks and prevent service exhaustion.
- Microservices Orchestration: Managing background tasks and asynchronous communication between distributed services to improve overall system responsiveness.
| name | python-async |
|---|---|
| description | | |
| Triggers | asyncio, async/await, coroutines, concurrent programming, async API, |
| Use when | building async APIs, concurrent systems, I/O-bound applications, |
| DO NOT use when | testing async code - use python-testing async module. |
| version | 1.0.0 |
| category | async |
| tags | [python, async, asyncio, concurrency, await, coroutines] |
| tools | [async-analyzer, concurrency-checker] |
| complexity | intermediate |
| estimated_tokens | 400 |
| progressive_loading | true |
Async Python Patterns
asyncio and async/await patterns for Python applications.
Quick Start
import asyncio
async def main():
print("Hello")
await asyncio.sleep(1)
print("World")
asyncio.run(main())
Verification: Run the command with --help flag to verify availability.
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
Modules
This skill uses progressive loading. Content is organized into focused modules:
- basic-patterns: Core async/await, gather(), and task management
- concurrency-control: Semaphores and locks for rate limiting
- error-handling-timeouts: Error handling, timeouts, and cancellation
- advanced-patterns: Context managers, iterators, producer-consumer
- testing-async: Testing with pytest-asyncio
- real-world-applications: Web scraping and database operations
- pitfalls-best-practices: 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
Command not found Ensure all dependencies are installed and in PATH
Permission errors Check file permissions and run with appropriate privileges
Unexpected behavior
Enable verbose logging with --verbose flag