MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Csharp-Async

Csharp-Async是一款code方向的AI技能,核心价值是Get best practices for C# async programming,可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。

Get best practices for C# async programming

Last verified on: 2026-05-30
mkdir -p ./skills/csharp-async && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/csharp-async/SKILL.md -o ./skills/csharp-async/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# 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

- 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.

🎯 Best For

  • Claude users
  • GitHub Copilot users
  • Software engineers
  • Development teams
  • Tech leads

💡 Use Cases

  • Code quality improvement
  • Best practice enforcement

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Csharp-Async to Your Work

    Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.

  4. 4

    Review and Refine

    Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.

❓ Frequently Asked Questions

Is Csharp-Async compatible with Cursor and VS Code?

Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.

Do I need specific dependencies for Csharp-Async?

Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.

How do I install Csharp-Async?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/csharp-async/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Skipping validation

Always test AI-generated code changes, even for simple refactors.

Missing dependency updates

Check if the skill requires updated dependencies or new packages.

🔗 Related Skills