cmdliner

Design and implement OCaml CLIs with cmdliner and dune projects.

26|5|Updated Jan 30, 2026
One-click install
npx skills add https://github.com/avsm/oxmono --skill cmdliner-avsm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cmdliner
Source: https://github.com/avsm/oxmono/tree/main/.claude/skills/cmdliner
Command: npx skills add https://github.com/avsm/oxmono --skill cmdliner-avsm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

cmdliner provides a robust and predictable way to define OCaml CLIs; this skill guides design and implementation to ensure clear commands, consistent flags, and high-quality help outputs.

Core Features & Use Cases

  • Structured CLI definitions with terms and info for top-level commands and subcommands.
  • Emphasis on orthogonality, discoverability, and composability across project CLIs.
  • Use Case: design a new CLI for a dune-based OCaml project or refactor an existing one for better ergonomics and maintainability.

Quick Start

Define a top-level Term and Info with Cmd.v and Cmdliner to scaffold a CLI, then incrementally add subcommands and flags.

Frequently Asked Questions about cmdliner

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a command-line interface in OCaml with subcommands?

You can build an OCaml CLI by defining a top-level Term and Info with Cmd.v, then incrementally adding subcommands and flags to structure predictable command hierarchies and helpful --help outputs.

What is the best way to structure subcommands and flags in an OCaml CLI?

The best way to structure OCaml CLIs is by enforcing clear, orthogonal options and explicit defaults using cmdliner terms, ensuring high discoverability and composability across your project's command hierarchies.

Can I integrate a cmdliner CLI into an existing dune project?

Yes, you can integrate cmdliner CLIs into dune-based OCaml projects by applying its design principles to build clear, reliable command-line tools with consistent flags and structured help outputs.

How do I improve the --help output for my OCaml command-line tool?

To improve --help output for OCaml CLIs, use cmdliner to define structured CLI terms and info, which enforces clear, orthogonal options and generates high-quality, helpful help messages automatically.

When should I refactor an existing OCaml CLI to use cmdliner?

You should refactor existing OCaml CLIs to use cmdliner when you need better ergonomics, maintainability, consistent flags, and predictable command hierarchies with explicit defaults across your project.

Does cmdliner enforce explicit defaults for command-line options?

Yes, cmdliner enforces explicit defaults and clear, orthogonal options by design, ensuring predictable command hierarchies and reliable CLI behavior guided by Daniel Bünzli's design principles.