Better Result Migration
Migrates existing error handling patterns to type-safe, railway-oriented Result types using the better-result library.
This skill automates and guides the transition from imperative error handling, such as try/catch blocks and Promise rejections, to functional, type-safe patterns. It identifies I/O boundaries, categorizes errors into domain or infrastructure types, and implements TaggedErrors to ensure exhaustive error handling. By leveraging generator composition and Result chains, it helps developers build more resilient applications with predictable error states, improved type inference, and cleaner code architecture.
主要功能
01Converts try/catch blocks into structured Result.try patterns
02Implements TaggedError classes for robust domain error categorization
03Refactors complex callback chains into clean, readable generator-based compositions
04843 GitHub stars
05Migrates async Promise-based logic to Result.tryPromise for safer I/O
06Updates function signatures to reflect explicit, typed error return values
使用场景
01Implementing railway-oriented programming in a TypeScript backend
02Standardizing error handling at API, database, and file system boundaries
03Refactoring a legacy codebase from throwing exceptions to typed errors