OCaml Result skill for Claude Code: Chain parsing and validation
Handle expected failures with explicit Ok and Error values. The skill covers Result chains, value extraction, and choosing a default when one is appropriate.
中文Install in Claude Code
Use a local OCaml project. The example refers to Result.Syntax in the OCaml 5.4 library reference. Check your compiler version before running it.
- Download the repository snapshot at the linked commit. Copy the entire plugins/ocaml-dev/skills/result/ directory into .claude/skills/result/ in your practice project.
- Check that SKILL.md is directly inside .claude/skills/result/. Open Claude Code from the project root.
- Enter /result to start the example below.
Example task
Run /result and ask for a function that parses an integer and then checks it is positive. Supply 3, abc, and 0 as separate test inputs.What to check
Expect Ok 3 for 3, a parse error for abc, and a range error for 0. The second step receives a value only after parsing succeeds.
Original SKILL.md on GitHub · Updated
Frequently asked question
Should I use Result.get_ok on data supplied by users?
Handle expected parse failures by matching Ok and Error or by chaining with Result.bind. Result.get_ok raises when its argument is Error.