Package Manager Installation
Interactive Setup (Recommended)
For new projects, use the interactive CLI to get everything set up:- Install the better-result package
- Optionally fetch source code via opensrc for better AI context
- Install the adoption skill +
/adopt-better-resultcommand for AI agents - Optionally launch your agent to start refactoring
The adoption skill helps AI coding agents (OpenCode, Claude, Codex) guide you through converting existing error handling to better-result patterns.
Requirements
TypeScript 5.0+ is required. better-result uses modern TypeScript features for type safety.
TypeScript Configuration
For the best experience, enable strict mode in yourtsconfig.json:
tsconfig.json
Runtime Support
better-result is ESM-only and works with:- Node.js 16.0+
- Bun (all versions)
- Deno (with npm specifier:
npm:better-result) - Browsers (via bundlers like Vite, webpack, or esbuild)
Verify Installation
Create a simple test file to verify everything works:test.ts
Migrating from v1?
If you’re upgrading from better-result v1.x to v2.x, use the migration CLI:Next Steps
Now that better-result is installed, let’s build something:Quickstart Tutorial
Build your first Result-based application with a step-by-step guide