What problem does it solve?
Synchronous API endpoints that run longer than 10 seconds get cut off by gateway timeouts (30s), causing 502/504 errors, duplicate user clicks triggering concurrent executions, unbounded in-memory state caches leaking memory, and lost tenant context in child threads.
Core Features & Use Cases
- Async State Machine Template: Provides a standard
triggerAsync() + getStatus() pattern using ConcurrentHashMap and Executor so trigger endpoints return immediately while work runs in the background.
- Defensive Trap Coverage: Addresses five concrete failure modes: gateway timeout truncation, unbounded state cache growth (with TTL/LRU eviction strategies), lost
TenantContext/SecurityContext/MDC in child threads, duplicate concurrent triggers, and frontend double-polling conflicts.
- Frontend UX & Review Checklists: Defines polling behavior, button states, progress display, and a code review checklist for any new async task.
- Use Case: A 6000-row product duplicate-check that previously timed out at 30s is converted into a tenant-isolated async job with status polling, TTL-based state cleanup, and duplicate-trigger rejection.
Quick Start
Ask the AI to refactor the slow duplicate-check endpoint into an async trigger-plus-status polling pattern following this skill's template.