csharp-concurrency-patterns

Guide .NET concurrency abstraction selection with a decision tree.

1|Updated Feb 16, 2026
One-click install
npx skills add https://github.com/bbsbot/mac-md-win --skill csharp-concurrency-patterns-bbsbot
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-concurrency-patterns
Source: https://github.com/bbsbot/mac-md-win/tree/main/.claude/skills/dotnet/skills/csharp-concurrency-patterns
Command: npx skills add https://github.com/bbsbot/mac-md-win --skill csharp-concurrency-patterns-bbsbot

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers choose the most appropriate concurrency abstraction in .NET, guiding them away from problematic manual synchronization and towards robust, scalable solutions.

Core Features & Use Cases

  • Guidance on async/await: For I/O-bound operations.
  • Parallel.ForEachAsync: For CPU-bound parallel processing.
  • System.Threading.Channels: For producer/consumer patterns and work queues.
  • Akka.NET Streams: For complex server-side stream processing with backpressure.
  • Reactive Extensions (Rx): For UI event composition and time-based operations.
  • Akka.NET Actors: For managing stateful entities and complex state machines.
  • Decision Tree: Visual aid to select the right tool.
  • Anti-pattern identification: Highlights common pitfalls like excessive locking.

Quick Start

Use the csharp-concurrency-patterns skill to decide whether to use async/await or Channels for a producer-consumer scenario.

Frequently Asked Questions about csharp-concurrency-patterns

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

FAQPage Schema
What is the best concurrency abstraction in .NET for producer-consumer work queues?

System.Threading.Channels is the recommended .NET concurrency abstraction for producer-consumer patterns and work queues. It provides robust coordination without requiring manual locks or complex synchronization logic.

How do I handle CPU-bound parallel processing in C# without manual synchronization?

Use Parallel.ForEachAsync for CPU-bound parallel processing in C# to avoid manual synchronization. This abstraction handles parallel execution safely, reducing the need for excessive locking and preventing common concurrency pitfalls.

When should I use async/await versus Channels for .NET concurrency?

Use async/await for I/O-bound operations and Channels for producer-consumer scenarios. A decision tree helps select the right tool by mapping specific workload characteristics to the optimal .NET concurrency abstraction.

Does Akka.NET work better than Reactive Extensions for complex stateful entity management?

Akka.NET Actors are suited for managing stateful entities and complex state machines, while Reactive Extensions target UI event composition. The decision tree distinguishes their use cases for server-side processing versus event streams.

Why should I avoid locks and manual synchronization in C# concurrent applications?

Avoiding locks and manual synchronization in C# prevents anti-patterns and scalability bottlenecks. The Skill identifies these common pitfalls and guides developers towards robust abstractions like Channels and Akka.NET for safer concurrent execution.