csharp-async

Enforce C# async best practices for naming, return types, and exception handling.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps developers follow best practices for asynchronous programming in C#, reducing common pitfalls and performance issues.

Core Features & Use Cases

  • Naming conventions: suffix Async for async methods and consistent alignment with sync counterparts (e.g., GetDataAsync() vs GetData()).
  • Return types: use Task, Task<T>, or ValueTask<T> appropriately; avoid void returns except for event handlers.
  • Exception handling: proper try/catch around awaits, avoid swallowing exceptions, and consider ConfigureAwait(false) in library code.
  • Performance: prefer Task.WhenAll/Task.WhenAny for parallelism and timeouts; minimize allocations and unnecessary awaits.
  • Common pitfalls & patterns: avoid async void (except event handlers), avoid mixing sync/blocking calls, consider IAsyncEnumerable for async sequences.
  • Implementation patterns: apply TAP, async streams, and async command patterns for long-running operations.

Quick Start

Provide a sample GetDataAsync implementation that demonstrates proper naming conventions, return types, and exception handling for asynchronous methods in C#.

Frequently Asked Questions about csharp-async

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

FAQPage Schema
How do I handle exceptions in C# async methods without swallowing them?

When choosing C# async return types, use Task, Task<T>, or ValueTask<T> appropriately. Avoid void returns except for event handlers, as void prevents the caller from awaiting the operation or catching its exceptions.

What is the best way to run parallel C# async tasks with a timeout?

Naming conventions for C# async methods require adding the Async suffix to method names, ensuring consistent alignment with synchronous counterparts like GetDataAsync() versus GetData() to clearly distinguish asynchronous operations.

Why should I avoid async void in C# application code?

You should avoid async void in C# because it prevents callers from awaiting the operation and handling exceptions properly. Async void is only safe for event handlers where the framework requires a void return signature.

When do I need IAsyncEnumerable for async sequences in C#?

You need IAsyncEnumerable in C# when working with async sequences that yield elements asynchronously. It supports async streams and long-running operations, applying the Task-based Async Pattern (TAP) for efficient iteration without blocking.