Skip to main content
BuildReviewed Dec 4, 2026

Csharp Async

v1.0.0New

Unsigned, install at your own risk

Unverified

This skill has no cryptographic signature attached. We can't verify the contents match what the publisher intended.

Install this skill

No account required. Pick your tool, then copy.

Run in your terminal. It detects your AI tool.

npx @skills-hub-ai/cli install multi-language-standards-csharp-async

What this does: Write correct C# async and cancellation code with Task, ValueTask, ConfigureAwait, IAsyncEnumerable, and CancellationToken. Use for C# async/await design, cancellation propagation, and ValueTask lifetime; defer language features, testing, and build configuration.

Or get the file:
Browse all CLI commands →
Manual setup by platform

Claude Code

~/.claude/skills/multi-language-standards-csharp-async/SKILL.md

Setup guide →
0Save

Instructions

C# Async and Cancellation

Priority: P0 (CRITICAL)

Core Rules

  • Return type: Use Task for async methods that do not need a synchronous fast path; use ValueTask only when the result is usually synchronous and awaited once.
  • No async void: Only event handlers may be async void; route other fire-and-forget work through an explicit queue or Task owner.
  • Cancellation: Accept CancellationToken as the last parameter, name it cancellationToken, and forward it to every awaitable call (CA2016).
  • ConfigureAwait: Decide by layer. Preserve context in application or UI code whose continuation touches UI state; use ConfigureAwait(false) in reusable library internals that do not need the caller's context. ASP.NET Core has no custom synchronization context by default, so false is not required for correctness there; follow the project convention rather than adding it mechanically.
  • No sync-over-async: Never block with .Result, .Wait(), or GetAwaiter().GetResult() on async work.
  • ValueTask lifetime: Never await a ValueTask twice, store it, or share it across threads; convert to Task before caching or racing.
  • TaskCompletionSource: Pass TaskCreationOptions.RunContinuationsAsynchronously and complete with TrySet*.

Cancellation and Streaming

  • Checkpoints: Call ThrowIfCancellationRequested() before expensive work and after long loops.
  • Translate once: Let OperationCanceledException propagate for caller cancellation; catch it only to add context or map a boundary.
  • Timeouts: Use CancellationTokenSource.CreateLinkedTokenSource with CancelAfter; dispose the source.
  • IAsyncEnumerable: Mark the parameter with [EnumeratorCancellation], consume with await foreach (... .WithCancellation(token)), and dispose async enumerators.

Verification

  • Test cancellation paths with a token that is already canceled and one canceled mid-flight.
  • Run analyzers (CA2016) and the project's focused tests.

Anti-Patterns

  • No .Result in async code: It deadlocks and wraps exceptions.
  • No Task.Run to fake async: Use it only for CPU-bound offload at a boundary.
  • No swallowed cancellation: Rethrow or translate; do not log-and-continue.
  • No unbounded concurrency: Bound Task.WhenAll fan-out with a semaphore or batching.

References

  • Async, ValueTask, and cancellation patterns
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

Frequently asked questions about csharp-async

What does the csharp-async skill do?

Write correct C# async and cancellation code with Task, ValueTask, ConfigureAwait, IAsyncEnumerable, and CancellationToken. Use for C# async/await design, cancellation propagation, and ValueTask lifetime; defer language features, testing, and build configuration. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the csharp-async skill?

Run `npx @skills-hub-ai/cli install multi-language-standards-csharp-async` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/multi-language-standards-csharp-async/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does csharp-async work with?

csharp-async runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the csharp-async skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use csharp-async after installing it?

In Claude Code, type `/multi-language-standards-csharp-async` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the csharp-async skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.

Badge for your README

Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.

Install on Skills Hub badge preview
Markdown
[![Install on Skills Hub](https://skills-hub.ai/api/badges/skill/multi-language-standards-csharp-async)](https://skills-hub.ai/skills/multi-language-standards-csharp-async)
HTML
<a href="https://skills-hub.ai/skills/multi-language-standards-csharp-async"><img src="https://skills-hub.ai/api/badges/skill/multi-language-standards-csharp-async" alt="Install on Skills Hub"></a>

More options in the badge docs.