fp-types-ref – skill Khác cho agent AI
Tài liệu tham khảo nhanh về các kiểu fp-ts. Dùng khi người dùng hỏi nên dùng kiểu nào, cần hỗ trợ chọn Option/Either/Task hoặc cần import fp-ts.
Cài skill fp-types-ref bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/fp-types-ref-e1481.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /fp-types-ref – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/fp-types-ref-e1481.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $fp-types-ref – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/fp-types-ref-e1481.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /fp-types-ref – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/fp-types-ref-e1481.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /fp-types-ref – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
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 utilitiesOne-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](https://gcanti.github.io/fp-ts/modules/).
Skill liên quan
- fxmacrodata – Truy vấn FXMacroData để lấy chỉ số kinh tế vĩ mô từ nguồn chính thức, lịch công bố, lãi…
- gamification-engine – Sổ đăng ký điểm gamification: người chơi và phòng ban, số dư điểm và điểm kiếm được…
- geminiignore-finops – Cấu hình và tối ưu file .geminiignore để tăng hiệu quả context window của AI và giảm chi…
- geo-citability – Chấm điểm và tối ưu khả năng được AI trích dẫn (AI citability).
- geo-compare – Theo dõi biến động hằng tháng và báo cáo tiến độ cho khách hàng GEO.
- geo-fundamentals – Generative Engine Optimization cho các công cụ tìm kiếm AI (ChatGPT, Claude, Perplexity).
- geo-keyword-expansion-tool – Công cụ mở rộng từ khóa GEO. Dùng khi làm việc với từ khóa gốc và địa điểm mục tiêu.
- geo-prospect – CRM nhẹ để quản lý khách hàng tiềm năng và khách hàng của agency GEO.