csharp-async

Review C# async code for TAP compliance and concurrency issues.

Updated Mar 9, 2026
One-click install
npx skills add https://github.com/Cripacx/agentic-dotnet --skill csharp-async-cripacx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-async
Source: https://github.com/Cripacx/agentic-dotnet/tree/main/skills/csharp-async
Command: npx skills add https://github.com/Cripacx/agentic-dotnet --skill csharp-async-cripacx

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers write more robust, efficient, and maintainable asynchronous code in C# by adhering to established best practices.

Core Features & Use Cases

  • Naming Conventions: Ensures consistent naming for async methods.
  • Return Types: Guides the correct use of Task, Task<T>, and ValueTask<T>.
  • Exception Handling: Promotes proper error management in async operations.
  • Performance Optimization: Suggests techniques like Task.WhenAll and ConfigureAwait(false).
  • Pitfall Avoidance: Warns against common mistakes like using .Wait() or creating async void methods.
  • Use Case: Reviewing a C# method that performs I/O operations to ensure it correctly uses async/await and handles potential exceptions gracefully.

Quick Start

Review the following C# code snippet for async/await best practice violations.

Frequently Asked Questions about csharp-async

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

FAQPage Schema
How do I prevent deadlocks in C# async/await code?

To prevent deadlocks in C# async/await code, avoid using `.Wait()` or `.Result` and follow best practices like using `ConfigureAwait(false)` in library code to prevent synchronization context capture.

When should I use ValueTask<T> instead of Task<T> in C# asynchronous programming?

Use `ValueTask<T>` in C# asynchronous programming for high-frequency operations that often complete synchronously to reduce memory allocations, while using `Task<T>` for general asynchronous operations.

What are common pitfalls when implementing the Task-based Asynchronous Pattern (TAP) in C#?

Common pitfalls when implementing the Task-based Asynchronous Pattern (TAP) in C# include creating `async void` methods, blocking on asynchronous code, and improper exception handling for concurrent operations.

How do I handle exceptions correctly in C# async methods?

Handle exceptions correctly in C# async methods by awaiting tasks to ensure exceptions are propagated properly, and use `Task.WhenAll` to manage multiple failed operations gracefully without unobserved exceptions.

What is the best way to optimize C# async/await performance for I/O operations?

Optimize C# async/await performance for I/O operations by using `Task.WhenAll` to run operations concurrently and applying `ConfigureAwait(false)` to reduce context switching overhead.

Why should I avoid async void in C# asynchronous programming?

Avoid `async void` in C# asynchronous programming because it cannot be awaited, makes error handling difficult as exceptions cannot be caught by the caller, and can cause application crashes.