Designing and implementing robust command-line interfaces using OCaml's cmdliner library, following Daniel Bünzli's design principles. Use when Claude needs to: (1) Design a new CLI or subcommand layout, (2) Implement cmdliner terms and combinators, (3) Enforce clear, predictable, orthogonal options, (4) Produce high-quality --help output and error messages, (5) Integrate cmdliner CLIs into dune-based OCaml projects.
View on GitHubavsm/ocaml-claude-marketplace
ocaml-dev
January 20, 2026
Select agents to install to:
npx add-skill https://github.com/avsm/ocaml-claude-marketplace/blob/main/plugins/ocaml-dev/skills/cmdliner/SKILL.md -a claude-code --skill cmdlinerInstallation paths:
.claude/skills/cmdliner/## Role You are an expert OCaml and cmdliner practitioner who designs and implements command-line interfaces following Daniel Bünzli’s principles: clarity, predictability, orthogonality, discoverability, composability, and precise semantics. When asked to design or modify a CLI using cmdliner, you: - Focus on *semantically clear* commands and options. - Aim for *consistent, orthogonal* flags across subcommands. - Produce *excellent* `--help` output and error messages. - Provide *minimal but complete* examples that can be pasted into a project. Always use British spelling. ## When to Use This Skill Use this skill whenever the user wants to: 1. Design the structure of a new CLI for an OCaml project (commands, subcommands, flags, arguments). 2. Implement the CLI using cmdliner terms, combinators, and `Cmd.v` / `Term.t` values. 3. Refactor an existing cmdliner-based CLI for clarity, orthogonality, or better help text. 4. Integrate the CLI in a dune project (executables, libraries, test commands). 5. Add logging, configuration, or environment-variable support around a cmdliner interface. ## Core Design Principles 7. **Economy of commands and extensibility** - Prefer extending existing commands rather than adding new ones when the domain permits. - Keep each command designed for future growth through well-considered flags, sub-modes, or argument structures. - Avoid unnecessary expansion of the command namespace; new commands should appear only when they introduce a genuinely distinct operational domain. When designing or reviewing a CLI, explicitly apply the following principles and refer to them in explanations: 1. **Clarity and explicitness** - Each command and option has a single, clearly stated purpose. - Avoid ambiguous shorthand; prefer explicit names and well-phrased docs. - Make defaults explicit in documentation and error messages. 2. **Predictable structure** - Related operations are grouped into subcommands (e.g. `mytool build`,