From antigravity-awesome-skills
Quick fp-ts Option reference for creating/transforming/extracting optional values; chain safe operations on nullables to avoid null checks in TypeScript.
How this skill is triggered — by the user, by Claude, or both
Slash command
/antigravity-awesome-skills:fp-option-refThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Option = value that might not exist. `Some(value)` or `None`.
Option = value that might not exist. Some(value) or None.
Option.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)
O.map(fn) // Transform inner value
O.flatMap(fn) // Chain Options (fn returns Option)
O.filter(predicate) // None if predicate false
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
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')
)
// ❌ 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.
npx claudepluginhub sickn33/antigravity-awesome-skills --plugin antigravity-awesome-skillsQuick reference for fp-ts Option type with create, transform, extract patterns and nullable comparisons. Use when handling nullable values or chaining optional data operations.
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.