pipeline-pattern-react
Installation
SKILL.md
Pipeline (React)
Why: Pipeline runs data through a fixed sequence of stages. Each stage receives input, transforms it, and passes the result to the next. All stages run in order; there is no conditional “skip” or early exit (barring errors). You avoid one big transform function and keep each step in its own function or module.
Hard constraints: Stages share a single contract (e.g. (data: T) => T). A pipeline is an ordered list of stages run in sequence. Flow is linear—no branching or handler-driven termination.
When to use
- Data transformation in the UI: Raw API response → normalize → map to view model → format for display (or export).
- Formatting/export pipelines: Data → filter → sort → format (CSV/JSON) → blob/download.
- Raw JSON sanitization: Transform API/state JSON with one stage per field to remove; build the pipeline conditionally from request/context (e.g. add removal stages by resource type or
includeXflags). - Parsing or normalization: User input or file content → parse → validate shape → normalize.
- You need a fixed, mandatory sequence (unlike Chain of Responsibility, where handlers can short-circuit).