OCaml testing skill for Claude Code: Set up Dune and Alcotest tests
Organize module-level Alcotest suites and a shared runner. The skill covers assertions, isolated test cases, initialization order, and Dune commands.
中文Install in Claude Code
Use a practice OCaml project with Dune and Alcotest to run the tests. A short function signature is enough to plan the test structure.
- Download the repository snapshot at the linked commit. Copy plugins/ocaml-dev/skills/testing/ into .claude/skills/testing/ in your practice project and keep its reference files.
- Check that SKILL.md is directly inside .claude/skills/testing/. Open Claude Code from the project root.
- Enter /testing to try the example below.
Example task
Run /testing for Counter.total : int list -> int. Ask for tests that check [2, 3] returns 5 and an empty list returns 0. Request the files and command.What to check
The test suite names both cases, connects them to the runner, and identifies dune test as the project-level command.
Original SKILL.md on GitHub · Updated
Frequently asked question
Can separate OCaml modules share a test runner?
Yes. Each test module can export its own suite. Combine the suites in one runner, where shared setup can be configured if the project needs it.