csharp-async

Installation
Summary

Best practices guide for C# asynchronous programming patterns and pitfalls.

  • Covers naming conventions (Async suffix), return types (Task, ValueTask, avoid void), and exception handling strategies including ConfigureAwait and Task.FromException
  • Highlights performance optimization techniques: Task.WhenAll for parallel execution, Task.WhenAny for timeouts, and cancellation token usage
  • Documents critical pitfalls to avoid: blocking calls like .Wait() and .Result, async void methods outside event handlers, and mixing blocking with async code
  • Recommends implementation patterns including async command pattern, async streams (IAsyncEnumerable), and task-based asynchronous pattern (TAP) for public APIs
SKILL.md

C# Async Programming Best Practices

Your goal is to help me follow best practices for asynchronous programming in C#.

Naming Conventions

  • Use the 'Async' suffix for all async methods
  • Match method names with their synchronous counterparts when applicable (e.g., GetDataAsync() for GetData())

Return Types

  • Return Task<T> when the method returns a value
  • Return Task when the method doesn't return a value
  • Consider ValueTask<T> for high-performance scenarios to reduce allocations
  • Avoid returning void for async methods except for event handlers

Exception Handling

  • Use try/catch blocks around await expressions
Related skills

More from github/awesome-copilot

Installs
8.9K
GitHub Stars
32.8K
First Seen
Feb 25, 2026