agentleFS
AdhamxonAdhamxon/claude-code-skills/.claude/skills/copilot-csharp-async/SKILL.md

csharp-async

Skill2 starsChanged 3 months agoMITView on GitHub

Get best practices for C# async programming

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 11 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the 'Async' suffix for all async methods

    line 12
  2. Very specific:

    Consider ValueTask<T> for high-performance scenarios to reduce allocations

    line 19
  3. Very specific:

    Avoid returning void for async methods except for event handlers

    line 20
  4. Distinctive:

    Use try/catch blocks around await expressions

    line 24
  5. Distinctive:

    Avoid swallowing exceptions in async methods

    line 25
  6. Very specific:

    Use ConfigureAwait(false) when appropriate to prevent deadlocks in library code

    line 26
  7. Very specific:

    Use Task.WhenAll() for parallel execution of multiple tasks

    line 31
  8. Very specific:

    Use Task.WhenAny() for implementing timeouts or taking the first completed task

    line 32
  9. Distinctive:

    Avoid unnecessary async/await when simply passing through task results

    line 33
  10. Distinctive:

    Consider cancellation tokens for long-running operations

    line 34
  11. Very specific:

    Never use .Wait(), .Result, or .GetAwaiter().GetResult() in async code

    line 38
  12. Distinctive:

    Avoid mixing blocking and async code

    line 39
  13. Distinctive:

    Don't create async void methods (except for event handlers)

    line 40
  14. Distinctive:

    Always await Task-returning methods

    line 41
  15. Distinctive:

    Use async streams (IAsyncEnumerable<T>) for processing sequences asynchronously

    line 46
  16. Distinctive:

    Consider the task-based asynchronous pattern (TAP) for public APIs

    line 47
  17. Distinctive:

    When reviewing my C# code, identify these issues and suggest improvements that follow these best practices.

    line 49

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
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
  • 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.

Download now (ZIP)

Trending

Surging: 1 new project took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Aug 30: 0 new projectsWeek of Sep 6: 0 new projectsWeek of Sep 13: 0 new projectsWeek of Sep 20: 0 new projectsWeek of Sep 27: 0 new projectsWeek of Oct 4: 1 new projectWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projects
Aug 2026Sep 2026Oct 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 1 in all, so this is a hint, not a trend.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.