Agent skill
Thinking in Streams skill
Drop-in instructions that teach coding agents to build Web Streams pipelines without losing backpressure, cancellation, or errors.
Install
Add the skill to any coding agent supported by the open skills CLI.
npx skills add withremyinc/streamThe CLI discovers thinking-in-streams in this repository and configures it for your agent. The skill then activates for streaming implementations and reviews.
What it teaches
A streaming feature should remain one unbroken chain of TransformStream stages from producer to consumer. Each stage adds domain behavior while native piping carries demand, cancellation, and failures in both directions.
The skill applies that model to LLM responses, tool-call arguments, SSE endpoints, incremental JSON and XML parsing, side effects, fan-out, and chunk-boundary-safe transforms.
Core rules
- Return fresh
<domain>Transformfactories with explicit input and output types. - Transform a stream you receive; create
ReadableStreamonly at a true data origin. - Prefer
pipeThrough,pipeTo, and library combinators over detached readers and writers. - Use
tee()only for independent consumers; a fast branch can outrun a slow sibling. - Emit as soon as meaning is known, retain only ambiguous input, and bound every buffer.
- Parse once, render incrementally, and commit the final emitted snapshot instead of reparsing.
Included references
- Library API map — choose the existing helper instead of hand-rolling a transform.
- Chunk-boundary patterns — residue, suspendable generators, bounded buffers, and split testing.
- Permissive parsing — one incremental parse path for malformed or partial model output.
Source of truth
This page is the short overview. The versioned SKILL.md and its references are the canonical agent instructions.