better-result-migrate-v2

Convert better-result TaggedError classes from v1 class-based to v2 factory-based API.

1.9k|41|Updated Jan 9, 2026
One-click install
npx skills add https://github.com/dmmulroy/better-result --skill better-result-migrate-v2
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: better-result-migrate-v2
Source: https://github.com/dmmulroy/better-result/tree/main/skills/migrations/v2
Command: npx skills add https://github.com/dmmulroy/better-result --skill better-result-migrate-v2

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams migrate better-result TaggedError definitions from v1 (class-based) to v2 (factory-based) API, aligning legacy error handling with the modern API surface.

Core Features & Use Cases

  • Migration of NotFoundError and other TaggedError classes: convert class definitions to TaggedError("Tag")<{ ... }>() pattern and adjust constructors.
  • Update static helpers and imports: switch usage from TaggedError.* to the new API equivalents and update imports accordingly.
  • Workflow guidance: provides a repeatable, safe workflow to analyze, transform, and apply changes across a codebase.

Quick Start

Run the migration on your TypeScript project to convert v1 TaggedError classes to v2 factory-based APIs and update static methods and imports as needed.

Frequently Asked Questions about better-result-migrate-v2

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate better-result TaggedError classes from v1 to v2 factory-based API in TypeScript?

To migrate better-result TaggedError classes, convert v1 class-based definitions to the v2 factory-based TaggedError("Tag")<{ ... }>() pattern. This updates class syntax, static helpers, and imports across TypeScript files.

What's the best way to refactor TypeScript error handling from class-based to factory-based APIs?

Refactoring TypeScript error handling to factory-based APIs involves converting class definitions to factory patterns and adjusting constructors. The migration handles simple, computed, validation, and runtime-augmented errors with a safe, repeatable workflow.

Does the better-result v2 migration support computed and runtime-augmented TaggedError types?

Yes, the better-result v2 migration supports computed and runtime-augmented TaggedError types. It implements specific migration rules to transform simple, computed, validation, and runtime-augmented error definitions across multiple files.

How do I update static helpers and imports when migrating to better-result v2?

When migrating to better-result v2, static helpers and imports are updated by switching usage from TaggedError.* methods to new API equivalents. The migration adjusts import statements accordingly across the TypeScript codebase.

Can I automate TaggedError migration across multiple files in a TypeScript project?

Yes, you can automate TaggedError migration across multiple TypeScript files. The migration provides a safe workflow to analyze, transform, and apply changes across the codebase, ensuring consistent conversion from v1 to v2 API.

Why do I need to migrate better-result TaggedError definitions to a factory-based API?

Migrating better-result TaggedError definitions to a factory-based API aligns legacy error handling with the modern API surface. This transition updates class syntax and static helpers to match the v2 factory pattern.