← ClaudeAtlas

better-result-adoptlisted

Adopt better-result in an existing TypeScript codebase. Use when replacing try/catch, Promise rejection handling, null sentinels, or thrown domain exceptions with typed Result workflows.
wordbricks/onequery · ★ 15 · AI & Automation · score 83
Install: claude install-skill wordbricks/onequery
# better-result Adopt Adopt `better-result` incrementally in existing codebases without rewriting everything at once. ## When to Use Use this skill when the user wants to: - migrate from try/catch to `Result.try` or `Result.tryPromise` - replace nullable return values with typed `Result<T, E>` - define domain-specific `TaggedError` types - refactor nested error handling into `andThen` chains or `Result.gen` - standardize error handling across a service or module ## Reading Order | Task | Files to Read | | -------------------------------------- | ----------------------------- | | Adopt better-result in a module | This file | | Define or review error types | `references/tagged-errors.md` | | Inspect library implementation details | `opensrc/` if present | ## Prerequisites Before editing code: 1. Confirm `better-result` is already installed in the target project. 2. Check for an `opensrc/` directory. If present, read the package source there for current patterns. 3. Identify the migration scope first: one file, one module, or one boundary layer. ## Migration Strategy ### 1. Start at boundaries Begin with I/O boundaries and exception-heavy code: - HTTP clients - database access - file system operations - parsing and validation - framework adapters Do not convert the whole codebase at once. ### 2. Classify existing failures | Category | Examples