csharp-async

Guide C# async code with Task/ValueTask returns and cancellation tokens.

Updated Apr 18, 2026
One-click install
npx skills add https://github.com/Zearain/ludum-dare-59 --skill csharp-async-zearain
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-async
Source: https://github.com/Zearain/ludum-dare-59/tree/main/.opencode/skills/csharp-async
Command: npx skills add https://github.com/Zearain/ludum-dare-59 --skill csharp-async-zearain

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guide developers to implement robust and efficient asynchronous code in C#, covering Task/ValueTask returns, cancellation handling, parallelization, and Godot-specific patterns such as ToSignal and SceneTreeTimer.

Core Features & Use Cases

  • Task/ValueTask return types and cancellation token propagation for public APIs.
  • Parallel execution and error handling using Task.WhenAll and Task.WhenAny.
  • Godot-specific async patterns, including proper async void usage for signal handlers and idiomatic ToSignal waits.

Quick Start

Apply these guidelines to implement safe, efficient async methods in your C# projects and Godot integrations.

Frequently Asked Questions about csharp-async

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle C# async code in Godot to prevent crashes and freezing?

C# async code in Godot requires following established patterns for Task returns, cancellation tokens, and Godot-specific async usage like ToSignal and SceneTreeTimer to ensure correct and safe execution. Proper async void usage for signal handlers is also critical to prevent runtime crashes.

What is the best way to return async results types in C# public APIs?

For C# public APIs, using Task or ValueTask return types is recommended. ValueTask provides better performance by reducing allocations in hot paths, while Task is suitable for general asynchronous operations. Consistent return types ensure predictable async behavior across your codebase.

How do I run parallel C# tasks and handle errors with Task.WhenAll?

Parallel execution and error handling in C# is achieved using Task.WhenAll and Task.WhenAny. Task.WhenAll waits for all tasks to complete and aggregates exceptions, while Task.WhenAny returns the first completed task, enabling patterns like racing operations or timeouts.

Can I use async void for Godot signal handlers in C#?

Yes, async void is specifically appropriate for Godot signal handlers in C#. The csharp-async guidelines specify proper async void usage for signal handlers, allowing you to safely fire asynchronous operations directly from Godot engine callbacks without blocking the main thread.

How do I propagate cancellation tokens in C# async methods?

Cancellation token propagation in C# involves passing CancellationToken parameters through public async APIs and downstream method calls. This ensures cooperative cancellation, allowing long-running async operations to stop gracefully when requested, improving application responsiveness and resource management.

Does this C# async guidance apply to non-Godot general applications?

Yes, the C# async guidance applies to general C# applications and Godot game development scenarios. It specifies return types, exception handling, and performance considerations for Task-based asynchronous programming that are relevant across both environments.