csharp-async
Provides best practices for asynchronous programming in C#. Helps write more efficient and responsive code.
What it does
This AI agent helps you write C# code more efficiently and safely by following best practices for asynchronous programming. It checks your code to ensure it's fast and avoids common errors.
When to use it
- ✓When writing C# code that needs to do multiple things at once without freezing.
- ✓When you want your program to respond more quickly.
- ✓To avoid common mistakes in C# code that handles long-running operations.
Example of what to ask your AI
“Review this C# code and tell me if I'm using asynchronous programming correctly: [your C# code here]”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The agent compares your code against a set of rules and recommendations for C# asynchronous programming. It identifies where you can improve naming, error handling, performance, and avoid common pitfalls.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add github/awesome-copilot --skill csharp-asyncOr download just the file:
curl -L https://raw.githubusercontent.com/github/awesome-copilot/main/skills/csharp-async/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
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()forGetData())
Return Types
- Return
Task<T>when the method returns a value - Return
Taskwhen the method doesn't return a value - Consider
ValueTask<T>for high-performance scenarios to reduce allocations - Avoid returning
voidfor async methods except for event handlers
Exception Handling
- Use try/catch blocks around await expressions
- Avoid swallowing exceptions in async methods
- Use
ConfigureAwait(false)when appropriate to prevent deadlocks in library code - Propagate exceptions with
Task.FromException()instead of throwing in async Task returning methods
Performance
- Use
Task.WhenAll()for parallel execution of multiple tasks - Use
Task.WhenAny()for implementing timeouts or taking the first completed task - Avoid unnecessary async/await when simply passing through task results
- Consider cancellation tokens for long-running operations
Common Pitfalls
- Never use
.Wait(),.Result, or.GetAwaiter().GetResult()in async code - Avoid mixing blocking and async code
- Don't create async void methods (except for event handlers)
- Always await Task-returning methods
Implementation Patterns
- Implement the async command pattern for long-running operations
- Use async streams (IAsyncEnumerable<T>) for processing sequences asynchronously
- Consider the task-based asynchronous pattern (TAP) for public APIs
When reviewing my C# code, identify these issues and suggest improvements that follow these best practices.
FAQ
What is asynchronous programming?
It's a way of writing code that allows your program to do other things while waiting for a time-consuming task (like fetching data from the internet) to finish, instead of just waiting idly.
Why should I use best practices?
Following best practices makes your code faster, easier to understand, less prone to bugs, and simpler to maintain by you and other programmers.
What are 'deadlocks'?
Deadlocks occur when two or more parts of your code are waiting for each other indefinitely, causing the program to freeze.
Details
Original description by the author
Get best practices for C# async programming
repo: github/awesome-copilot
Popularity
- GitHub stars
- 40k
- Ranking position
- #5094
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
acquire-codebase-knowledge
Helps your agent understand and document an existing code project. It's useful for onboarding new people or getting an overview of the architecture.
github/awesome-copilot
acreadiness-assess
Enables your agent to assess a project's readiness for AI and generate a report. It's useful for understanding how well a project is prepared to use AI tools.
github/awesome-copilot
acreadiness-generate-instructions
Helps your agent create instructions for AI tools based on an assessment. It's useful for improving how AI interacts with code and closing identified gaps.
github/awesome-copilot
acreadiness-policy
Enables your agent to help define or apply policies for AI project assessment. It's useful for standardizing how projects are evaluated and ensuring compliance.
github/awesome-copilot
Similar skills
benchmark-optimization-loop
Has your agent improve something's speed in a measured way. It tests multiple versions and chooses the fastest one that still works correctly.
affaan-m/ECC
change-impact
Helps your agent analyze the impact of code changes before making them. It compares the planned vs. actual results afterward, covering paths, data, tests, and documentation. Useful for risky or system-wide changes.
affaan-m/ECC
click-path-audit
Lets your agent trace all user buttons and interactions to find bugs. It finds issues where functions seem to work alone but fail together. Useful when bugs persist even after debugging.
affaan-m/ECC