What problem does it solve? Background workers that claim tasks from a database can leave tasks stuck forever when pods are killed or the DB goes down, pre-check duplicate queries race under concurrency, and large file exports buffered in MemoryStream cause OOM kills. This Skill provides three concrete .NET patterns that solve each of these failure modes. ## Core Features & Use Cases - Lease-Based Background Processing: Claim DB tasks with FOR UPDATE SKIP LOCKED, renew a time-limited lease via heartbeat, and finalize with guarded LockToken checks so crashed workers' tasks are safely reclaimed. - Race-Free Duplicate Detection: Replace racy HasActive...() pre-checks with a unique filtered index plus a CommitResult contract that converts constraint violations into domain exceptions (HTTP 409). - Streaming File Export: Stream IAsyncEnumerable records to a temp file and upload to S3 as a Stream, keeping memory near zero for unbounded exports. - Use Case: A user triggers a large Excel export processed by a background worker; the worker claims the session with a lease, heartbeats during the S3 upload, and a duplicate export request is rejected atomically by the database constraint. ## Quick Start Ask the agent to implement a crash-safe background export worker using the lease-based processing pattern with heartbeat and guarded finalize.