dotnet-async-patterns

Implement .NET async/await patterns with CancellationToken support in ASP.NET Core APIs.

Updated Jan 23, 2026
One-click install
npx skills add https://github.com/alexsandrocruz/DominusLeads --skill dotnet-async-patterns-alexsandrocruz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-async-patterns
Source: https://github.com/alexsandrocruz/DominusLeads/tree/main/backend/Sapienza.Leads/.claude/skills/dotnet-async-patterns
Command: npx skills add https://github.com/alexsandrocruz/DominusLeads --skill dotnet-async-patterns-alexsandrocruz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers write efficient, safe, and scalable asynchronous code in .NET, eliminating common pitfalls like deadlocks and synchronization context issues.

Core Features & Use Cases

  • Async/Await fundamentals and TAP usage across ASP.NET Core apps.
  • ConfigureAwait guidance and ValueTask optimization for hot paths.
  • CancellationToken propagation and parallel processing to improve throughput.
  • Error handling and deadlock prevention in real-world services.
  • Use Case: Refactor a synchronous data-access layer into non-blocking operations to improve throughput under load.

Quick Start

Apply this skill to refactor a sample ASP.NET Core API into fully asynchronous operations, ensuring no .Result or .Wait() calls and proper cancellation tokens.

Frequently Asked Questions about dotnet-async-patterns

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

FAQPage Schema
How do I prevent deadlocks when using async await in ASP.NET Core?

Prevent deadlocks in ASP.NET Core by eliminating blocking calls like .Result or .Wait() and properly implementing the Task-based Asynchronous Pattern with full async/await propagation throughout the call stack.

When should I use ValueTask instead of Task for async optimization?

Use ValueTask instead of Task for async optimization in high-frequency hot paths where operations often complete synchronously, avoiding unnecessary heap allocations while maintaining non-blocking I/O.

How do I propagate CancellationToken in dotnet async background services?

Propagate CancellationToken in dotnet background services by passing the token down through all asynchronous method signatures, ensuring parallel processing operations halt gracefully during shutdown.

Does ConfigureAwait improve scalability in Csharp data access layers?

ConfigureAwait improves scalability in Csharp data access layers by reducing unnecessary synchronization context switches, which is critical for non-blocking I/O operations in library code.

What is the best way to refactor synchronous data access into non-blocking operations?

The best way to refactor synchronous data access into non-blocking operations is to replace blocking I/O calls with async/await, apply ConfigureAwait, and inject CancellationToken parameters for safe parallelism.

Why does my async parallel processing cause synchronization context issues?

Async parallel processing causes synchronization context issues when mixing blocking calls with async workflows, requiring strict adherence to the Task-based Asynchronous Pattern and proper ConfigureAwait usage.