본문으로 건너뛰기
Skillpedia
일반 코딩48k · #4650

fp-ts-pragmatic

하는 일

이 가이드는 TypeScript에서 fp-ts 라이브러리를 실용적으로 사용하는 법을 가르칩니다. 복잡한 개념에 빠지지 않고, 더 깔끔하고 유지 관리하기 쉬운 코드를 작성하는 데 가장 유용한 부분에 집중합니다.

사용하는 경우

  • ✓fp-ts를 시작하고 간단한 예제가 필요할 때.
  • ✓null일 수 있는 값, 오류, 비동기 작업을 다루는 TypeScript 코드를 작성할 때.
  • ✓함수형 프로그래밍 이론을 전부 공부하지 않고 코드를 개선하고 싶을 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/fp-ts-pragmatic/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“fp-ts를 사용해 null일 수 있는 값을 TypeScript에서 간단하게 다루려면 어떻게 하나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

핵심 fp-ts 개념을 적용하는 패턴과 코드 예제를 보여 줍니다. 초점은 흔한 프로그래밍 문제를 직접 해결하는 데 있습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Pragmatic Functional Programming

Read this first. This guide cuts through the academic jargon and shows you what actually matters. No category theory. No abstract nonsense. Just patterns that make your code better.

Detailed Guide

Read the detailed guide before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.

When to Use This Skill

  • When starting with fp-ts and need practical guidance
  • When writing TypeScript code that handles nullable values, errors, or async operations
  • When you want cleaner, more maintainable functional code without the academic overhead
  • When refactoring imperative code to functional style

When NOT to Use FP

Functional programming is not always the answer. Here's when to keep it simple.

Simple Null Checks

// Just use optional chaining - it's built into the language
const city = user?.address?.city ?? 'Unknown'

// DON'T overcomplicate it
const city = pipe(
  O.fromNullable(user),
  O.flatMap(u => O.fromNullable(u.address)),
  O.flatMap(a => O.fromNullable(a.city)),
  O.getOrElse(() => 'Unknown')
)

Simple Loops

// A for loop is fine when you need early exit or complex logic
function findFirst(items: Item[], predicate: (i: Item) => boolean): Item | null {
  for (const item of items) {
    if (predicate(item)) return item
  }
  return null
}

// DON'T force FP when it doesn't help
const result = pipe(
  items,
  A.findFirst(predicate),
  O.toNullable
)

Performance-Critical Code

// For hot paths, imperative is faster (no intermediate arrays)
function sumLarge(numbers: number[]): number {
  let sum = 0
  for (let i = 0; i < numbers.length; i++) {
    sum += numbers[i]
  }
  return sum
}

// fp-ts creates intermediate structures
const sum = pipe(numbers, A.reduce(0, (acc, n) => acc + n))

When Your Team Doesn't Know FP

If you're the only one who can read the code, it's not good code.

// If your team knows this pattern
async function getUser(id: string): Promise<User | null> {
  try {
    const response = await fetch(`/api/users/${id}`)
    if (!response.ok) return null
    return await response.json()
  } catch {
    return null
  }
}

// Don't force this on them
const getUser = (id: string): TE.TaskEither<Error, User> =>
  pipe(
    TE.tryCatch(() => fetch(`/api/users/${id}`), E.toError),
    TE.flatMap(r => r.ok ? TE.right(r) : TE.left(new Error('Not found'))),
    TE.flatMap(r => TE.tryCatch(() => r.json(), E.toError))
  )

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.
자주 묻는 질문

fp-ts란 무엇인가요?

함수형 프로그래밍 원칙을 사용해 코드를 더 안전하고 체계적으로 작성하도록 돕는 TypeScript 라이브러리입니다.

언제 fp-ts를 쓰지 말아야 하나요?

기본적인 null 검사, 단순한 반복문, 최대 성능이 필요한 코드, 또는 팀이 함수형 프로그래밍에 익숙하지 않을 때처럼 매우 간단한 작업에는 쓰지 마세요.

fp-ts 전체 문서를 읽어야 하나요?

아닙니다. 이 가이드는 학술적인 복잡함 없이 빠르게 결과를 얻도록 가장 중요한 20%(80/20 방식)에 집중합니다.

상세 정보

작성자의 원본 설명

A practical, jargon-free guide to fp-ts functional programming - the 80/20 approach that gets results without the academic overhead. Use when writing TypeScript with fp-ts library.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#4650
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬