Csharp Async
Unsigned, install at your own risk
UnverifiedThis 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-asyncWhat 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.
Manual setup by platform
Claude Code
~/.claude/skills/multi-language-standards-csharp-async/SKILL.md
Instructions
C# Async and Cancellation
Priority: P0 (CRITICAL)
Core Rules
- Return type: Use
Taskfor async methods that do not need a synchronous fast path; useValueTaskonly 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 orTaskowner. - Cancellation: Accept
CancellationTokenas the last parameter, name itcancellationToken, 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, sofalseis not required for correctness there; follow the project convention rather than adding it mechanically. - No sync-over-async: Never block with
.Result,.Wait(), orGetAwaiter().GetResult()on async work. - ValueTask lifetime: Never await a
ValueTasktwice, store it, or share it across threads; convert toTaskbefore caching or racing. - TaskCompletionSource: Pass
TaskCreationOptions.RunContinuationsAsynchronouslyand complete withTrySet*.
Cancellation and Streaming
- Checkpoints: Call
ThrowIfCancellationRequested()before expensive work and after long loops. - Translate once: Let
OperationCanceledExceptionpropagate for caller cancellation; catch it only to add context or map a boundary. - Timeouts: Use
CancellationTokenSource.CreateLinkedTokenSourcewithCancelAfter; dispose the source. - IAsyncEnumerable: Mark the parameter with
[EnumeratorCancellation], consume withawait 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
.Resultin async code: It deadlocks and wraps exceptions. - No
Task.Runto 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.WhenAllfan-out with a semaphore or batching.
References
- Async, ValueTask, and cancellation patterns
Security
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.
[](https://skills-hub.ai/skills/multi-language-standards-csharp-async)<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.