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/testing-and-review.md
View on GitHub# Testing And Review
## Test Matrix
| Scenario | Assert |
| --- | --- |
| Empty, completed channel | `ReadAllAsync` ends without items |
| Bounded `Wait` channel is full | A writer waits until a read frees capacity |
| Drop policy is full | Correct item is discarded and loss is observed |
| Producer cancellation | Pending write cancels without completing the writer |
| Consumer cancellation | Enumeration stops without corrupting queue ownership |
| Multiple producers | Completion occurs only after all producers finish |
| Multiple consumers | Every item is processed once; order is not assumed |
| Producer completion fault | Consumers receive/drain as designed and supervisor observes fault |
| Hosted shutdown | Admission, drain/cancel policy, scope disposal, and timeout are correct |
Use test-controlled tasks, barriers, `TaskCompletionSource`, and short explicit timeouts to make contention deterministic. Do not use `Task.Delay` as synchronization or call blocking waits such as `.Result`/`.Wait()`.
## Review Checklist
1. Does the process-local, non-durable contract match the business requirement?
2. Is capacity bounded, or is unbounded growth justified and monitored?
3. Does full-mode behavior match the required loss/backpressure policy?
4. Are writer, reader, completion, and cancellation owners explicit?
5. Are `SingleWriter` and `SingleReader` accurate promises?
6. Is each item outcome explicit: success, retry, discard, durable failure record, or pipeline stop?
7. Are hosted consumers scope-safe, cancellation-aware, observable, and shutdown-tested?
8. Does concurrent consumption preserve all required ordering constraints?
## Diagnostics
- Record item type/category, enqueue attempt outcome, producer wait, consumer duration, retry count, failure class, drop count, and queue age where measurable.
- Avoid logging raw payloads or sensitive data. Correlate an opaque operation ID through producer and consumer logs.
- Alert on sustained producer waits, repeated drops, growing item age, crash-looping consumers, and drain timeout.
## Sources
- [Channels](https://learn.microsoft.com/dotnet/core/extensions/channels)
- [Building high-performance .NET apps with C# Channels](https://antondevtips.com/blog/building-high-performance-dotnet-apps-with-csharp-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 |