async-patterns

Design asynchronous processing systems with queues, workers, retry logic, and monitoring.

1|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts --skill async-patterns-kalilurrahman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: async-patterns
Source: https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts/tree/main/01-software-dev/async-patterns
Command: npx skills add https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts --skill async-patterns-kalilurrahman

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Background jobs, event-driven workflows, and long-running tasks fail silently or block applications when async architecture is improvised. This Skill provides concrete patterns for choosing queue systems, designing workers, handling retries, and monitoring async pipelines. ## Core Features & Use Cases - Queue System Selection: Compare Redis, RabbitMQ, AWS SQS, and Kafka across latency, persistence, ordering, throughput, and cost with a decision matrix. - Worker Architecture Patterns: Implement Celery + Redis, SQS + Lambda, or Kafka consumer groups with complete code examples in Python and Node.js. - Retry & Failure Handling: Apply exponential backoff, jittered retries, idempotency keys, and dead letter queues to prevent duplicate charges and lost tasks. - Use Case: You need to process payment webhooks reliably. Use this Skill to select SQS for durability, configure exponential backoff retries, add idempotency keys to prevent double charges, and set up dead letter queue alerts. ## Quick Start Design an async processing strategy for my application that handles email sending, payment webhooks, and daily report generation with appropriate queues and retry logic.

Frequently Asked Questions about async-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose between Redis, RabbitMQ, SQS, and Kafka for task queues?

Choose Redis for sub-millisecond latency with simple tasks, SQS for managed durability and reliability, Kafka for high throughput and ordered processing per partition, and RabbitMQ for complex routing with exchanges. Match the queue to your latency, persistence, and ordering requirements.

How do I implement retry logic with exponential backoff in Celery?

Use the retry method with a countdown calculated as 2 raised to the retry count, producing delays of 2, 4, 8, 16 seconds. Set max_retries to cap attempts and route permanently failed tasks to a dead letter queue for manual investigation.

What is idempotency and why do async tasks need it?

Idempotency ensures a task produces the same result when executed multiple times, preventing duplicate side effects like double charges after retries. Implement it with unique idempotency keys stored in the database or enforced via unique constraints.

When should I use Kafka instead of SQS for event processing?

Use Kafka when you need ordered processing per entity via partitions, throughput above 100k messages per second, or event replay capabilities. SQS is simpler and fully managed but lacks partition-level ordering except in FIFO mode.

How do I auto-scale Celery workers based on queue depth?

Use Kubernetes HorizontalPodAutoscaler with an external metric like celery_queue_length, scaling replicas between a minimum and maximum when messages per worker exceed a threshold. AWS Lambda scales automatically based on SQS queue depth.

Why are my async tasks being processed twice?

Duplicate processing happens when retries occur after partial completion or when at-least-once queues redeliver messages. Add idempotency keys, use database unique constraints, and commit message offsets only after successful processing.