dotnet-csharp-async-patterns

Guide async/await, Task, ValueTask, and CancellationToken usage in C# code.

10|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/AGIBuild/Agibuild.Fulora --skill dotnet-csharp-async-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-csharp-async-patterns
Source: https://github.com/AGIBuild/Agibuild.Fulora/tree/main/.cursor/skills/dotnet-csharp-async-patterns
Command: npx skills add https://github.com/AGIBuild/Agibuild.Fulora --skill dotnet-csharp-async-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses common pitfalls and best practices in writing asynchronous C# code, ensuring robust, deadlock-free, and efficient applications.

Core Features & Use Cases

  • Async/Await Best Practices: Covers correct Task and ValueTask usage, ConfigureAwait, and exception handling.
  • Cancellation Propagation: Demonstrates how to properly implement and respond to cancellation tokens.
  • Use Case: When developing a high-throughput web API, ensuring that all I/O operations are non-blocking and properly cancellable is crucial to prevent deadlocks and resource exhaustion. This skill provides the patterns to achieve that.

Quick Start

Use the dotnet-csharp-async-patterns skill to refactor the provided C# code snippet to correctly implement async/await patterns and cancellation.

Frequently Asked Questions about dotnet-csharp-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 C#?

To prevent deadlocks in C# async/await, avoid blocking on asynchronous operations and use ConfigureAwait correctly. This skill provides guidance on writing deadlock-free code by addressing common blocking errors and ensuring proper library versus application async patterns.

What is the difference between Task and ValueTask in .NET async programming?

Task and ValueTask in .NET async programming differ primarily in memory allocation. This skill provides best practices for correct Task and ValueTask usage, ensuring efficient asynchronous C# code by selecting the appropriate type for your specific performance needs.

How do I properly implement CancellationToken propagation in C#?

To properly implement CancellationToken propagation in C#, you must pass tokens through your asynchronous methods and respond to cancellation requests. This skill demonstrates how to correctly implement and propagate cancellation tokens to prevent resource exhaustion.

When should I use ConfigureAwait(false) in .NET library code?

You should use ConfigureAwait(false) in .NET library code to avoid capturing the synchronization context, preventing potential deadlocks. This skill focuses on the distinctions between library and application code for async patterns to ensure correct ConfigureAwait usage.

Why does my C# async code block the thread during I/O operations?

Your C# async code blocks the thread during I/O operations if it incorrectly waits on asynchronous tasks. This skill addresses common agent-generated code errors like blocking on async operations, providing patterns to ensure all I/O operations remain non-blocking.