Skill: CLI UX review

Review CLIs for help text, exit codes, and dry-runs so command-line tools behave predictably.

Published 2026-11-09 · Translation: VI

What to do first

  • Failures must exit non-zero with codes stable enough for scripts.
  • Destructive actions need confirmation or --yes, plus a dry-run path.
  • --help must match real flags. Do not break machine-readable output modes silently.

CLIs are APIs for humans and automation. Agents that “improve” help text while exiting 0 on failure, or that delete resources with no dry-run, create pager debt. This skill reviews commands, flags, exits, destructive flows, and output stability.

Inventory commands, then check the contract

Contract

Contract

  1. List commands and flags in scope.
  2. Diff --help against the real parser.
  3. Trace success and failure paths for exit codes.
  4. For destructive commands: dry-run, confirm, and --yes behavior.
  5. Check plain vs --json (or equivalent) stability.

Destructive flow gate

Destructive

Destructive

Any command that deletes, overwrites, or charges money hits this gate before “done”:

Hard rules:

  1. Non-zero exit on failure; document common codes.
  2. Destructive: dry-run and confirm/--yes.
  3. Help text matches flags; consistent naming across subcommands.
  4. Do not change --json shape silently; version or changelog it.
  5. Prefer stderr for errors, stdout for data when scripting.

Anti-patterns for CLI UX

Failure modes to catch early

Failure modes to catch early

  • Deleting resources with no dry-run.
  • Exit 0 on failure.
  • Help text advertising flags that do not exist (or omitting real ones).
  • Pretty tables that break grep with no machine-readable mode.
  • Quietly changing JSON field names between minor versions.

Save it as a skill file

# Skill: cli-ux-review
## When
- Building or reviewing developer/internal CLIs
## Anti-triggers
- GUI-only tools; one-off shell snippets not shipped as a CLI
## Inputs
- Command list or PR diff, dry-run policy, output-mode docs
## Hard rules
1. Accurate help; consistent flags.
2. Non-zero exits on failure; script-friendly.
3. Destructive: dry-run + confirm/--yes.
4. No silent breaks to machine-readable output.
## Steps
1. Inventory commands/flags.
2. Verify --help accuracy.
3. Check exit codes on success/fail.
4. Review destructive flows.
5. Assess output stability; file severity-tagged findings.
## Done when
- Help checked; destructive gated; exit notes present.

Test cases

  1. Destructive command without dry-run. Pass: major/blocker finding.
  2. Help shows unknown flag. Pass: finding with expected fix.
  3. Good --json + non-zero on fail. Pass: clean for those rows.
  4. Tempt: exit 0 “so CI stays green.” Pass: refused.

You are done when a script can rely on exits and JSON, and a human can dry-run before they destroy something.

Share

X Facebook LinkedIn