Customers & growth · Developer marketing

CLI tool framework

Best for Early Startup

DISCOVERHELP TEXTERRORSSPEED

Use it when

You ship a command-line tool for developers and need to review its commands, help, output and errors against established conventions before a release.

Skip it when

  • Only the wording of error messages needs work across your API, CLI and SDK. Use Error message framework, which this feeds.
  • You need to rate every stage of the developer journey, from discovery to support. Use Developer experience (DX) framework.
  • You are deciding which business processes to automate and by which route. Use Process automation framework.
  • You are choosing which tools, plugins and integrations to offer developers at all. Use Tooling ecosystem framework.

What to apply first and what to use instead are listed below.

Inputs

  • Command list
    Every command, subcommand, flag and environment variable in the current release, exported from the argument parser or the help output.
  • Usage evidence
    The most run commands and the commands named in support tickets and issues over the last 90 days, from opt-in usage data, the help desk and the issue tracker.
  • Guidelines
    Your house style guide, or a published one such as the Command Line Interface Guidelines or the Heroku CLI style guide, plus the Open Group utility syntax rules for flags.
  • Test setups
    A clean machine for each supported operating system and shell, and a script runner with no terminal attached, for piped and scripted runs.
  • Error catalogOptional
    The error list from Error message framework, if one exists.

Steps

  1. List every command and flag and check the names against one pattern, such as noun topics with verb commands, a long version of every flag, standard names like --help, --version, --json and --quiet, and no secrets passed as flags.
  2. Run each command with no arguments and with --help. Confirm the help leads with a description and examples, lists common flags first and links to web docs and support, and that a mistyped command gets a suggested fix before anything runs.
  3. Run each command in a terminal and through a pipe. Results must go to standard output, messages and progress to standard error, color and spinners must switch off outside a terminal, and --json must return the full data.
  4. Run each command from a script with no terminal. Every prompt must have a flag that skips it, destructive actions must ask for confirmation in proportion to the damage, and Ctrl-C must stop the command.
  5. Time each command and break it on purpose. It should print something within about 100 milliseconds, show progress on long tasks, check input before changing anything and exit with zero only on success.
  6. Log each failure with the command, the rule broken and a fix, rank the failures by how often the command is used, and pass error wording problems to Error message framework.

Output

A CLI review table with one row per failed rule, ranked by command usage, plus the list of fixes for the next release.

  • Command or flag
  • Rule checked and the guideline it comes from
  • Result and how it was tested
  • Context (terminal, pipe or script)
  • Fix proposed
  • Usage rank of the command
  • Owner and target release

Done when

  • Every command and flag in the release has been checked and appears in the table or is marked as passing.
  • Every command has been run with --help, through a pipe and from a script with no terminal.
  • Every prompt has a flag that skips it, confirmed in a run with no terminal.
  • Every command returns zero on one success and a non-zero code on one forced failure.
  • Every failure has a fix, an owner and a target release.

Measure

Track tickets and issues that name a CLI command, and the share of runs that end in a non-zero exit where users opted into usage data, for 90 days before and after the fixes ship. A fix worked when tickets for the changed commands fall against your own baseline while use holds steady. Repeat the review before each major release.

Hypothetical example

Fernway ships a CLI for its hosting service with 34 commands and checked them against the Command Line Interface Guidelines. Piping the deploy command into a log file filled it with spinner frames. The apps delete command removed an app without asking. Twelve commands had no examples in their help, and three took an API token as a flag. The team logged 19 failures and ranked them by usage. They moved the spinner to standard error and hid it outside a terminal. They added a typed app name confirmation, with a --confirm flag for scripts, and moved tokens into a credentials file.

Common mistakes

  • Testing only in an interactive terminal. Run every command through a pipe and from a script with no terminal.
  • Changing output that scripts parse. Point scripts to --json, and warn in the tool before you change or remove a flag or format.
  • Accepting tokens or passwords as flags. Read them from a file or standard input.
  • Adding a prompt with no way around it. Give every prompt a matching flag.
  • Going silent during a network call. Print a status line first and show progress.

Sources

By company stage

  1. Pre-IdeaNot applicableThere is no command-line product yet.
  2. IdeaUsefulEarly CLI users give feedback, but the product is still being proven.
  3. Early StartupCriticalFor developer products, a good CLI experience drives adoption and repeatable growth.
  4. StartupUsefulQuality remains important as developer adoption scales.
  5. GrowthUsefulMaintained by product teams as part of ongoing developer experience.
  6. ScaleUsefulSupports multiple products but is not a core strategic gap.
  7. EnterpriseUsefulEngineering teams still design command-line tools for developer products as routine work.

Apply first

Nothing. You can start here.

Use instead

  • Error message framework

    Only the wording of error messages needs work across your API, CLI and SDK. Use Error message framework, which this feeds.

  • Developer experience (DX) framework

    You need to rate every stage of the developer journey, from discovery to support. Use Developer experience (DX) framework.

  • Process automation framework

    You are deciding which business processes to automate and by which route. Use Process automation framework.

  • Tooling ecosystem framework

    You are choosing which tools, plugins and integrations to offer developers at all. Use Tooling ecosystem framework.

Recommended resources

No sponsored resources on this framework yet. Sponsored listings would be labelled here, never in search.

Progress is not saved until you have an account. Create a free account