fp-refactor

Migrates imperative TypeScript codebases to fp-ts patterns like Either, TaskEither, and Reader.

11|3|Updated Jan 30, 2026
One-click install
npx skills add https://github.com/whatiskadudoing/fp-ts-skills --skill fp-refactor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fp-refactor
Source: https://github.com/whatiskadudoing/fp-ts-skills/tree/main/skills/fp-refactor
Command: npx skills add https://github.com/whatiskadudoing/fp-ts-skills --skill fp-refactor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides patterns and strategies for migrating imperative TypeScript code to functional FP-ts patterns, improving maintainability and composability.

Core Features & Use Cases

  • Refactoring strategies: replace imperative control flow with fp-ts constructs like Either, TaskEither, and Reader.
  • Step-by-step migration: identify errors, change return types to FP types, remove exceptions, and update call sites.
  • Use Case: When migrating a legacy TS project, you can gradually refactor modules to FP-style with minimal disruption.

Quick Start

Install recommended libraries and start migrating a small module to fp-ts, documenting changes.

Frequently Asked Questions about fp-refactor

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

FAQPage Schema
How do I refactor imperative TypeScript code to fp-ts patterns?

Refactoring imperative TypeScript to fp-ts involves replacing control flow with constructs like Either and TaskEither. You change return types, remove exceptions, and update call sites for a structured, testable migration.

What is the best way to migrate error handling to fp-ts in TypeScript?

Migrating error handling to fp-ts means replacing exceptions with Either or TaskEither types. This allows errors to be handled as values in the data flow, improving composability and testability across real-world modules.

How do I use TaskEither for asynchronous composition in TypeScript?

TaskEither enables asynchronous composition by wrapping operations that can fail into a single type. You replace imperative async/await and try-catch blocks with TaskEither chains to handle side effects and errors functionally.

Can I gradually refactor a legacy TypeScript project to functional programming?

Yes, you can gradually refactor a legacy TypeScript project to functional programming by migrating small modules to fp-ts patterns with minimal disruption. This step-by-step approach allows identifying errors and updating types incrementally.

When should I use the Reader pattern in fp-ts?

The Reader pattern in fp-ts is used when you need to pass dependencies through your functions explicitly. It replaces imperative dependency injection or global state, making data flow composable and testable during migration.