Skip to content
Skillpedia
General coding48k Β· #4652

fp-types-ref

What it does

Helps you choose the right types (like Option, Either, Task) in the fp-ts library to organize your TypeScript code, especially when dealing with potentially missing values or asynchronous operations with possible errors.

When to use it

  • βœ“Need to decide between Option, Either, Task, or TaskEither.
  • βœ“Unsure about how to import fp-ts types.
  • βœ“Want a quick guide for common fp-ts patterns.

Skill link

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/fp-types-ref/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/fp-types-ref/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œWhich fp-ts type should I use for a function that can fail and is asynchronous?”

5 new skills a week. 1 minute to read.

How it works

The AI uses a simple flowchart to guide your choice based on whether the operation is asynchronous, can fail, or if the value might be absent. It also provides code examples for imports and common patterns.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

fp-ts Quick Reference

When to Use

  • You need help choosing between Option, Either, Task, TaskEither, or related fp-ts types.
  • The task is about imports, decision guidance, or selecting the right abstraction for a TypeScript flow.
  • You want a compact reference for common fp-ts type choices and patterns.

Which Type Should I Use?

Is the operation async?
β”œβ”€ NO: Does it involve errors?
β”‚   β”œβ”€ YES β†’ Either<Error, Value>
β”‚   └─ NO: Might value be missing?
β”‚       β”œβ”€ YES β†’ Option<Value>
β”‚       └─ NO β†’ Just use the value
└─ YES: Does it involve errors?
    β”œβ”€ YES β†’ TaskEither<Error, Value>
    └─ NO: Might value be missing?
        β”œβ”€ YES β†’ TaskOption<Value>
        └─ NO β†’ Task<Value>

Common Imports

// Core
import { pipe, flow } from 'fp-ts/function'

// Types
import * as O from 'fp-ts/Option'      // Maybe exists
import * as E from 'fp-ts/Either'      // Success or failure
import * as TE from 'fp-ts/TaskEither' // Async + failure
import * as T from 'fp-ts/Task'        // Lazy async; no typed error channel
import * as A from 'fp-ts/Array'       // Array utilities

One-Line Patterns

Need Code
Wrap nullable O.fromNullable(value)
Default value O.getOrElse(() => fallbackValue)
Transform if exists O.map(fn)
Chain optionals O.flatMap(fn)
Wrap try/catch E.tryCatch(() => risky(), toError)
Wrap async TE.tryCatch(() => fetch(url), toError)
Run pipe pipe(value, fn1, fn2, fn3)

Pattern Match

// Option
pipe(maybe, O.match(
  () => 'nothing',
  (val) => `got ${val}`
))

// Either
pipe(result, E.match(
  (err) => `error: ${err}`,
  (val) => `success: ${val}`
))

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

Reference scope

These are fp-ts 2.x fragments. Supply application variables, types, validators and imports, and check the installed version. map does not catch thrown exceptions. Task has no typed error channel; an improperly wrapped promise can still reject. Use tryCatch at fallible boundaries.

Official API: fp-ts modules.

FAQ

What are Option, Either, and Task?

These are types that help you handle common programming situations more safely and organized, like values that might not exist (Option), operations that can succeed or fail (Either), and operations that take time to complete (Task).

What does 'asynchronous' mean?

It means an operation doesn't happen immediately but at some point in the future. Examples include fetching data from a server or reading a file.

What is fp-ts?

It's a popular library for TypeScript that brings functional programming concepts to help write more robust and predictable code.

Details

Original description by the author

Quick reference for fp-ts types. Use when user asks which type to use, needs Option/Either/Task decision help, or wants fp-ts imports.

repo: sickn33/agentic-awesome-skills

Popularity

GitHub stars
48k
Ranking position
#4652
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills