CLI Creator
Create excellent command-line interfaces following clig.dev best practices.
Workflow
Determine the task type and follow the appropriate path:
Creating a new CLI? → Follow "New CLI" below
Improving an existing CLI? → Follow "Improve Existing CLI" below
New CLI
- Select language and framework (see table below)
- Copy the corresponding starter template from
assets/templates/ into the user's project directory, rename to match the CLI name
- Customize the template for the use case
- Read the language-specific reference for advanced patterns (subcommands, progress bars, prompts)
- Validate against references/guidelines.md
- For Bash scripts, run
shellcheck to validate correctness
Improve Existing CLI
- Read references/guidelines.md for clig.dev principles
- Audit against the compliance checklist — covers: help/usage, errors→stderr, stdin/stdout, signals/cleanup,
--json/--plain, NO_COLOR, exit codes, secrets
- Read the language-specific reference for implementation patterns
- Apply fixes for identified gaps
- For Bash scripts, run
shellcheck to validate correctness
Language and Framework Selection
| Language |
Framework |
Best For |
Reference |
| Python |
Click |
General purpose, decorator-based |
references/python.md |
| Python |
Typer |
Type-hint based, modern |
references/python.md |
| Python |
argparse |
No dependencies, simple CLIs |
references/python.md |
| Node.js |
Commander |
Most popular, clean API |
references/nodejs.md |
| Node.js |
yargs |
Feature-rich, complex CLIs |
references/nodejs.md |
| Go |
Cobra |
Industry standard (kubectl, hugo, gh) |
references/go.md |
| Rust |
Clap |
Derive or builder API |
references/rust.md |
| Bash |
getopts |
Simple scripts, no dependencies |
references/bash.md |
Starter Templates
Copy the appropriate template into the user's project, rename, and customize the processing logic:
assets/templates/python-click-template.py — Python + Click (PEP 723, run with uvx)
assets/templates/nodejs-commander-template.js — Node.js + Commander
assets/templates/go-cobra-template.go — Go + Cobra
assets/templates/rust-clap-template.rs — Rust + Clap
assets/templates/bash-template.sh — Bash + getopts
All templates include: argument parsing, stdin/stdout support, error handling with exit codes, Ctrl+C handling, --verbose and --json flags, and NO_COLOR respect.
Subcommand CLIs
For multi-command tools (mycli init, mycli build, mycli deploy), read the subcommand section in the language-specific reference:
- Python: Click
@click.group() or Typer app with multiple @app.command()
- Node.js: Commander
.command() or yargs .command()
- Go: Cobra
AddCommand() tree
- Rust: Clap
#[derive(Subcommand)] enum
- Bash:
case dispatch on $1 with per-command functions
Reference Documentation
Read these as needed for detailed patterns and examples:
- references/guidelines.md — Complete clig.dev principles: philosophy, help text structure, output formatting, error handling, arguments/flags, interactivity, configuration, environment variables, naming, signals, distribution, analytics
- references/python.md — Click, Typer, argparse: subcommands, progress bars, colors, stdin, JSON output, env vars, testing
- references/nodejs.md — Commander, yargs: subcommands, chalk/ora, stdin, prompts, package.json setup, testing
- references/go.md — Cobra, urfave/cli, flag: subcommands, colors, progress, signal handling, cross-compilation
- references/rust.md — Clap (derive + builder): subcommands, colored, indicatif, anyhow errors, testing with assert_cmd
- references/bash.md — getopts: subcommands, colors, stdin, JSON with jq, signals, testing with bats-core, shellcheck
1---2name: cli-creator3description: Create command-line interface (CLI) tools following clig.dev best practices. Covers argument parsing, help text, error handling, output formatting, signals, and configuration. Supports Python (Click, Typer), Node.js (Commander), Go (Cobra), Rust (Clap), and Bash. Includes starter templates. DO NOT use for web applications, web servers, GUI apps, or long-running services.4---56# CLI Creator78Create excellent command-line interfaces following clig.dev best practices.910## Workflow1112Determine the task type and follow the appropriate path:1314**Creating a new CLI?** → Follow "New CLI" below15**Improving an existing CLI?** → Follow "Improve Existing CLI" below1617### New CLI18191. Select language and framework (see table below)202. Copy the corresponding starter template from `assets/templates/` into the user's project directory, rename to match the CLI name213. Customize the template for the use case224. Read the language-specific reference for advanced patterns (subcommands, progress bars, prompts)235. Validate against [references/guidelines.md](references/guidelines.md)246. For Bash scripts, run `shellcheck` to validate correctness2526### Improve Existing CLI27281. Read [references/guidelines.md](references/guidelines.md) for clig.dev principles292. Audit against the [compliance checklist](references/guidelines.md#compliance-checklist) — covers: help/usage, errors→stderr, stdin/stdout, signals/cleanup, `--json`/`--plain`, `NO_COLOR`, exit codes, secrets303. Read the language-specific reference for implementation patterns314. Apply fixes for identified gaps325. For Bash scripts, run `shellcheck` to validate correctness3334## Language and Framework Selection3536| Language | Framework | Best For | Reference |37|----------|-----------|----------|-----------|38| Python | **Click** | General purpose, decorator-based | [references/python.md](references/python.md) |39| Python | **Typer** | Type-hint based, modern | [references/python.md](references/python.md) |40| Python | **argparse** | No dependencies, simple CLIs | [references/python.md](references/python.md) |41| Node.js | **Commander** | Most popular, clean API | [references/nodejs.md](references/nodejs.md) |42| Node.js | **yargs** | Feature-rich, complex CLIs | [references/nodejs.md](references/nodejs.md) |43| Go | **Cobra** | Industry standard (kubectl, hugo, gh) | [references/go.md](references/go.md) |44| Rust | **Clap** | Derive or builder API | [references/rust.md](references/rust.md) |45| Bash | **getopts** | Simple scripts, no dependencies | [references/bash.md](references/bash.md) |4647## Starter Templates4849Copy the appropriate template into the user's project, rename, and customize the processing logic:5051- `assets/templates/python-click-template.py` — Python + Click (PEP 723, run with `uvx`)52- `assets/templates/nodejs-commander-template.js` — Node.js + Commander53- `assets/templates/go-cobra-template.go` — Go + Cobra54- `assets/templates/rust-clap-template.rs` — Rust + Clap55- `assets/templates/bash-template.sh` — Bash + getopts5657All templates include: argument parsing, stdin/stdout support, error handling with exit codes, Ctrl+C handling, `--verbose` and `--json` flags, and `NO_COLOR` respect.5859## Subcommand CLIs6061For multi-command tools (`mycli init`, `mycli build`, `mycli deploy`), read the subcommand section in the language-specific reference:6263- Python: Click `@click.group()` or Typer app with multiple `@app.command()`64- Node.js: Commander `.command()` or yargs `.command()`65- Go: Cobra `AddCommand()` tree66- Rust: Clap `#[derive(Subcommand)]` enum67- Bash: `case` dispatch on `$1` with per-command functions6869## Reference Documentation7071Read these as needed for detailed patterns and examples:7273- **[references/guidelines.md](references/guidelines.md)** — Complete clig.dev principles: philosophy, help text structure, output formatting, error handling, arguments/flags, interactivity, configuration, environment variables, naming, signals, distribution, analytics74- **[references/python.md](references/python.md)** — Click, Typer, argparse: subcommands, progress bars, colors, stdin, JSON output, env vars, testing75- **[references/nodejs.md](references/nodejs.md)** — Commander, yargs: subcommands, chalk/ora, stdin, prompts, package.json setup, testing76- **[references/go.md](references/go.md)** — Cobra, urfave/cli, flag: subcommands, colors, progress, signal handling, cross-compilation77- **[references/rust.md](references/rust.md)** — Clap (derive + builder): subcommands, colored, indicatif, anyhow errors, testing with assert_cmd78- **[references/bash.md](references/bash.md)** — getopts: subcommands, colors, stdin, JSON with jq, signals, testing with bats-core, shellcheck