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/streams-sockets-and-ownership.md
View on GitHub# Streams, Sockets, And Ownership
## Adapter Choice
| Source Or Sink | Use |
| --- | --- |
| Existing `Stream` input | `PipeReader.Create(stream, options)` |
| Existing `Stream` output | `PipeWriter.Create(stream, options)` |
| In-memory producer/consumer pair | `new Pipe(options)` |
| Socket receive loop | `PipeWriter.GetMemory`, receive into it, `Advance`, then `FlushAsync` |
| Socket send loop | `PipeReader.ReadAsync`, send sequence bytes, then `AdvanceTo` |
Pipe adapters centralize buffer management. Use `StreamPipeReaderOptions` or `StreamPipeWriterOptions` to define buffer sizes and whether completing the pipe leaves the underlying stream open.
## Ownership Rules
- Decide which component owns the stream/socket and which owns each pipe end before passing it across an API boundary.
- A method that owns the entire read/write loop also owns `CompleteAsync`. A helper that reads one frame must not complete a reader it did not create.
- Complete the pipe end before disposing its underlying transport, unless the transport lifetime contract requires an abort.
- Propagate a terminal transport exception through the corresponding `CompleteAsync(exception)` so the peer observes the cause.
- Do not use concurrent reads, concurrent flushes, or multiple owners on one pipe end.
## Protocol Framing
- Pipes carry arbitrary byte chunks, not messages. A transport read can split one frame or combine many frames.
- Parse fixed-size, delimiter, or length-prefixed frames incrementally. Validate headers and declared lengths before allocating/copying payloads.
- Process all available complete frames per read when possible; preserve the incomplete suffix through `AdvanceTo`.
## Sources
- [System.IO.Pipelines: streams](https://learn.microsoft.com/dotnet/standard/io/pipelines#streams)
- [PipeReader.Create](https://learn.microsoft.com/dotnet/api/system.io.pipelines.pipereader.create)
- [PipeWriter.Create](https://learn.microsoft.com/dotnet/api/system.io.pipelines.pipewriter.create)
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 |