Skip to content
Skillpedia
General coding48k · #3038

fp-types-ref

Lets your agent help choose types in fp-ts. It gives quick references for imports and type decisions.

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.

Example of what to ask your AI

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

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

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

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.
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.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add sickn33/agentic-awesome-skills --skill fp-types-ref

Or download just the file:

curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/fp-types-ref/SKILL.md -o SKILL.md
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
#3038
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills