manutej/luxor-claude-marketplace
Overview
This skill is a complete guide to asyncio concurrency patterns for building high-performance asynchronous Python applications. It distills event loops, coroutines, tasks, futures, synchronization primitives, async context managers, and production-ready task management into practical patterns. You get clear examples for common problems like rate limiting, producer/consumer workflows, and graceful cancellation.
How this skill works
The skill inspects and explains core asyncio primitives (event loop, coroutines, tasks, futures) and maps them to concrete concurrency patterns such as gather, wait, semaphores, locks, events, and queues. It demonstrates how to create, name, cancel, and handle exceptions in tasks, manage event loops and executors for blocking code, and implement async context managers for safe resource handling. Each pattern includes when to use it, example code, and operational tips for production use.
When to use it
- Building I/O-bound systems that must handle many concurrent connections
- Implementing web servers, API clients, websockets, or real-time dashboards
- Coordinating multiple async operations with proper error handling and cancellation
- Limiting concurrency or rate-limiting access to external services
- Creating robust producer/consumer pipelines and background job processors
Best practices
- Prefer asyncio.run() for simple programs and avoid mixing event loop creation patterns
- Use async context managers for resource setup/teardown (HTTP sessions, DB connections)
- Limit concurrency with Semaphore to prevent resource exhaustion and respect rate limits
- Handle task cancellation explicitly and re-raise CancelledError after cleanup
- Use gather(return_exceptions=True) or inspect task.exception() to collect failures without dropping exceptions
Example use cases
- Parallel HTTP requests with aiohttp and asyncio.gather to reduce latency
- Background worker pool using asyncio.Queue for producer/consumer job processing
- Connection-limited scrapers using asyncio.Semaphore to cap concurrent requests
- Graceful shutdown of long-running tasks with task.cancel() and cleanup in CancelledError handlers
- Running blocking CPU or I/O in ThreadPoolExecutor via loop.run_in_executor() to keep the event loop responsive
FAQ
Use gather when you need all results in input order and want a simple API; use wait when you need flexible strategies (first completed, first exception) or to cancel remaining tasks based on partial results.
How do I safely cancel tasks and clean up resources?
Call task.cancel(), catch asyncio.CancelledError inside the task to run cleanup, then await the task (suppress CancelledError when appropriate) to ensure finalization.
42 skills
This skill helps you master asyncio concurrency patterns in Python, enabling high-performance, scalable async apps for IO-bound workloads.
This skill helps you design and implement enterprise architecture patterns for scalable, resilient distributed systems with DDD, CQRS, and microservices
This skill helps you design and implement modern Next.js apps using App Router, Server Components, data fetching, routing, middleware, and full-stack patterns.
This skill helps you master Rust systems programming by teaching ownership, concurrency, async, unsafe code, and performance optimization for safe,
This skill guides you through REST API design patterns, resource modeling, versioning, pagination, and HATEOAS for scalable, maintainable APIs.
This skill enables thorough bash shell script testing with 100% coverage, structured categories, and performance validation to improve reliability.
This skill helps you master Python testing with pytest, enabling reliable fixtures, parametrization, mocking, and scalable test organization.
This skill helps you apply UI design patterns, accessibility practices, and design systems to create usable, responsive interfaces across platforms.
This skill guides building production-ready microservices with FastAPI, covering REST design, async patterns, dependency injection, testing, and deployment.
This skill helps you design, implement, and optimize production-grade GraphQL APIs with schemas, resolvers, auth, caching, and deployment best practices.
This skill guides you through Alembic database migrations for customer support systems, ensuring minimal downtime, data integrity, and safe production
This skill helps you securely implement OAuth2 and OpenID Connect across web, mobile, and API applications with best practices.
This skill helps you design user-centered interfaces, conduct research, and measure UX outcomes to improve accessibility and task flow.
This skill helps you orchestrate multi-container applications with Docker Compose, enabling rapid development, scalable deployments, and robust service
This skill enables fast browser automation and visual regression testing with Playwright MCP to validate UI consistency across browsers.
This skill guides building and deploying robust Apache Airflow data pipelines with DAGs, operators, sensors, dependencies, and production best practices.
This skill helps you design, implement, and productionize high-performance gRPC microservices with protobuf, streaming, and robust code generation.
This skill helps you design mobile-first responsive layouts using flexbox, grid, fluid typography, and responsive images for accessible, performant interfaces.
This skill helps you master production-grade LangChain orchestration across chains, agents, memory, and RAG patterns for scalable LLM applications.
This skill guides building, testing, and deploying robust CI/CD pipelines with GitHub Actions, automating patterns, and optimizing release management.
This skill helps you build modern Node.js applications, covering event loop, async patterns, streams, HTTP servers, and production best practices.
This skill helps you master Redis state management for caching, sessions, pub/sub, and distributed locks to build scalable, real-time applications.
This skill helps you implement dbt data transformation pipelines with modular models, tests, documentation, and production workflows to improve data quality.
This skill provides expert guidance to design, test, and optimize the unix-goto navigation tool with high performance and full test coverage.
This skill guides building Spring Boot applications with auto-configuration, DI, REST APIs, data access, security, and cloud-ready patterns.
This skill helps you master Vue.js development using Composition API, reactivity, components, directives, and modern Vue 3 patterns.
This skill helps you design, deploy, and manage AWS cloud infrastructure using S3, Lambda, DynamoDB, IAM, CloudFormation, and best practices.
This skill helps you quickly build production-ready Hasura GraphQL APIs with instant generation, fine-grained permissions, and real-time features.
This skill applies pandas-based analysis to customer support data, delivering actionable insights, SLA tracking, and performance reports.
This skill helps you build modern FastAPI backends with async patterns, Pydantic validation, and production-ready deployment strategies.
This skill helps you manage cloud infrastructure with Terraform IaC, covering resources, modules, state, and providers for scalable, repeatable deployments.
This skill helps you design, optimize, and maintain high-performance PostgreSQL databases at scale across indexing, partitioning, replication, and tuning.
This skill helps you build and optimize React apps with hooks, components, state management, and performance tips from official documentation.
This skill enables building, deploying, and managing multi-cloud Terraform infrastructures with reusable modules, state governance, and GitOps workflows.
This skill helps you design and operate production-grade AWS architectures by applying Well-Architected best practices across compute, storage, security, and
This skill helps you master Kubernetes orchestration, covering workloads, networking, storage, security, and production operations with practical guidance.
This skill accelerates software development by integrating Linear project management with MCP server, enabling rapid setup, intelligent issue tracking, and
This skill helps you design and analyze shell benchmarks, delivering actionable performance insights and target validation.
This skill helps you master Apache Spark data processing from RDDs to streaming and ML workflows for scalable analytics and production pipelines.
This skill helps you integrate Claude API with TypeScript, enabling streaming, tool use, error handling, and production-ready token optimization.
This skill guides building modern Svelte applications with reactive runes, components, stores, and lifecycle patterns to deliver fast, lightweight UIs.
This skill helps you design and optimize SQLAlchemy ORM patterns, sessions, and queries for fast, scalable PostgreSQL-backed support systems.