CLI Developer
Core Workflow
- Analyze UX — Identify user workflows, command hierarchy, common tasks. Validate by listing all commands and their expected
--help output before writing code.
- Design commands — Plan subcommands, flags, arguments, configuration. Confirm flag naming is consistent and no existing signatures are broken.
- Implement — Build with the appropriate CLI framework for the language (see Reference Guide below). After wiring up commands, run
<cli> --help to verify help text renders correctly and <cli> --version to confirm version output.
- Polish — Add completions, help text, error messages, progress indicators. Verify TTY detection for color output and graceful SIGINT handling.
- Test — Run cross-platform smoke tests; benchmark startup time (target: <50ms).
Reference Guide
Load detailed guidance based on context:
| 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, bubbletea |
| UX Patterns |
references/ux-patterns.md |
Progress bars, colors, help text |
Quick-Start Example
Node.js (commander)
#!/usr/bin/env node
// npm install commander
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) quick-start examples, see references/python-cli.md and references/go-cli.md.
Constraints
MUST DO
- Keep startup time under 50ms
- Provide clear, actionable error messages
- Support
--help and --version flags
- Use consistent flag naming conventions
- Handle SIGINT (Ctrl+C) gracefully
- Validate user input early
- Support both interactive and non-interactive modes
- Test on Windows, macOS, and Linux
MUST NOT DO
- Block on synchronous I/O unnecessarily — use async reads or stream processing instead.
- Print to stdout when output will be piped — write logs/diagnostics to stderr.
- Use colors when output is not a TTY — detect before applying color:
// Node.js
const useColor = process.stdout.isTTY;
# Python
import sys
use_color = sys.stdout.isatty()
// Go
import "golang.org/x/term"
useColor := term.IsTerminal(int(os.Stdout.Fd()))
- Break existing command signatures — treat flag/subcommand renames as breaking changes.
- Require interactive input in CI/CD environments — always provide non-interactive fallbacks via flags or env vars.
- Hardcode paths or platform-specific logic — use
os.homedir() / os.UserHomeDir() / Path.home() instead.
- Ship without shell completions — all three frameworks above have built-in completion generation.
Output Templates
When implementing CLI features, provide:
- Command structure (main entry point, subcommands)
- Configuration handling (files, env vars, flags)
- Core implementation with error handling
- Shell completion scripts if applicable
- Brief explanation of UX decisions
Knowledge Reference
CLI frameworks (commander, yargs, oclif, click, typer, argparse, cobra, viper), terminal UI (chalk, inquirer, rich, bubbletea), testing (snapshot testing, E2E), distribution (npm, pip, homebrew, releases), performance optimization
Documentation
1---2name: cli-developer3description: Use when building CLI tools, implementing argument parsing, or adding interactive prompts. Invoke for parsing flags and subcommands, displaying progress bars and spinners, generating bash/zsh/fish completion scripts, CLI design, shell completions, and cross-platform terminal applications using commander, click, typer, or cobra.4license: MIT5metadata:6 source: https://skillmd.com/skills/jeffallan/cli-developer7 author: https://github.com/Jeffallan8 version: "1.1.0"9 domain: devops10 triggers: CLI, command-line, terminal app, argument parsing, shell completion, interactive prompt, progress bar, commander, click, typer, cobra11 role: specialist12 scope: implementation13 output-format: code14 related-skills: devops-engineer15---1617# CLI Developer1819## Core Workflow20211. **Analyze UX** — Identify user workflows, command hierarchy, common tasks. Validate by listing all commands and their expected `--help` output before writing code.222. **Design commands** — Plan subcommands, flags, arguments, configuration. Confirm flag naming is consistent and no existing signatures are broken.233. **Implement** — Build with the appropriate CLI framework for the language (see Reference Guide below). After wiring up commands, run `<cli> --help` to verify help text renders correctly and `<cli> --version` to confirm version output.244. **Polish** — Add completions, help text, error messages, progress indicators. Verify TTY detection for color output and graceful SIGINT handling.255. **Test** — Run cross-platform smoke tests; benchmark startup time (target: <50ms).2627## Reference Guide2829Load detailed guidance based on context:3031| Topic | Reference | Load When |32|-------|-----------|-----------|33| Design Patterns | `references/design-patterns.md` | Subcommands, flags, config, architecture |34| Node.js CLIs | `references/node-cli.md` | commander, yargs, inquirer, chalk |35| Python CLIs | `references/python-cli.md` | click, typer, argparse, rich |36| Go CLIs | `references/go-cli.md` | cobra, viper, bubbletea |37| UX Patterns | `references/ux-patterns.md` | Progress bars, colors, help text |3839## Quick-Start Example4041### Node.js (commander)4243```js44#!/usr/bin/env node45// npm install commander46const { program } = require('commander');4748program49 .name('mytool')50 .description('Example CLI')51 .version('1.0.0');5253program54 .command('greet <name>')55 .description('Greet a user')56 .option('-l, --loud', 'uppercase the greeting')57 .action((name, opts) => {58 const msg = `Hello, ${name}!`;59 console.log(opts.loud ? msg.toUpperCase() : msg);60 });6162program.parse();63```6465For Python (click/typer) and Go (cobra) quick-start examples, see `references/python-cli.md` and `references/go-cli.md`.6667## Constraints6869### MUST DO70- Keep startup time under 50ms71- Provide clear, actionable error messages72- Support `--help` and `--version` flags73- Use consistent flag naming conventions74- Handle SIGINT (Ctrl+C) gracefully75- Validate user input early76- Support both interactive and non-interactive modes77- Test on Windows, macOS, and Linux7879### MUST NOT DO8081- **Block on synchronous I/O unnecessarily** — use async reads or stream processing instead.82- **Print to stdout when output will be piped** — write logs/diagnostics to stderr.83- **Use colors when output is not a TTY** — detect before applying color:84 ```js85 // Node.js86 const useColor = process.stdout.isTTY;87 ```88 ```python89 # Python90 import sys91 use_color = sys.stdout.isatty()92 ```93 ```go94 // Go95 import "golang.org/x/term"96 useColor := term.IsTerminal(int(os.Stdout.Fd()))97 ```98- **Break existing command signatures** — treat flag/subcommand renames as breaking changes.99- **Require interactive input in CI/CD environments** — always provide non-interactive fallbacks via flags or env vars.100- **Hardcode paths or platform-specific logic** — use `os.homedir()` / `os.UserHomeDir()` / `Path.home()` instead.101- **Ship without shell completions** — all three frameworks above have built-in completion generation.102103## Output Templates104105When implementing CLI features, provide:1061. Command structure (main entry point, subcommands)1072. Configuration handling (files, env vars, flags)1083. Core implementation with error handling1094. Shell completion scripts if applicable1105. Brief explanation of UX decisions111112## Knowledge Reference113114CLI frameworks (commander, yargs, oclif, click, typer, argparse, cobra, viper), terminal UI (chalk, inquirer, rich, bubbletea), testing (snapshot testing, E2E), distribution (npm, pip, homebrew, releases), performance optimization115116[Documentation](https://jeffallan.github.io/claude-skills/skills/devops/cli-developer/)