Tooluck logoTooluck
SKILL.md

csharp-concurrency-patterns

Agent skill fromAaronontheweb/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. Avoid locks and manual synchronization unless absolutely necessary.

How to install csharp-concurrency-patterns

install csharp-concurrency-patterns
# install the dotnet-skills pack with the skills CLI
npx skills add Aaronontheweb/dotnet-skills

# or add only this skill to Claude Code: copy the folder

skills/csharp-concurrency-patterns/

# into

~/.claude/skills/csharp-concurrency-patterns/ (all projects)

.claude/skills/csharp-concurrency-patterns/ (one project)

skills/csharp-concurrency-patterns/SKILL.md

MITFull file
1# .NET Concurrency: Choosing the Right Tool
2
3## When to Use This Skill
4
5Use this skill when:
6- Deciding how to handle concurrent operations in .NET
7- Evaluating whether to use async/await, Channels, Akka.NET, or other abstractions
8- Tempted to use locks, semaphores, or other synchronization primitives
9- Need to process streams of data with backpressure, batching, or debouncing
10- Managing state across multiple concurrent entities
11
12## Reference Files
13
14- [advanced-concurrency.md](advanced-concurrency.md): Akka.NET Streams, Reactive Extensions, Akka.NET Actors (entity-per-actor, state machines, cluster sharding), and async local function patterns
15
16## The Philosophy
17
18**Start simple, escalate only when needed.**
19
20Most concurrency problems can be solved with `async/await`. Only reach for more sophisticated tools when you have a specific need that async/await can't address cleanly.
21
22**Try to avoid shared mutable state.** The best way to handle concurrency is to design it away. Immutable data, message passing, and isolated state (like actors) eliminate entire categories of bugs.
23
24**Locks should be the exception, not the rule.** When you can't avoid shared mutable state:
251. **First choice:** Redesign to avoid it (immutability, message passing, actor isolation)
262. **Second choice:** Use `System.Collections.Concurrent` (ConcurrentDictionary, etc.)
273. **Third choice:** Use `Channel<T>` to serialize access through message passing
28…

Excerpt shown under the repository's MIT license.

More skills in dotnet-skills

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates