What problem does it solve?
Enforces practical asynchronous programming conventions for C# to reduce deadlocks, blocking calls, inconsistent APIs, and incorrect exception handling across codebases.
Core Features & Use Cases
- Naming conventions: Require Async suffix for asynchronous methods and keep names aligned with synchronous counterparts.
- Return type guidance: Prefer Task and Task<T> as default, consider ValueTask<T> for high-frequency, low-allocation scenarios, and avoid async void except for event handlers.
- Exception handling and cancellation: Wrap await expressions in try/catch when appropriate, propagate exceptions correctly, use Task.FromException for non-async faulted tasks, and accept CancellationToken for long-running work.
- Concurrency and performance: Recommend Task.WhenAll for parallel independent work, Task.WhenAny for timeouts or first-completed tasks, avoid unnecessary async/await state machines by returning Task directly when possible, and prohibit blocking calls such as Result or Wait.
Quick Start
Use the csharp-async skill to refactor a C# async method to follow Async suffix naming, choose appropriate Task/ValueTask return types, add ConfigureAwait guidance, ensure proper exception propagation, and accept cancellation.