Akka.NET Best Practices
Aaronontheweb/dotnet-skills
Guidance for Akka.NET actor systems covering EventStream versus DistributedPubSub, supervision, Props versus DependencyResolver, work distribution and testable cluster code.
A skill your agent uses when C async/await patterns including Task, ValueTask, async streams, and cancellation.
$ npx skills add sketch7/FluentlyHttpClient --skill csharp-async-patterns -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install sketch7/FluentlyHttpClient csharp-async-patterns --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/sketch7/FluentlyHttpClient.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/csharp-async-patterns .claude/skills/csharp-async-patterns && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "csharp-async-patterns" agent skill from https://github.com/sketch7/FluentlyHttpClient/tree/main/.agents/skills/csharp-async-patterns into .claude/skills/csharp-async-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "csharp-async-patterns", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/sketch7/FluentlyHttpClient/tree/main/.agents/skills/csharp-async-patternsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add sketch7/FluentlyHttpClient --skill csharp-async-patterns -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install sketch7/FluentlyHttpClient csharp-async-patterns --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/sketch7/FluentlyHttpClient.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/csharp-async-patterns .agents/skills/csharp-async-patterns && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "csharp-async-patterns" agent skill from https://github.com/sketch7/FluentlyHttpClient/tree/main/.agents/skills/csharp-async-patterns into .agents/skills/csharp-async-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "csharp-async-patterns", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add sketch7/FluentlyHttpClient --skill csharp-async-patterns -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install sketch7/FluentlyHttpClient csharp-async-patterns --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/sketch7/FluentlyHttpClient.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/csharp-async-patterns .cursor/skills/csharp-async-patterns && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "csharp-async-patterns" agent skill from https://github.com/sketch7/FluentlyHttpClient/tree/main/.agents/skills/csharp-async-patterns into .cursor/skills/csharp-async-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "csharp-async-patterns", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/sketch7/FluentlyHttpClient.git --path .agents/skills/csharp-async-patterns--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add sketch7/FluentlyHttpClient --skill csharp-async-patterns -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install sketch7/FluentlyHttpClient csharp-async-patterns --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/sketch7/FluentlyHttpClient.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/csharp-async-patterns .gemini/skills/csharp-async-patterns && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "csharp-async-patterns" agent skill from https://github.com/sketch7/FluentlyHttpClient/tree/main/.agents/skills/csharp-async-patterns into .gemini/skills/csharp-async-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "csharp-async-patterns", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install sketch7/FluentlyHttpClient csharp-async-patternsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add sketch7/FluentlyHttpClient --skill csharp-async-patterns -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/sketch7/FluentlyHttpClient.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/csharp-async-patterns .github/skills/csharp-async-patterns && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "csharp-async-patterns" agent skill from https://github.com/sketch7/FluentlyHttpClient/tree/main/.agents/skills/csharp-async-patterns into .github/skills/csharp-async-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "csharp-async-patterns", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add sketch7/FluentlyHttpClient --skill csharp-async-patterns -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install sketch7/FluentlyHttpClient csharp-async-patterns --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/sketch7/FluentlyHttpClient.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/csharp-async-patterns .opencode/skills/csharp-async-patterns && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "csharp-async-patterns" agent skill from https://github.com/sketch7/FluentlyHttpClient/tree/main/.agents/skills/csharp-async-patterns into .opencode/skills/csharp-async-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "csharp-async-patterns", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
csharp-async-patternsA skill your agent uses when C async/await patterns including Task, ValueTask, async streams, and cancellation.
Csharp Async Patterns is an agent skill from sketch7/FluentlyHttpClient. Use when C async/await patterns including Task, ValueTask, async streams, and cancellation. Use when writing asynchronous C code.
Its SKILL.md is about 5.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Development, covering Async programming. It works with C#. The repository describes itself as: Http Client for .NET Standard with fluent APIs which are intuitive, easy to use and also highly extensible. The licence is MIT.
10 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 397ee9b. It shows what the files ask for, not the result of running them.
Pre-approves these tools, so the agent can use them without asking each time:
BashReadWriteEditFrom allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are csharp).
From the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
learn.microsoft.comdevblogs.microsoft.comFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Csharp Async Patterns loads about 5.9k tokens when it runs. Until then it costs about 38 tokens; SKILL.md has 512 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check noted patterns worth knowing about, such as sudo or a known installer.
allowed-tools: Bash, Read, Write, EditAutomated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from sketch7/FluentlyHttpClient at commit 397ee9b, republished under its MIT licence (© sketch7). 512 words, ~5,852 tokens.
.claude/skills/csharp-async-patterns/SKILL.md (or your agent's skills folder).Master asynchronous programming in C# using async/await, Task, ValueTask, async streams, and cancellation patterns. This skill covers modern asynchronous patterns from C# 8-12 for building responsive, scalable applications.
The async/await pattern provides a simple way to write asynchronous code that looks and behaves like synchronous code.
public async Task<string> FetchDataAsync(string url)
{
using var client = new HttpClient();
string result = await client.GetStringAsync(url);
return result;
}
// Calling the async method
public async Task ProcessAsync()
{
string data = await FetchDataAsync("https://api.example.com/data");
Console.WriteLine(data);
}// ✅ Correct - Returns Task
public async Task ProcessDataAsync()
{
await Task.Delay(1000);
}
// ✅ Correct - Returns Task<T>
public async Task<int> CalculateAsync()
{
await Task.Delay(1000);
return 42;
}
// ⚠️ Only for event handlers - Returns void
public async void Button_Click(object sender, EventArgs e)
{
await ProcessDataAsync();
}
// ❌ Wrong - Not async but returns Task
public Task WrongAsync()
{
// Should be async or use Task.FromResult
return Task.CompletedTask;
}Task represents an asynchronous operation. Task<T> represents an operation that returns a value.
// Task.Run for CPU-bound work
public async Task<int> CalculateSumAsync(int[] numbers)
{
return await Task.Run(() => numbers.Sum());
}
// Task.FromResult for already-computed values
public Task<string> GetCachedValueAsync(string key)
{
if (_cache.TryGetValue(key, out var value))
{
return Task.FromResult(value);
}
return FetchFromDatabaseAsync(key);
}
// Task.CompletedTask for void async methods
public Task ProcessIfNeededAsync(bool condition)
{
if (!condition)
{
return Task.CompletedTask;
}
return DoActualWorkAsync();
}public async Task<Result> ProcessOrderAsync(Order order)
{
// Sequential execution
await ValidateOrderAsync(order);
await ChargePaymentAsync(order);
await ShipOrderAsync(order);
return new Result { Success = true };
}
public async Task<Result> ProcessOrderParallelAsync(Order order)
{
// Parallel execution
var validationTask = ValidateOrderAsync(order);
var inventoryTask = CheckInventoryAsync(order);
var pricingTask = CalculatePricingAsync(order);
await Task.WhenAll(validationTask, inventoryTask, pricingTask);
return new Result
{
IsValid = await validationTask,
InStock = await inventoryTask,
Price = await pricingTask
};
}ValueTask is a performance optimization for scenarios where the result is often available synchronously.
public class CachedRepository
{
private readonly Dictionary<int, User> _cache = new();
private readonly IDatabase _database;
// ✅ Good use of ValueTask - often returns synchronously
// from cache
public ValueTask<User> GetUserAsync(int id)
{
if (_cache.TryGetValue(id, out var user))
{
return ValueTask.FromResult(user);
}
return new ValueTask<User>(FetchUserFromDatabaseAsync(id));
}
private async Task<User> FetchUserFromDatabaseAsync(int id)
{
var user = await _database.QueryAsync<User>(id);
_cache[id] = user;
return user;
}
}public class BufferedReader
{
private readonly byte[] _buffer = new byte[4096];
private int _position;
private int _length;
// ValueTask for hot path optimization
public async ValueTask<byte> ReadByteAsync()
{
if (_position < _length)
{
// Synchronous path - no allocation
return _buffer[_position++];
}
// Asynchronous path - read more data
await FillBufferAsync();
return _buffer[_position++];
}
private async Task FillBufferAsync()
{
_length = await _stream.ReadAsync(_buffer);
_position = 0;
}
}
// ⚠️ ValueTask rules
public async Task ConsumeValueTaskAsync()
{
var reader = new BufferedReader();
// ✅ Correct - await once
byte b = await reader.ReadByteAsync();
// ❌ Wrong - don't store ValueTask
var task = reader.ReadByteAsync();
await task; // Potential issues
// ❌ Wrong - don't await multiple times
var vt = reader.ReadByteAsync();
await vt;
await vt; // NEVER do this
}Understanding when to use async void (rarely) versus async Task (almost always).
// ❌ Bad - Cannot await, exceptions unhandled
public async void ProcessDataBadAsync()
{
await Task.Delay(1000);
throw new Exception("Unhandled!"); // Crashes app
}
// ✅ Good - Can await, exceptions handled
public async Task ProcessDataGoodAsync()
{
await Task.Delay(1000);
throw new Exception("Handled!"); // Can be caught
}
// Usage
public async Task CallerAsync()
{
try
{
// Cannot await async void
ProcessDataBadAsync(); // Fire and forget - DANGEROUS
// Can await async Task
await ProcessDataGoodAsync(); // Exception caught here
}
catch (Exception ex)
{
Console.WriteLine($"Caught: {ex.Message}");
}
}// ✅ Event handlers - the ONLY valid use case
public partial class MainWindow : Window
{
public async void SaveButton_Click(object sender, RoutedEventArgs e)
{
try
{
await SaveDataAsync();
MessageBox.Show("Saved successfully!");
}
catch (Exception ex)
{
MessageBox.Show($"Error: {ex.Message}");
}
}
private async Task SaveDataAsync()
{
await _repository.SaveAsync(_data);
}
}Control synchronization context capture for performance in library code.
// Library code - use ConfigureAwait(false)
public class DataService
{
public async Task<Data> GetDataAsync(int id)
{
// ConfigureAwait(false) - don't capture context
var json = await _httpClient.GetStringAsync($"/api/data/{id}")
.ConfigureAwait(false);
var data = await DeserializeAsync(json)
.ConfigureAwait(false);
return data;
}
}
// UI code - DON'T use ConfigureAwait(false)
public class ViewModel
{
public async Task LoadDataAsync()
{
var data = await _dataService.GetDataAsync(42);
// Need UI context here
this.DataProperty = data; // Update UI
}
}public class AsyncLibrary
{
// ✅ Library method with ConfigureAwait(false)
public async Task<Result> ProcessAsync(string input)
{
var step1 = await Step1Async(input).ConfigureAwait(false);
var step2 = await Step2Async(step1).ConfigureAwait(false);
var step3 = await Step3Async(step2).ConfigureAwait(false);
return step3;
}
// ✅ ASP.NET Core - ConfigureAwait(false) safe everywhere
[HttpGet]
public async Task<IActionResult> GetData(int id)
{
// ASP.NET Core has no synchronization context
var data = await _repository.GetAsync(id).ConfigureAwait(false);
return Ok(data);
}
}Proper cancellation support for long-running operations.
public async Task<List<Result>> ProcessItemsAsync(
IEnumerable<Item> items,
CancellationToken cancellationToken = default)
{
var results = new List<Result>();
foreach (var item in items)
{
// Check for cancellation
cancellationToken.ThrowIfCancellationRequested();
var result = await ProcessItemAsync(item, cancellationToken);
results.Add(result);
}
return results;
}
// Usage with timeout
public async Task<List<Result>> ProcessWithTimeoutAsync(IEnumerable<Item> items)
{
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
try
{
return await ProcessItemsAsync(items, cts.Token);
}
catch (OperationCanceledException)
{
Console.WriteLine("Operation timed out");
throw;
}
}public class BackgroundProcessor
{
private CancellationTokenSource? _cts;
public async Task StartAsync()
{
_cts = new CancellationTokenSource();
await ProcessLoopAsync(_cts.Token);
}
public void Stop()
{
_cts?.Cancel();
}
private async Task ProcessLoopAsync(CancellationToken cancellationToken)
{
while (!cancellationToken.IsCancellationRequested)
{
try
{
await ProcessBatchAsync(cancellationToken);
await Task.Delay(1000, cancellationToken);
}
catch (OperationCanceledException)
{
// Expected when cancelled
break;
}
}
}
// Linked cancellation tokens
public async Task ProcessWithMultipleTokensAsync(
CancellationToken userToken,
CancellationToken systemToken)
{
using var linkedCts = CancellationTokenSource
.CreateLinkedTokenSource(userToken, systemToken);
await DoWorkAsync(linkedCts.Token);
}
}Stream data asynchronously using IAsyncEnumerable<T> (C# 8+).
public async IAsyncEnumerable<LogEntry> ReadLogsAsync(
string filePath,
[EnumeratorCancellation] CancellationToken cancellationToken = default)
{
await using var stream = File.OpenRead(filePath);
using var reader = new StreamReader(stream);
string? line;
while ((line = await reader.ReadLineAsync(cancellationToken)) != null)
{
if (TryParseLog(line, out var entry))
{
yield return entry;
}
}
}
// Consuming async streams
public async Task ProcessLogsAsync(string filePath)
{
await foreach (var log in ReadLogsAsync(filePath))
{
Console.WriteLine($"{log.Timestamp}: {log.Message}");
}
}public class DataStreamProcessor
{
// Async stream with filtering
public async IAsyncEnumerable<Event> GetEventsAsync(
DateTime startDate,
[EnumeratorCancellation] CancellationToken cancellationToken = default)
{
int page = 0;
while (true)
{
var events = await FetchPageAsync(page++, cancellationToken);
if (events.Count == 0)
yield break;
foreach (var evt in events.Where(e => e.Date >= startDate))
{
yield return evt;
}
}
}
// LINQ-style operations on async streams
public async IAsyncEnumerable<TResult> SelectAsync<TSource, TResult>(
IAsyncEnumerable<TSource> source,
Func<TSource, TResult> selector)
{
await foreach (var item in source)
{
yield return selector(item);
}
}
// Buffering async streams
public async IAsyncEnumerable<List<T>> BufferAsync<T>(
IAsyncEnumerable<T> source,
int bufferSize)
{
var buffer = new List<T>(bufferSize);
await foreach (var item in source)
{
buffer.Add(item);
if (buffer.Count >= bufferSize)
{
yield return buffer;
buffer = new List<T>(bufferSize);
}
}
if (buffer.Count > 0)
{
yield return buffer;
}
}
}Execute multiple async operations concurrently.
public async Task<Summary> GetDashboardDataAsync()
{
// Start all operations concurrently
var userTask = GetUserDataAsync();
var ordersTask = GetOrdersAsync();
var analyticsTask = GetAnalyticsAsync();
// Wait for all to complete
await Task.WhenAll(userTask, ordersTask, analyticsTask);
return new Summary
{
User = await userTask,
Orders = await ordersTask,
Analytics = await analyticsTask
};
}
// Handle partial failures
public async Task<Results> ProcessWithPartialFailuresAsync()
{
var tasks = new[]
{
ProcessTask1Async(),
ProcessTask2Async(),
ProcessTask3Async()
};
await Task.WhenAll(tasks.Select(async t =>
{
try
{
await t;
}
catch (Exception ex)
{
// Log but don't throw
Console.WriteLine($"Task failed: {ex.Message}");
}
}));
// Collect successful results
var results = tasks
.Where(t => t.IsCompletedSuccessfully)
.Select(t => t.Result)
.ToList();
return new Results { Successful = results };
}public async Task<T> WithTimeoutAsync<T>(Task<T> task, TimeSpan timeout)
{
var delayTask = Task.Delay(timeout);
var completedTask = await Task.WhenAny(task, delayTask);
if (completedTask == delayTask)
{
throw new TimeoutException("Operation timed out");
}
return await task;
}
// Racing multiple sources
public async Task<Data> GetFastestDataAsync()
{
var primaryTask = GetFromPrimaryAsync();
var secondaryTask = GetFromSecondaryAsync();
var cacheTask = GetFromCacheAsync();
var completedTask = await Task.WhenAny(primaryTask, secondaryTask, cacheTask);
return await completedTask;
}
// Throttled parallel processing
public async Task<List<Result>> ProcessWithThrottlingAsync(
IEnumerable<Item> items,
int maxConcurrency)
{
var semaphore = new SemaphoreSlim(maxConcurrency);
var tasks = items.Select(async item =>
{
await semaphore.WaitAsync();
try
{
return await ProcessItemAsync(item);
}
finally
{
semaphore.Release();
}
});
return (await Task.WhenAll(tasks)).ToList();
}Proper exception handling patterns for async methods.
public async Task<Result> ProcessWithErrorHandlingAsync()
{
try
{
var data = await FetchDataAsync();
return await ProcessDataAsync(data);
}
catch (HttpRequestException ex)
{
_logger.LogError(ex, "Network error occurred");
throw;
}
catch (Exception ex)
{
_logger.LogError(ex, "Unexpected error occurred");
return Result.Failed(ex.Message);
}
}
// Exception handling with Task.WhenAll
public async Task ProcessMultipleAsync()
{
var tasks = new[] { Task1Async(), Task2Async(), Task3Async() };
try
{
await Task.WhenAll(tasks);
}
catch (Exception ex)
{
// Only first exception is thrown
_logger.LogError(ex, "At least one task failed");
// To get all exceptions:
var exceptions = tasks
.Where(t => t.IsFaulted)
.Select(t => t.Exception)
.ToList();
foreach (var exception in exceptions)
{
_logger.LogError(exception, "Task failed");
}
}
}public async Task HandleAllExceptionsAsync()
{
var tasks = Enumerable.Range(1, 10)
.Select(i => ProcessItemAsync(i))
.ToArray();
try
{
await Task.WhenAll(tasks);
}
catch
{
// Examine all exceptions
var aggregateException = new AggregateException(
tasks.Where(t => t.IsFaulted)
.SelectMany(t => t.Exception?.InnerExceptions ?? Array.Empty<Exception>())
);
aggregateException.Handle(ex =>
{
if (ex is HttpRequestException)
{
_logger.LogWarning(ex, "Network error - retrying");
return true; // Handled
}
return false; // Rethrow
});
}
}Avoid common deadlock scenarios in async code.
// ❌ DEADLOCK - blocking on async code
public void DeadlockExample()
{
// This will deadlock in UI or ASP.NET contexts
var result = GetDataAsync().Result;
// This will also deadlock
GetDataAsync().Wait();
}
// ✅ CORRECT - async all the way
public async Task CorrectExample()
{
var result = await GetDataAsync();
}
// ✅ CORRECT - use ConfigureAwait(false) in library code
public async Task<Data> LibraryMethodAsync()
{
var data = await FetchAsync().ConfigureAwait(false);
return ProcessData(data);
}public class DeadlockFreeService
{
// ✅ Async all the way
public async Task<Result> ProcessAsync()
{
var data = await GetDataAsync();
var processed = await ProcessDataAsync(data);
return processed;
}
// ✅ If you must block, use Task.Run
public Result ProcessSync()
{
return Task.Run(async () => await ProcessAsync()).GetAwaiter().GetResult();
}
// ✅ Use async disposal
public async Task UseResourceAsync()
{
await using var resource = new AsyncDisposableResource();
await resource.ProcessAsync();
}
}Best practices for async code in ASP.NET Core applications.
[ApiController]
[Route("api/[controller]")]
public class ProductsController : ControllerBase
{
private readonly IProductRepository _repository;
// ✅ Async action methods
[HttpGet("{id}")]
public async Task<ActionResult<Product>> GetProduct(
int id,
CancellationToken cancellationToken)
{
var product = await _repository.GetByIdAsync(id, cancellationToken);
if (product == null)
return NotFound();
return Ok(product);
}
[HttpPost]
public async Task<ActionResult<Product>> CreateProduct(
[FromBody] CreateProductRequest request,
CancellationToken cancellationToken)
{
var product = await _repository.CreateAsync(request, cancellationToken);
return CreatedAtAction(nameof(GetProduct), new { id = product.Id }, product);
}
// ✅ Streaming responses with IAsyncEnumerable
[HttpGet("stream")]
public async IAsyncEnumerable<Product> StreamProducts(
[EnumeratorCancellation] CancellationToken cancellationToken)
{
await foreach (var product in _repository.GetAllStreamAsync(cancellationToken))
{
yield return product;
}
}
}public class DataProcessorService : BackgroundService
{
private readonly IServiceProvider _serviceProvider;
private readonly ILogger<DataProcessorService> _logger;
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
_logger.LogInformation("Data processor service starting");
while (!stoppingToken.IsCancellationRequested)
{
try
{
await ProcessDataBatchAsync(stoppingToken);
await Task.Delay(TimeSpan.FromMinutes(5), stoppingToken);
}
catch (OperationCanceledException)
{
// Expected when stopping
break;
}
catch (Exception ex)
{
_logger.LogError(ex, "Error processing data batch");
await Task.Delay(TimeSpan.FromSeconds(30), stoppingToken);
}
}
_logger.LogInformation("Data processor service stopped");
}
private async Task ProcessDataBatchAsync(CancellationToken cancellationToken)
{
using var scope = _serviceProvider.CreateScope();
var repository = scope.ServiceProvider.GetRequiredService<IDataRepository>();
await repository.ProcessBatchAsync(cancellationToken);
}
}Use this skill when:
<!-- markdownlint-disable-line MD013 -->© sketch7, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .agents/skills/csharp-async-patterns of sketch7/FluentlyHttpClient.
Open the folder on GitHubat commit 397ee9b
We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in sketch7/FluentlyHttpClient, which our catalogue first saw on October 7, 2026.
Csharp Async Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Csharp Async Patterns this skillsketch7/FluentlyHttpClient | 121 | 1 repos | ~5.9k | Automated safety check: Notes | MIT | |
| Akka.NET Best PracticesAaronontheweb/dotnet-skills | 1.2k | 1 repos | ~3.3k | Automated safety check: Pass | MIT | |
| Dotnet Csharpnovotnyllc/dotnet-artisan | 233 | — | ~1.7k | Automated safety check: Pass | MIT | |
| Csharp Concurrency PatternsAaronontheweb/dotnet-skills | 1.2k | 1 repos | ~2.2k | Automated safety check: Pass | MIT | |
| Csharp Prodavila7/claude-code-templates | 32k | 7 repos | ~538 | Automated safety check: Pass | MIT | |
| Dotnet Patternsaffaan-m/ECC | 274k | 1 repos | ~2.3k | Automated safety check: Pass | MIT |
Aaronontheweb/dotnet-skills
Guidance for Akka.NET actor systems covering EventStream versus DistributedPubSub, supervision, Props versus DependencyResolver, work distribution and testable cluster code.
novotnyllc/dotnet-artisan
Baseline C skill loaded for every .NET code path. An agent skill from novotnyllc/dotnet-artisan.
Aaronontheweb/dotnet-skills
Choosing the right concurrency abstraction in .NET - from async/await for I/O to Channels for producer/consumer to Akka.NET for stateful entity management.
davila7/claude-code-templates
Write modern C code with advanced features like records, pattern matching, and async/await.
affaan-m/ECC
Idiomatic C and .NET patterns, conventions, dependency injection, async/await, and best practices for building robust, maintainable .NET applications.
github/awesome-copilot
Get best practices for C async programming. An agent skill from github/awesome-copilot.
sketch7/FluentlyHttpClient
Write modern, high-performance C code using records, pattern matching, value objects, async/await, Span<T/Memory<T, and best-practice API design patterns.
sketch7/FluentlyHttpClient
A skill your agent uses when building .NET 10 or C 14 applications; when using minimal APIs, modular monolith patterns, or feature folders; when implementing HTTP resilience, Options pattern…
sketch7/FluentlyHttpClient
A skill your agent uses when C nullable reference types, null safety patterns, and migration strategies.
Works with
Categories
A skill your agent uses when C async/await patterns including Task, ValueTask, async streams, and cancellation. Csharp Async Patterns is an agent skill from sketch7/FluentlyHttpClient. Use when C async/await patterns including Task, ValueTask, async streams, and cancellation.
Csharp Async Patterns fits situations like: C async/await patterns including Task; writing asynchronous C code.
Run `npx skills add sketch7/FluentlyHttpClient --skill csharp-async-patterns -a claude-code`. Or copy the skill folder (.agents/skills/csharp-async-patterns in sketch7/FluentlyHttpClient) into .claude/skills/csharp-async-patterns in your project. Claude Code loads it when a task matches its description.
Run `npx skills add sketch7/FluentlyHttpClient --skill csharp-async-patterns -a codex`. Or copy the skill folder (.agents/skills/csharp-async-patterns in sketch7/FluentlyHttpClient) into .agents/skills/csharp-async-patterns in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add sketch7/FluentlyHttpClient --skill csharp-async-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/csharp-async-patterns, .gemini/skills/csharp-async-patterns, .github/skills/csharp-async-patterns and .opencode/skills/csharp-async-patterns in your project.
SKILL.md names no scripts, command-line tools or credentials: Csharp Async Patterns is instructions for the agent only. Its frontmatter pre-approves these tools: Bash, Read, Write, Edit.
SKILL.md names 2 domains. As links in the text: learn.microsoft.com and devblogs.microsoft.com. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.
Csharp Async Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 5.9k tokens (SKILL.md is roughly 23k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Csharp Async Patterns: Akka.NET Best Practices (Aaronontheweb/dotnet-skills, 1.2k stars), Dotnet Csharp (novotnyllc/dotnet-artisan, 233 stars), Csharp Concurrency Patterns (Aaronontheweb/dotnet-skills, 1.2k stars) and Csharp Pro (davila7/claude-code-templates, 32k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
sketch7 (a GitHub organization) maintains it in sketch7/FluentlyHttpClient, which has 121 GitHub stars. The repository holds 4 skills in this directory. The repository was last updated on September 18, 2026.
Source: sketch7/FluentlyHttpClient on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.