babashka.cli

Convert command-line arguments into structured Clojure data with type coercion.

3|Updated Nov 10, 2025
One-click install
npx skills add https://github.com/hugoduncan/library-skills --skill babashka-cli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: babashka.cli
Source: https://github.com/hugoduncan/library-skills/tree/main/plugins/clojure-libraries/skills/babashka-cli
Command: npx skills add https://github.com/hugoduncan/library-skills --skill babashka-cli

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires org.babashka/cli, and includes scripts (resource) components.

What problem does it solve?

This Skill streamlines the creation of robust command-line interfaces for Clojure scripts, eliminating repetitive manual argument parsing, type conversion, and error handling.

Core Features & Use Cases

  • Automatic Argument Parsing: Convert command-line arguments into structured Clojure data maps with automatic type coercion.
  • Subcommand Dispatch: Easily define and route to different functions based on subcommands, creating organized and intuitive CLI tools.
  • Built-in Validation & Help: Enforce required options, validate values, and automatically generate user-friendly help text for your users.
  • Use Case: Transform a collection of utility functions into a single, professional CLI tool where users can run my-tool build --target :jar or my-tool deploy production --force, complete with type-checked options and clear help messages.

Quick Start

Use the babashka.cli skill to parse the command-line arguments "--port 8080 --verbose true", coercing 'port' to a long and 'verbose' to a boolean.

Frequently Asked Questions about babashka.cli

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

FAQPage Schema
How do I parse command-line arguments in Clojure scripts?

Parse command-line arguments by converting them into structured Clojure data maps with automatic type coercion. babashka.cli handles options, flags, positional arguments, and subcommands, letting you define parsing rules once and reuse them across your CLI tool.

Can I validate required options and generate help text automatically?

Yes. babashka.cli enforces required options, validates values against rules, and automatically generates user-friendly help text. This eliminates manual error handling and ensures consistent CLI behavior across your Babashka scripts.

How do I structure a CLI tool with subcommands in Clojure?

Define subcommands and route to different functions based on user input. babashka.cli's subcommand dispatch organizes CLI tools intuitively, letting users run commands like `my-tool build --target :jar` with type-checked options.

Does babashka.cli support type coercion for arguments?

Yes. babashka.cli applies coercion rules to convert string arguments into Clojure types—ports to longs, flags to booleans, and more. Paired with validation, this ensures type-safe CLI argument handling without manual conversion.

Can I use aliases and default values for CLI options?

Yes. babashka.cli supports option aliases, default values, and restricted option sets. This simplifies option definition and lets users invoke CLI tools with shorthand flags or rely on sensible defaults when options are omitted.

What's the best way to handle collection arguments in CLIs?

babashka.cli handles collection arguments directly, allowing you to pass multiple values, parse them into Clojure collections, and process them together. This supports complex use cases like multi-file operations or repeated flag handling.