plugins/ocaml-dev/skills/result/SKILL.md
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
npx skillsauth add avsm/ocaml-claude-marketplace resultInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
OCaml 5.x provides Result.Syntax for monadic chaining and Result.get_ok/Result.get_error for extraction.
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.
| 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 ())
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.
tools
Working with the OxCaml extensions to OCaml. Use when the oxcaml compiler is available and you need high-performance, unboxing, stack allocation, data-race-free parallelism
development
Creating OCaml library tutorials using .mld documentation format with MDX executable examples. Use when discussing tutorials, documentation, .mld files, MDX, or interactive documentation.
development
Testing strategies for OCaml libraries. Use when discussing tests, alcotest, eio mocks, test structure, or test-driven development in OCaml projects.
development
Security hardening for OCaml libraries through systematic vulnerability research. Use when Claude needs to: (1) Research CVEs in similar implementations (C, Rust, Go, Python) and add regression tests, (2) Add fuzz tests for parsers and encoders, (3) Audit integer handling and buffer operations, (4) Test boundary conditions and malformed input, (5) Review cryptographic usage, (6) Add defensive checks against common vulnerability classes