csharp-async

Installation
SKILL.md

C# Async Programming Best Practices

Apply these practices when writing, reviewing, or refactoring asynchronous C# code.

Naming Conventions

  • Suffix all async methods with Async (e.g., GetDataAsync for a synchronous GetData)
  • Match names with synchronous counterparts when both exist

Return Types

  • Return Task<T> when the method produces a value
  • Return Task when the method has no return value
  • Use ValueTask<T> when the method frequently completes synchronously (e.g., cache hits, short-circuit returns) — this avoids a Task heap allocation on the hot path
  • Never return async void except in event handlers — async void methods swallow exceptions and cannot be awaited, making errors invisible to the caller

CancellationToken Propagation

CancellationTokens are the cooperative cancellation mechanism in .NET. Dropping a token silently means the user loses the ability to cancel an operation that might be long-running or expensive.

Installs
3
GitHub Stars
5
First Seen
May 21, 2026