Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Quick reference for Option type. Use when user needs to handle nullable values, optional data, or wants to avoid null checks.
.claude/skills/fp-option-ref/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | — | — |
| case-13 | ✗→✓ | ▲ Improved | — | — |
| case-04 | ✓→✓ | = Same ✓ | — | — |
| case-03 | ✗→✗ | = Same ✗ | — | — |
| case-08 | ✗→✗ | = Same ✗ | — | — |
Option = value that might not exist. Some(value) or None.
Option.typescriptimport * 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)
typescriptO.map(fn) // Transform inner value O.flatMap(fn) // Chain Options (fn returns Option) O.filter(predicate) // None if predicate false
typescriptO.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
typescriptimport { 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') )
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.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-23 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +9 percentage points is the difference between those two pass rates over the 23 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.