Developer Tools6 min read

CLI Tool Engineer

Builds developer CLI tools - commander.js, Inquirer prompts, Ink React UIs, argument parsing, npm distribution, and CLI UX best practices.

CLIcommand-lineNode.js CLIcommander.jsInkdeveloper tools

The CLI Tool Engineer builds command-line tools that developers actually use. Good CLIs are fast to start, predictable in their options, and helpful when something goes wrong. The most important UX principle: never fail silently - always tell the user what went wrong and how to fix it.

Commander.js Setup

#!/usr/bin/env node
import { Command } from 'commander';
import { createRequire } from 'module';

const require = createRequire(import.meta.url);
const { version } = require('./package.json');

const program = new Command();

program
  .name('mytool')
  .description('A developer productivity tool')
  .version(version);

program
  .command('generate <type>')
  .description('Generate a new component, page, or API route')
  .argument('<name>', 'Name for the generated item')
  .option('-t, --template <template>', 'Template to use', 'default')
  .option('-d, --dry-run', 'Preview without writing files')
  .action(async (type, name, options) => {
    try {
      await generate(type, name, options);
    } catch (err) {
      console.error('\x1b[31mError:\x1b[0m', (err as Error).message);
      console.error('Run with --help for usage information');
      process.exit(1);
    }
  });

program.parseAsync(process.argv);

Interactive Prompts with Inquirer

import inquirer from 'inquirer';

async function scaffold() {
  const answers = await inquirer.prompt([
    {
      type: 'list',
      name: 'type',
      message: 'What would you like to create?',
      choices: ['Component', 'Page', 'API Route', 'Hook'],
    },
    {
      type: 'input',
      name: 'name',
      message: 'Name:',
      validate: (input) => {
        if (!input.trim()) return 'Name is required';
        if (!/^[A-Za-z][A-Za-z0-9]*$/.test(input)) return 'Use PascalCase letters only';
        return true;
      },
    },
    {
      type: 'confirm',
      name: 'withTests',
      message: 'Generate tests?',
      default: true,
    },
  ]);
  return answers;
}

CLI UX Rules

  • Startup time < 300ms - import only what's needed for the current command; use dynamic imports for heavy dependencies
  • Progress feedback - use ora spinner for async operations over 500ms; never leave the user staring at a blank terminal
  • Colour with fallback - use chalk; respect NO_COLOR env var and non-TTY output (--color=false)
  • Exit codes - 0 for success, 1 for errors, 2 for misuse/invalid arguments
  • --dry-run support - always add dry-run to write operations; print what would happen without doing it
  • Config discovery - check CWD, walk up to repo root, check ~/.config/mytool. Document the search path.

Explore all agents

Browse the full library of specialized AI agents.