chaining-neverthrow-results
Installation
SKILL.md
Chaining neverthrow Results
Overview
Once a value is a Result/ResultAsync, keep it one. Compose every step with combinators (.andThen / .map / .mapErr / .orElse / .andTee) and call .match exactly once, at the consumption edge, to turn the chain into the outside-world value (HTTP response, CLI exit, rendered output). The error channel stays a typed union the whole way; .match is where — and the only place where — it collapses.
This generalizes the route-boundary rule. RELATED: backend-typescript-roadmap owns the route specifics (ApplicationError union, err.statusCode satisfies ContentfulStatusCode); precise-type-modeling owns the error union itself.