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
Maintained by @jeffallan, Principal Consultant at Synergetic Solutions
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/tuyv/cli-developer7 author: https://github.com/Jeffallan8 company: https://synergetic.solutions9 version: "1.1.0"10 domain: devops11 triggers: CLI, command-line, terminal app, argument parsing, shell completion, interactive prompt, progress bar, commander, click, typer, cobra12 role: specialist13 scope: implementation14 output-format: code15 related-skills: devops-engineer16---1718# CLI Developer1920## Core Workflow21221. **Analyze UX** — Identify user workflows, command hierarchy, common tasks. Validate by listing all commands and their 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. **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.254. **Polish** — Add completions, help text, error messages, progress indicators. Verify TTY detection for color output and graceful SIGINT handling.265. **Test** — Run cross-platform smoke tests; benchmark startup time (target: <50ms).2728## Reference Guide2930Load detailed guidance based on context:3132| Topic | Reference | Load When |33|-------|-----------|-----------|34| Design Patterns | `references/design-patterns.md` | Subcommands, flags, config, architecture |35| Node.js CLIs | `references/node-cli.md` | commander, yargs, inquirer, chalk |36| Python CLIs | `references/python-cli.md` | click, typer, argparse, rich |37| Go CLIs | `references/go-cli.md` | cobra, viper, bubbletea |38| UX Patterns | `references/ux-patterns.md` | Progress bars, colors, help text |3940## Quick-Start Example4142### Node.js (commander)4344```js45#!/usr/bin/env node46// npm install commander47const { program } = require('commander');4849program50 .name('mytool')51 .description('Example CLI')52 .version('1.0.0');5354program55 .command('greet <name>')56 .description('Greet a user')57 .option('-l, --loud', 'uppercase the greeting')58 .action((name, opts) => {59 const msg = `Hello, ${name}!`;60 console.log(opts.loud ? msg.toUpperCase() : msg);61 });6263program.parse();64```6566For Python (click/typer) and Go (cobra) quick-start examples, see `references/python-cli.md` and `references/go-cli.md`.6768## Constraints6970### MUST DO71- Keep startup time under 50ms72- Provide clear, actionable error messages73- Support `--help` and `--version` flags74- Use consistent flag naming conventions75- Handle SIGINT (Ctrl+C) gracefully76- Validate user input early77- Support both interactive and non-interactive modes78- Test on Windows, macOS, and Linux7980### MUST NOT DO8182- **Block on synchronous I/O unnecessarily** — use async reads or stream processing instead.83- **Print to stdout when output will be piped** — write logs/diagnostics to stderr.84- **Use colors when output is not a TTY** — detect before applying color:85 ```js86 // Node.js87 const useColor = process.stdout.isTTY;88 ```89 ```python90 # Python91 import sys92 use_color = sys.stdout.isatty()93 ```94 ```go95 // Go96 import "golang.org/x/term"97 useColor := term.IsTerminal(int(os.Stdout.Fd()))98 ```99- **Break existing command signatures** — treat flag/subcommand renames as breaking changes.100- **Require interactive input in CI/CD environments** — always provide non-interactive fallbacks via flags or env vars.101- **Hardcode paths or platform-specific logic** — use `os.homedir()` / `os.UserHomeDir()` / `Path.home()` instead.102- **Ship without shell completions** — all three frameworks above have built-in completion generation.103104## Output Templates105106When implementing CLI features, provide:1071. Command structure (main entry point, subcommands)1082. Configuration handling (files, env vars, flags)1093. Core implementation with error handling1104. Shell completion scripts if applicable1115. Brief explanation of UX decisions112113## Knowledge Reference114115CLI 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 optimization116117Maintained by [@jeffallan](https://github.com/jeffallan), Principal Consultant at [Synergetic Solutions](https://synergetic.solutions)118119[Documentation](https://jeffallan.github.io/claude-skills/skills/devops/cli-developer/)