NetFabric/intelligentium / plugins/dotnet/.apm/skills/dotnet-channels
dotnet-channels
VerifiedDesign, implement, debug, test, and review in-process producer-consumer pipelines with System.Threading.Channels. USE FOR: Channel<T>, ChannelReader<T>, ChannelWriter<T>, bounded/unbounded queues, BoundedChannelFullMode, backpressure, TryWrite, WriteAsync, ReadAsync, ReadAllAsync, completion, cancellation, concurrent producers/consumers, BackgroundService workers, in-memory event queues, overload protection, and channel performance. DO NOT USE FOR: durable or cross-process messaging, distributed pub/sub, broker delivery guarantees, Rx.NET stream composition, task-parallel dataflow blocks, or simple thread-safe collections with no asynchronous producer-consumer requirement.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.3 KB |
| references/bounded-capacity-and-backpressure.md | markdown | 2.5 KB |
| references/concurrency-and-consumption.md | markdown | 2.4 KB |
| references/contracts-and-api.md | markdown | 3.0 KB |
| references/hosted-services-and-di.md | markdown | 2.1 KB |
| references/in-memory-messaging-boundaries.md | markdown | 1.8 KB |
| references/sources.md | markdown | 1.6 KB |
| references/testing-and-review.md | markdown | 2.2 KB |
references/in-memory-messaging-boundaries.md
View on GitHub# In-Memory Messaging Boundaries
## Valid Uses
- Decouple modules inside one process.
- Queue bounded background work after the initiating request has decided its own result.
- Serialize non-thread-safe processing or limit expensive concurrent work.
- Coalesce best-effort state updates when the newest value matters more than history.
## Not A Durable Broker
| Requirement | Use Instead Of Only A Channel |
| --- | --- |
| Survive process restart/crash | Durable queue, transactional outbox, or persisted job store |
| Cross process/machine delivery | Message broker or transport-backed queue |
| At-least-once/exactly-once semantics | Durable transport plus idempotency and deduplication design |
| Independent subscriber fan-out | Topic/pub-sub transport or separate managed queues |
| Operations replay/audit | Persistent event log or queue |
Channels deliver in memory only. A successful `WriteAsync` means the item entered the current process's queue, not that a consumer completed it or that it will survive a failure.
## In-Memory Event Bus
- Keep the public contract at the domain/event abstraction, not `Channel<T>`.
- Use a bounded queue when producers are request paths. Decide whether overload awaits, rejects, coalesces, or drops each event category.
- Create a DI scope for each event handler dispatch if handlers use scoped services.
- Add idempotency, retries, error recording, and observability before using it for meaningful side effects.
- Replace the channel with a durable boundary before splitting the process or requiring recovery guarantees. Do not present an in-memory queue as reliable integration messaging.
## Sources
- [Lightweight in-memory message bus](https://milanjovanovic.tech/blog/lightweight-in-memory-message-bus-using-dotnet-channels)
- [Channels](https://learn.microsoft.com/dotnet/core/extensions/channels)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |