fp-react

fp-react is a skill for Claude Code, Codex from tmolavi/mcp-agent-skills-hub. It costs 37 tokens per session (5,031 once invoked), scanned A, original, MIT.

A pattern guide for using fp-ts, a TypeScript library for functional programming, with React applications. It covers typed handling of missing values, failures, asynchronous requests, validation, and loading states.

In plain words
What is it for?
It helps build React components for state management, forms, validation, and data fetching with clear loading, success, and error paths.
Why use it?
It helps keep common UI states explicit and consistent, reducing scattered null checks and ad hoc error handling. The examples target React 18/19 and Next.js 14/15.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps build React components for state management, forms, validation, and data fetching with clear loading, success, and error paths.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tmolavi/mcp-agent-skills-hub/fp-react
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add tmolavi/mcp-agent-skills-hub --skill fp-react
Clone the repo
git clone --depth 1 https://github.com/tmolavi/mcp-agent-skills-hub

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fp-react

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmolavi/mcp-agent-skills-hub/fp-react/github.svg)](https://agentmods.dev/skills/tmolavi/mcp-agent-skills-hub/fp-react)
Your own site
<a href="https://agentmods.dev/skills/tmolavi/mcp-agent-skills-hub/fp-react"><img src="https://agentmods.dev/badge/skills/tmolavi/mcp-agent-skills-hub/fp-react/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for fp-react

Your own site · 80×15
<a href="https://agentmods.dev/skills/tmolavi/mcp-agent-skills-hub/fp-react"><img src="https://agentmods.dev/badge/skills/tmolavi/mcp-agent-skills-hub/fp-react.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,031 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00037 $0.05031
Opus 5 $0.00018 $0.02516
Sonnet 5 $0.00007 $0.01006
Haiku 4.5 $0.00004 $0.00503

Measured 5d ago against content hash aa4e44f667d9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

fp-react scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

const res = await fetch(url)
Origin

Copies of this mod

2 near-identical copies found in the catalogue:

skills/fp-react/SKILL.md · 798 lines

How it starts

The opening of the file, as written. The whole thing — 798 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Functional Programming in React

Practical patterns for React apps. No jargon, just code that works.


Quick Reference

Pattern Use When
Option Value might be missing (user not loaded yet)
Either Operation might fail (form validation)
TaskEither Async operation might fail (API calls)
RemoteData Need to show loading/error/success states
pipe Chaining multiple transformations

1. State with Option (Maybe It's There, Maybe Not)

Use Option instead of null | undefined for clearer intent.

Basic Pattern

import { useState } from 'react'
import * as O from 'fp-ts/Option'
import { pipe } from 'fp-ts/function'

interface User {
  id: string
  name: string
  email: string
}

function UserProfile() {
  // Option says "this might not exist yet"
  const [user, setUser] = useState<O.Option<User>>(O.none)

  const handleLogin = (userData: User) => {
    setUser(O.some(userData))
  }

  const handleLogout = () => {
    setUser(O.none)
  }

  return pipe(
    user,
    O.match(
      // When there's no user
      () => <button onClick={() => handleLogin({ id: '1', name: 'Alice', email: '[email protected]' })}>
        Log In
      </button>,
      // When there's a user
      (u) => (
        <div>
          <p>Welcome, {u.name}!</p>
          <button onClick={handleLogout}>Log Out</button>
        </div>
      )
    )
  )
}

Chaining Optional Values

import * as O from 'fp-ts/Option'
import { pipe } from 'fp-ts/function'

interface Profile {
  user: O.Option<{
    name: string
    settings: O.Option<{
      theme: string
    }>
  }>
}

function getTheme(profile: Profile): string {
  return pipe(
    profile.user,
    O.flatMap(u => u.settings),
    O.map(s => s.theme),
    O.getOrElse(() => 'light') // default
  )
}

2. Form Validation with Either

Either is perfect for validation: Left = errors, Right = valid data.

Simple Form Validation

Read the full file on GitHub · 798 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 798 lines · 37 tokens per session scan A aa4e44f667d9

Subscribe to this mod's changes

fp-react is a skill published in the GitHub repository tmolavi/mcp-agent-skills-hub (8 stars, last pushed 13d ago), licensed MIT. It adds 37 tokens to every session and 5,031 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.