{"id":"77380165-eb4c-4973-847b-ab38c721071c","shortId":"CF7xnn","kind":"skill","title":"fp-either-ref","tagline":"Quick reference for Either type. Use when user needs error handling, validation, or operations that can fail with typed errors.","description":"# Either Quick Reference\n\nEither = success or failure. `Right(value)` or `Left(error)`.\n\n## When to Use\n- You need a quick fp-ts reference for typed synchronous error handling.\n- The task involves validation, fallible operations, or converting throwing code to `Either`.\n- You want a compact cheat sheet rather than a long tutorial.\n\n## Create\n\n```typescript\nimport * as E from 'fp-ts/Either'\n\nE.right(value)           // Success\nE.left(error)            // Failure\nE.fromNullable(err)(x)   // null → Left(err), else Right(x)\nE.tryCatch(fn, toError)  // try/catch → Either\n```\n\n## Transform\n\n```typescript\nE.map(fn)                // Transform Right value\nE.mapLeft(fn)            // Transform Left error\nE.flatMap(fn)            // Chain (fn returns Either)\nE.filterOrElse(pred, toErr) // Right → Left if pred fails\n```\n\n## Extract\n\n```typescript\nE.getOrElse(err => default)  // Get Right or default\nE.match(onLeft, onRight)     // Pattern match\nE.toUnion(either)            // E | A (loses type info)\n```\n\n## Common Patterns\n\n```typescript\nimport { pipe } from 'fp-ts/function'\nimport * as E from 'fp-ts/Either'\n\n// Validation\nconst validateEmail = (s: string): E.Either<string, string> =>\n  s.includes('@') ? E.right(s) : E.left('Invalid email')\n\n// Chain validations (stops at first error)\npipe(\n  E.right({ email: 'test@example.com', age: 25 }),\n  E.flatMap(d => pipe(validateEmail(d.email), E.map(() => d))),\n  E.flatMap(d => d.age >= 18 ? E.right(d) : E.left('Must be 18+'))\n)\n\n// Convert throwing code\nconst parseJson = (s: string) => E.tryCatch(\n  () => JSON.parse(s),\n  (e) => `Parse error: ${e}`\n)\n```\n\n## vs try/catch\n\n```typescript\n// ❌ try/catch - errors not in types\ntry {\n  const data = JSON.parse(input)\n  process(data)\n} catch (e) {\n  handleError(e)\n}\n\n// ✅ Either - errors explicit in types\npipe(\n  E.tryCatch(() => JSON.parse(input), String),\n  E.map(process),\n  E.match(handleError, identity)\n)\n```\n\nUse Either when **error type matters** and you want to chain operations.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.","tags":["either","ref","antigravity","awesome","skills","sickn33","agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows"],"capabilities":["skill","source-sickn33","skill-fp-either-ref","topic-agent-skills","topic-agentic-skills","topic-ai-agent-skills","topic-ai-agents","topic-ai-coding","topic-ai-workflows","topic-antigravity","topic-antigravity-skills","topic-claude-code","topic-claude-code-skills","topic-codex-cli","topic-codex-skills"],"categories":["antigravity-awesome-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/sickn33/antigravity-awesome-skills/fp-either-ref","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add sickn33/antigravity-awesome-skills","source_repo":"https://github.com/sickn33/antigravity-awesome-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 34793 github stars · SKILL.md body (2,312 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-24T00:50:57.935Z","embedding":null,"createdAt":"2026-04-18T21:37:25.242Z","updatedAt":"2026-04-24T00:50:57.935Z","lastSeenAt":"2026-04-24T00:50:57.935Z","tsv":"'/either':85,170 '/function':162 '18':207,213 '25':196 'age':195 'ask':307 'boundari':315 'catch':243 'chain':120,185,272 'cheat':69 'clarif':309 'clear':282 'code':62,216 'common':153 'compact':68 'const':172,217,237 'convert':60,214 'creat':76 'criteria':318 'd':198,203,205,209 'd.age':206 'd.email':201 'data':238,242 'default':136,140 'describ':286 'e':80,148,165,224,227,244,246 'e.either':176 'e.filterorelse':124 'e.flatmap':118,197,204 'e.fromnullable':92 'e.getorelse':134 'e.left':89,182,210 'e.map':108,202,257 'e.mapleft':113 'e.match':141,259 'e.right':86,180,192,208 'e.tounion':146 'e.trycatch':101,221,253 'either':3,8,25,28,64,105,123,147,247,263 'els':98 'email':184,193 'environ':298 'environment-specif':297 'err':93,97,135 'error':14,24,36,51,90,117,190,226,232,248,265 'expert':303 'explicit':249 'extract':132 'fail':21,131 'failur':31,91 'fallibl':57 'first':189 'fn':102,109,114,119,121 'fp':2,45,83,160,168 'fp-either-ref':1 'fp-ts':44,82,159,167 'get':137 'handl':15,52 'handleerror':245,260 'ident':261 'import':78,156,163 'info':152 'input':240,255,312 'invalid':183 'involv':55 'json.parse':222,239,254 'left':35,96,116,128 'limit':274 'long':74 'lose':150 'match':145,283 'matter':267 'miss':320 'must':211 'need':13,41 'null':95 'onleft':142 'onright':143 'oper':18,58,273 'output':292 'pars':225 'parsejson':218 'pattern':144,154 'permiss':313 'pipe':157,191,199,252 'pred':125,130 'process':241,258 'quick':5,26,43 'rather':71 'ref':4 'refer':6,27,47 'requir':311 'return':122 'review':304 'right':32,99,111,127,138 's.includes':179 'safeti':314 'scope':285 'sheet':70 'skill':277 'skill-fp-either-ref' 'source-sickn33' 'specif':299 'stop':187,305 'string':175,177,178,220,256 'substitut':295 'success':29,88,317 'synchron':50 'task':54,281 'test':301 'test@example.com':194 'throw':61,215 'toerr':126 'toerror':103 'topic-agent-skills' 'topic-agentic-skills' 'topic-ai-agent-skills' 'topic-ai-agents' 'topic-ai-coding' 'topic-ai-workflows' 'topic-antigravity' 'topic-antigravity-skills' 'topic-claude-code' 'topic-claude-code-skills' 'topic-codex-cli' 'topic-codex-skills' 'transform':106,110,115 'treat':290 'tri':236 'try/catch':104,229,231 'ts':46,84,161,169 'tutori':75 'type':9,23,49,151,235,251,266 'typescript':77,107,133,155,230 'use':10,39,262,275 'user':12 'valid':16,56,171,186,300 'validateemail':173,200 'valu':33,87,112 'vs':228 'want':66,270 'x':94,100","prices":[{"id":"0c8ccbc4-0220-408b-b196-511fa73f1562","listingId":"77380165-eb4c-4973-847b-ab38c721071c","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"sickn33","category":"antigravity-awesome-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T21:37:25.242Z"}],"sources":[{"listingId":"77380165-eb4c-4973-847b-ab38c721071c","source":"github","sourceId":"sickn33/antigravity-awesome-skills/fp-either-ref","sourceUrl":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/fp-either-ref","isPrimary":false,"firstSeenAt":"2026-04-18T21:37:25.242Z","lastSeenAt":"2026-04-24T00:50:57.935Z"}],"details":{"listingId":"77380165-eb4c-4973-847b-ab38c721071c","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"sickn33","slug":"fp-either-ref","github":{"repo":"sickn33/antigravity-awesome-skills","stars":34793,"topics":["agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows","antigravity","antigravity-skills","claude-code","claude-code-skills","codex-cli","codex-skills","cursor","cursor-skills","developer-tools","gemini-cli","gemini-skills","kiro","mcp","skill-library"],"license":"mit","html_url":"https://github.com/sickn33/antigravity-awesome-skills","pushed_at":"2026-04-24T00:28:59Z","description":"Installable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.","skill_md_sha":"63f27dd2ad1b83479af7b9a6f290b010d40b584e","skill_md_path":"skills/fp-either-ref/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/fp-either-ref"},"layout":"multi","source":"github","category":"antigravity-awesome-skills","frontmatter":{"name":"fp-either-ref","description":"Quick reference for Either type. Use when user needs error handling, validation, or operations that can fail with typed errors."},"skills_sh_url":"https://skills.sh/sickn33/antigravity-awesome-skills/fp-either-ref"},"updatedAt":"2026-04-24T00:50:57.935Z"}}