result
OCaml Result type patterns using OCaml 5.x stdlib. Use when Claude needs to: (1) Handle errors with Result types, (2) Chain Result operations with let*, (3) Extract values from Ok/Error, (4) Refactor code using local let* bindings to use Result.Syntax
Unsigned, install at your own risk
UnverifiedThis skill has no cryptographic signature attached. We can't verify the contents match what the publisher intended.
Install this skill
No account required. Pick your tool, or use the command that detects it for you.
Run in your terminal. It detects your AI tool.
npx @skills-hub-ai/cli install ocaml-dev-resultManual setup by platform
Claude Code
~/.claude/skills/ocaml-dev-result/SKILL.md
Instructions
OCaml Result Patterns
OCaml 5.x provides Result.Syntax for monadic chaining and Result.get_ok/Result.get_error for extraction.
Result.Syntax
Use open Result.Syntax to get let* and let+ bindings:
open Result.Syntax
let process request =
let* req = validate request in
let* auth = authenticate req in
let* _ = authorize auth in
execute req
DO NOT define local let ( let* ) = Result.bind. Use open Result.Syntax instead.
Extracting Values
| Function | Behavior on Error |
|---|---|
Result.get_ok r | Raises Invalid_argument |
Result.get_error r | Raises Invalid_argument |
Result.value r ~default | Returns default |
Use Result.get_ok only when failure is a programming error:
(* Startup/config - crash on failure is intentional *)
let config = Result.get_ok (Config.load ())
(* Test setup - failure means test bug *)
let client = Result.get_ok (Tls.Config.client ~authenticator ())
Custom get_ok
Only define custom get_ok when you need different exception behavior:
(* Raises domain-specific Protocol_error instead of Invalid_argument *)
let get_ok = function
| Ok x -> x
| Error e -> raise (Protocol_error e)
If you just want Invalid_argument, use Result.get_ok directly.
Security
Reviews (0)
Related skills
Browse all →More from OCaml Dev (avsm)
View source →More Build skills
Browse category →Frequently asked questions about result
What does the result skill do?
OCaml Result type patterns using OCaml 5.x stdlib. Use when Claude needs to: (1) Handle errors with Result types, (2) Chain Result operations with let*, (3) Extract values from Ok/Error, (4) Refactor code using local let* bindings to use Result.Syntax It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the result skill?
Run `npx @skills-hub-ai/cli install ocaml-dev-result` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/ocaml-dev-result/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does result work with?
result runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the result skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use result after installing it?
In Claude Code, type `/ocaml-dev-result` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the result skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.