Async Task Pattern for Claude Code
Implements a robust asynchronous state machine pattern to handle long-running operations and prevent gateway timeouts.
This skill provides a standardized framework for converting slow synchronous operations (those exceeding 10 seconds) into non-blocking asynchronous tasks. It addresses critical backend challenges such as gateway timeouts, duplicate request prevention, and memory management through TTL-based state eviction. By following this pattern, developers can ensure data consistency, maintain application performance during heavy processing, and provide a superior user experience with progress-aware frontends and reliable polling mechanisms.
Key Features
01Frontend UX guidelines for progress tracking and polling management
02Standardized triggerAsync and getStatus state machine architecture
03Automatic memory leak prevention using TTL and LRU cleanup strategies
04ThreadLocal context propagation for multi-tenant and secure applications
05Idempotency logic to prevent duplicate execution of background tasks
06777 GitHub stars
Use Cases
01Orchestrating batch calls to external APIs with high cumulative latency
02Preventing 504 Gateway Timeouts in microservices or proxied environments
03Processing bulk data imports or large-scale database aggregations