A concise synthesis of CLI design best practices from industry leaders.
These principles synthesize wisdom from clig.dev, Heroku, Atlassian, and GNU:
Make the right way the obvious way. Users shouldn't need documentation for basic tasks.
From: Atlassian's "align with conventions", clig.dev's discoverability
# Good: Clear and self-documenting
mytool deploy --environment production --skip-tests
# Bad: Cryptic shortcuts
mytool d -e p -SWhen things go wrong, help users understand and recover.
From: Atlassian's "craft human-readable errors" & "suggest next step", clig.dev's empathy
# Good: Actionable error
Error: Config file not found at './config.yml'
Try: Run 'mytool init' to create a config file
# Bad: Cryptic error
Error: ENOENTFollow established conventions. Your clever pattern is a learning burden.
From: GNU standards, Heroku conventions, clig.dev consistency
# Good: Universal conventions
mytool --help
mytool --version
# Bad: Unique patterns
mytool /h
mytool -infoOptimize for humans by default, but provide machine-readable options.
From: Heroku's "CLI is for humans before machines", clig.dev's human-first design
# Human output (default)
$ mytool status
Service: ✓ healthy
Database: ✓ connected
# Machine output (on demand)
$ mytool status --json
{"service":{"status":"healthy"},"database":{"status":"connected"}}- Provide --help on every command with examples
- Lead with common use cases
- Make help contextual to the command
- Describe what went wrong clearly
- Suggest how to fix it
- Provide a link for more details
- Show progress for operations >1 second
- Use spinners, bars, or status updates
- Ensure users know the tool hasn't frozen
- Prefer named flags to positional arguments
- Use standard flag names (--output, --format)
- Provide short versions for common flags (-o, -f)
- Detect if output is to terminal or pipe
- Use color and formatting only in terminals
- Respect NO_COLOR environment variable
- Provide --json for structured output
- Always support --help and --version
- Use consistent exit codes (0=success, 1-255=error)
- Send output to stdout, errors to stderr
- Prompt for missing required information
- Provide sensible defaults in brackets
- Always allow --yes or --no-input for automation
Essential requirements derived from all sources:
- Works without configuration (sensible defaults)
- --help on every command (with examples)
- Human-readable error messages
- Proper exit codes (0=success)
- Machine-readable output option (--json)
- Progress indicators (>1 second operations)
- Standard options (--version, --verbose, --quiet)
- TTY detection (color only in terminals)
- Respect NO_COLOR environment variable
- clig.dev - Comprehensive modern CLI guidelines
- Heroku CLI Style Guide - Human-first philosophy
- Atlassian's 10 Principles - UX patterns
- GNU Standards - Foundational conventions
For detailed source mapping, see Source Attribution Guide.