Agent skill
handling-async-operations-lite
Provides essential async programming patterns with Task and ValueTask. Use when quickly referencing core async/await techniques without detailed explanations.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/handling-async-operations-lite
SKILL.md
Async Programming Essentials
1. Task vs ValueTask
// General async: Use Task
public async Task<Data> LoadAsync() { }
// Frequent cache hits: Use ValueTask
public ValueTask<Data> GetAsync(string key)
{
if (_cache.TryGetValue(key, out var cached))
return new ValueTask<Data>(cached);
return new ValueTask<Data>(LoadFromDbAsync(key));
}
2. CancellationToken
public async Task<Data> LoadAsync(CancellationToken ct = default)
{
ct.ThrowIfCancellationRequested();
return await _httpClient.GetFromJsonAsync<Data>(url, ct);
}
// Timeout
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
await LongOperationAsync(cts.Token);
3. Anti-patterns
// ❌ No async void
public async void BadMethod() { }
// ❌ No .Result, .Wait() (deadlock)
var result = GetDataAsync().Result;
// ✅ Use await
var result = await GetDataAsync();
For details: See
/dotnet-asyncskill
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?