better-result-migrate-v2

Migrate better-result TaggedError usage from v1 classes to v2 factories.

6|1|Updated Jun 1, 2025
One-click install
npx skills add https://github.com/rezics/rezics --skill better-result-migrate-v2-rezics
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: better-result-migrate-v2
Source: https://github.com/rezics/rezics/tree/main/.agents/skills/better-result/migrations/v2
Command: npx skills add https://github.com/rezics/rezics --skill better-result-migrate-v2-rezics

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Migrate existing better-result TaggedError usage from v1 (class-based) to v2 (factory-based) API. Use only when the target code already uses better-result or the user explicitly requests this migration.

Core Features & Use Cases

  • Converts class-based TaggedError definitions to the v2 factory pattern.
  • Updates constructor arguments and message derivation to v2 expectations.
  • Updates imports and static helpers to v2 equivalents.

Quick Start

Run the migration on target codebases that already use better-result or when the user requests this migration.

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 from v1 to v2?

To migrate better-result TaggedError from v1 to v2, convert class-based definitions to the factory pattern, update constructor arguments and imports, and replace legacy helpers with v2 equivalents while preserving custom message logic.

What is the difference between better-result v1 and v2 TaggedError APIs?

The better-result v1 TaggedError API relies on a class-based architecture, whereas the v2 API transitions to a factory-based pattern for constructing errors and deriving messages.

Does the better-result v2 migration preserve my custom TaggedError messages?

Yes, the better-result v2 migration preserves custom message logic by carefully updating constructors and imports to v2 expectations while maintaining your existing message derivation rules.

When should I run the better-result v1 to v2 migration?

You should run the better-result v1 to v2 migration only when your target TypeScript codebase already uses the better-result library or when you explicitly request to perform the update.

How to refactor TypeScript error classes to factory-based APIs?

To refactor TypeScript error classes to factory-based APIs, convert class definitions to factory functions, update constructor arguments, and replace static helpers with the new pattern's equivalents.