aalmada/Stationary / .agents/skills/dotnet-pipelines
dotnet-pipelines
VerifiedDesign, implement, debug, test, and review high-throughput byte-stream processing with System.IO.Pipelines. USE FOR: Pipe, PipeReader, PipeWriter, ReadResult, FlushResult, ReadOnlySequence, SequenceReader, buffer lifecycle, AdvanceTo, GetMemory, Advance, FlushAsync, stream and socket adapters, framing protocols, incremental parsing, backpressure, cancellation, and Pipes-to-Channels handoff. DO NOT USE FOR: item-level producer-consumer queues, durable/distributed messaging, ordinary small file I/O with no measured bottleneck, generic Stream APIs with no buffer-management concern, or ASP.NET middleware pipelines unrelated to System.IO.Pipelines.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.6 KB |
| references/pipes-and-channels-boundary.md | markdown | 1.9 KB |
| references/reader-parsing-and-lifetime.md | markdown | 2.7 KB |
| references/sources.md | markdown | 1.5 KB |
| references/streams-sockets-and-ownership.md | markdown | 2.0 KB |
| references/testing-performance-and-review.md | markdown | 2.4 KB |
| references/writer-flow-control-and-completion.md | markdown | 2.3 KB |
references/pipes-and-channels-boundary.md
View on GitHub# Pipes And Channels Boundary
## Different Jobs
| Concern | Prefer |
| --- | --- |
| Buffered transport bytes, framing, partial messages | `System.IO.Pipelines` |
| Independently owned work items, bounded worker concurrency | `System.Threading.Channels` |
| Fan-out or durable/cross-process delivery | A dedicated messaging design or broker |
Parse on the pipe reader, create an independently owned message, and enqueue that message to a bounded channel. The channel consumers must never receive a `ReadOnlySequence<byte>` or a view over pipe-owned memory.
```csharp
while (TryReadFrame(ref buffer, out ReadOnlySequence<byte> frame))
{
WorkItem item = DecodeOrCopy(frame);
await workWriter.WriteAsync(item, cancellationToken);
}
```
Backpressure must be explicit at both stages:
- `PipeWriter.FlushAsync` limits retained transport bytes through pipe thresholds.
- A bounded channel limits parsed-but-unprocessed work items and applies the selected overload policy.
- Awaiting a bounded channel write inside the pipe reader retains its current buffer. Keep item ownership small, capacity bounded, and latency understood; alternatively decouple work admission at a deliberate ownership boundary.
## Avoid These Errors
- Do not fire-and-forget channel writes from the pipe reader; this loses failures and moves the queue into scheduled tasks.
- Do not dispatch pipe-backed payloads to background workers after `AdvanceTo`; copy/decode first.
- Do not use an unbounded channel to hide a downstream bottleneck. Choose a capacity and a documented full policy.
- Do not assume multiple channel consumers preserve global frame-processing order.
## Sources
- [System.IO.Pipelines](https://learn.microsoft.com/dotnet/standard/io/pipelines)
- [System.Threading.Channels](https://learn.microsoft.com/dotnet/core/extensions/channels)
- [Pipelines and Channels performance example](https://dev.to/joni2nja/use-system-io-pipelines-and-system-threading-channels-apis-to-boost-performance-2nj5)
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 |