CLI Developer
When to Use / When Not to Use
Use when:
- Building a new CLI tool with subcommands, flags, config handling
- Adding shell completions, progress bars, or interactive prompts
- Distributing a cross-platform terminal binary
Do not use when:
- Building a web UI or REST API
- The task is SRE pipeline integration only (use
sre-engineer)
Process
- Analyze UX — Identify user workflows, command hierarchy, and common tasks. List all commands with expected
--help output before writing code.
- Design commands — Plan subcommands, flags, arguments, configuration. Confirm flag naming is consistent and no existing signatures are broken.
- Select framework — Node.js:
commander → yargs → oclif; Python: typer → click → argparse; Go: cobra + viper → bubbletea (TUI only)
- Implement — Build with the chosen framework. After wiring commands, run
<cli> --help to verify help text and <cli> --version for version output.
- Polish — Add completions, error messages, progress indicators. Verify TTY detection for color output and graceful SIGINT handling.
- Test — Cross-platform smoke tests; benchmark startup time (target: <50ms).
Output Template
For each CLI feature, provide:
- Command structure (main entry point, subcommands)
- Configuration handling (files, env vars, flags)
- Core implementation with error handling
- Shell completion scripts (if applicable)
- Brief note on UX decisions
What Claude Does / What You Do
| Claude |
You |
| Designs command hierarchy and flag naming |
Confirm the UX matches your user workflows |
| Generates framework boilerplate (commander/typer/cobra) |
Implement domain-specific business logic |
| Writes TTY detection and SIGINT handling |
Test on all target platforms |
| Generates shell completion scripts |
Verify completions in your actual shell |
| Recommends cross-platform path handling |
Run final distribution and packaging |
Reference Guide
| Topic |
Reference |
Load When |
| Design Patterns |
references/design-patterns.md |
Subcommands, flags, config, architecture |
| Node.js CLIs |
references/node-cli.md |
commander, yargs, inquirer, chalk |
| Python CLIs |
references/python-cli.md |
click, typer, argparse, rich |
| Go CLIs |
references/go-cli.md |
cobra, viper, error handling, testing, build/distribution |
| Go TUI |
references/go-tui.md |
bubbletea, progress bars, spinners |
| UX Patterns |
references/ux-patterns.md |
Progress bars, colors, help text |
Quick-Start Example (Node.js / commander)
#!/usr/bin/env node
const { program } = require('commander');
program
.name('mytool')
.description('Example CLI')
.version('1.0.0');
program
.command('greet <name>')
.description('Greet a user')
.option('-l, --loud', 'uppercase the greeting')
.action((name, opts) => {
const msg = `Hello, ${name}!`;
console.log(opts.loud ? msg.toUpperCase() : msg);
});
program.parse();
For Python (click/typer) and Go (cobra) examples, see references/python-cli.md and references/go-cli.md.
Constraints
MUST DO:
- Keep startup time under 50ms
- Support
--help and --version flags
- Use consistent flag naming conventions
- Handle SIGINT (Ctrl+C) gracefully
- Validate user input early
- Detect TTY before applying color output
- Support both interactive and non-interactive modes
MUST NOT DO:
- Print logs/diagnostics to stdout when output will be piped (use stderr)
- Break existing command signatures — treat renames as breaking changes
- Require interactive input in CI/CD without non-interactive flag fallbacks
- Hardcode platform-specific paths (use
os.homedir() / Path.home())
- Ship without shell completions
Related Skills
sre-engineer — for integrating CLI tools into SRE pipelines
code-documenter — for documenting CLI commands and flags
1---2name: cli-developer3description: Use when someone needs to build a command-line tool — defining subcommands, flags, and argument parsing; adding interactive prompts, progress bars, or shell completions; or distributing a cross-platform terminal application. Triggers on:.4license: MIT5---67# CLI Developer89## When to Use / When Not to Use1011**Use when:**12- Building a new CLI tool with subcommands, flags, config handling13- Adding shell completions, progress bars, or interactive prompts14- Distributing a cross-platform terminal binary1516**Do not use when:**17- Building a web UI or REST API18- The task is SRE pipeline integration only (use `sre-engineer`)1920## Process21221. **Analyze UX** — Identify user workflows, command hierarchy, and common tasks. List all commands with expected `--help` output before writing code.232. **Design commands** — Plan subcommands, flags, arguments, configuration. Confirm flag naming is consistent and no existing signatures are broken.243. **Select framework** — Node.js: `commander` → `yargs` → `oclif`; Python: `typer` → `click` → `argparse`; Go: `cobra + viper` → `bubbletea` (TUI only)254. **Implement** — Build with the chosen framework. After wiring commands, run `<cli> --help` to verify help text and `<cli> --version` for version output.265. **Polish** — Add completions, error messages, progress indicators. Verify TTY detection for color output and graceful SIGINT handling.276. **Test** — Cross-platform smoke tests; benchmark startup time (target: <50ms).2829## Output Template3031For each CLI feature, provide:321. Command structure (main entry point, subcommands)332. Configuration handling (files, env vars, flags)343. Core implementation with error handling354. Shell completion scripts (if applicable)365. Brief note on UX decisions3738## What Claude Does / What You Do3940| Claude | You |41|--------|-----|42| Designs command hierarchy and flag naming | Confirm the UX matches your user workflows |43| Generates framework boilerplate (commander/typer/cobra) | Implement domain-specific business logic |44| Writes TTY detection and SIGINT handling | Test on all target platforms |45| Generates shell completion scripts | Verify completions in your actual shell |46| Recommends cross-platform path handling | Run final distribution and packaging |4748## Reference Guide4950| Topic | Reference | Load When |51|-------|-----------|-----------|52| Design Patterns | `references/design-patterns.md` | Subcommands, flags, config, architecture |53| Node.js CLIs | `references/node-cli.md` | commander, yargs, inquirer, chalk |54| Python CLIs | `references/python-cli.md` | click, typer, argparse, rich |55| Go CLIs | `references/go-cli.md` | cobra, viper, error handling, testing, build/distribution |56| Go TUI | `references/go-tui.md` | bubbletea, progress bars, spinners |57| UX Patterns | `references/ux-patterns.md` | Progress bars, colors, help text |5859## Quick-Start Example (Node.js / commander)6061```js62#!/usr/bin/env node63const { program } = require('commander');6465program66 .name('mytool')67 .description('Example CLI')68 .version('1.0.0');6970program71 .command('greet <name>')72 .description('Greet a user')73 .option('-l, --loud', 'uppercase the greeting')74 .action((name, opts) => {75 const msg = `Hello, ${name}!`;76 console.log(opts.loud ? msg.toUpperCase() : msg);77 });7879program.parse();80```8182For Python (click/typer) and Go (cobra) examples, see `references/python-cli.md` and `references/go-cli.md`.8384## Constraints8586**MUST DO:**87- Keep startup time under 50ms88- Support `--help` and `--version` flags89- Use consistent flag naming conventions90- Handle SIGINT (Ctrl+C) gracefully91- Validate user input early92- Detect TTY before applying color output93- Support both interactive and non-interactive modes9495**MUST NOT DO:**96- Print logs/diagnostics to stdout when output will be piped (use stderr)97- Break existing command signatures — treat renames as breaking changes98- Require interactive input in CI/CD without non-interactive flag fallbacks99- Hardcode platform-specific paths (use `os.homedir()` / `Path.home()`)100- Ship without shell completions101102## Related Skills103104- `sre-engineer` — for integrating CLI tools into SRE pipelines105- `code-documenter` — for documenting CLI commands and flags