consuming-results-at-api-boundaries

Installation
SKILL.md

Consuming Results at API Boundaries

Overview

A package's public API boundary IS a consumption edge. Result / ResultAsync never appear in exported signatures — the outermost exported function calls .match itself and presents a conventional contract.

This closes the gap in [[chaining-neverthrow-results]]: "one .match at the consumption edge" does NOT mean "leave the .match to the caller of your package." Anything that crosses exports in package.json leaves your code for the outside world — that is, by definition, the edge. neverthrow is an internal composition tool, not a public contract.

The rule

Surface Error channel
Internal module ↔ internal module Pass Result / ResultAsync, keep chaining ([[chaining-neverthrow-results]])
Exported function (sync) .match inside; ok → return value, err → throw a named error class
Exported long-lived object .match inside; err → emit("error", error) / callback
Exported error types Export the error classes ([[modeling-errors-as-classes]]) — never Result values, never Result in a public type

The recipe (real example from this repo — packages/core)

Installs
1
GitHub Stars
6
First Seen
4 days ago
consuming-results-at-api-boundaries — naporin0624/electron-texture-bridge