multiAI Summary Pending
fp-option-ref
Quick reference for Option type. Use when user needs to handle nullable values, optional data, or wants to avoid null checks.
28,273 stars
bysickn33
Installation
Claude Code / Cursor / Codex
$curl -o ~/.claude/skills/fp-option-ref/SKILL.md --create-dirs "https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/plugins/antigravity-awesome-skills-claude/skills/fp-option-ref/SKILL.md"
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/fp-option-ref/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How fp-option-ref Compares
| Feature / Agent | fp-option-ref | Standard Approach |
|---|---|---|
| Platform Support | multi | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Quick reference for Option type. Use when user needs to handle nullable values, optional data, or wants to avoid null checks.
Which AI agents support this skill?
This skill is compatible with multi.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Option Quick Reference
Option = value that might not exist. `Some(value)` or `None`.
## Create
```typescript
import * as O from 'fp-ts/Option'
O.some(5) // Some(5)
O.none // None
O.fromNullable(x) // null/undefined → None, else Some(x)
O.fromPredicate(x > 0)(x) // false → None, true → Some(x)
```
## Transform
```typescript
O.map(fn) // Transform inner value
O.flatMap(fn) // Chain Options (fn returns Option)
O.filter(predicate) // None if predicate false
```
## Extract
```typescript
O.getOrElse(() => default) // Get value or default
O.toNullable(opt) // Back to T | null
O.toUndefined(opt) // Back to T | undefined
O.match(onNone, onSome) // Pattern match
```
## Common Patterns
```typescript
import { pipe } from 'fp-ts/function'
import * as O from 'fp-ts/Option'
// Safe property access
pipe(
O.fromNullable(user),
O.map(u => u.profile),
O.flatMap(p => O.fromNullable(p.avatar)),
O.getOrElse(() => '/default-avatar.png')
)
// Array first element
import * as A from 'fp-ts/Array'
pipe(
users,
A.head, // Option<User>
O.map(u => u.name),
O.getOrElse(() => 'No users')
)
```
## vs Nullable
```typescript
// ❌ Nullable - easy to forget checks
const name = user?.profile?.name ?? 'Guest'
// ✅ Option - explicit, composable
pipe(
O.fromNullable(user),
O.flatMap(u => O.fromNullable(u.profile)),
O.map(p => p.name),
O.getOrElse(() => 'Guest')
)
```
Use Option when you need to **chain** operations on optional values.