csharp-async

Reviews and refactors C# async/await code against asynchronous programming best practices.

Updated Aug 24, 2026
One-click install
npx skills add https://github.com/aggutierrez98/TP-TD --skill csharp-async-aggutierrez98
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: csharp-async
Source: https://github.com/aggutierrez98/TP-TD/tree/main/.agents/skills/csharp-async
Command: npx skills add https://github.com/aggutierrez98/TP-TD --skill csharp-async-aggutierrez98

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing correct asynchronous C# code is error-prone: async void methods, sync-over-async deadlocks, missing cancellation tokens, and wrong return types cause subtle bugs that are hard to catch in review. This Skill encodes established async/await best practices so code can be written and reviewed consistently. ## Core Features & Use Cases - Naming and Return Type Guidance: Enforces the Async suffix convention and correct choices among Task, Task<T>, ValueTask<T>, and void. - Deadlock and Pitfall Detection: Flags blocking calls like .Result, .Wait(), and .GetAwaiter().GetResult(), plus async void usage outside event handlers. - Performance Patterns: Recommends Task.WhenAll, Task.WhenAny, cancellation tokens, ConfigureAwait(false), and IAsyncEnumerable<T> async streams. - Use Case: When reviewing a pull request containing a data access layer, use this Skill to identify sync-over-async calls and missing cancellation token parameters, then suggest refactored implementations. ## Quick Start Review my C# service class for async/await issues and suggest improvements following best practices.

Frequently Asked Questions about csharp-async

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

FAQPage Schema
How do I avoid deadlocks in C# async code?▼

Avoid blocking on async code with .Result, .Wait(), or .GetAwaiter().GetResult(), which cause sync-over-async deadlocks. Await tasks all the way up the call stack, and use ConfigureAwait(false) in library code to avoid capturing the synchronization context.

When should I use ValueTask instead of Task in C#?▼

Use ValueTask<T> in high-performance scenarios where the result is often available synchronously, reducing heap allocations. For most public APIs and general-purpose async methods, Task and Task<T> remain the recommended default return types.

Why is async void considered bad practice in C#?▼

Async void methods cannot be awaited, so exceptions escape the normal task pipeline and can crash the process. They should only be used for event handlers; all other async methods should return Task or Task<T>.

How do I run multiple async tasks in parallel in C#?▼

Use Task.WhenAll to await multiple tasks concurrently and collect all results. Use Task.WhenAny when you need the first completed task, such as implementing timeouts or racing redundant operations.

When should I add CancellationToken parameters to async methods?▼

Add CancellationToken parameters to long-running async operations so callers can cancel work cooperatively. This is standard practice for public APIs following the task-based asynchronous pattern (TAP) and prevents wasted resources on abandoned operations.