Essential requirements for building a good CLI, based on industry best practices.
Every CLI must have:
- --help on every command with examples (Atlassian #2, GNU)
- Human-readable error messages with solutions (Atlassian #5)
- Exit codes: 0=success, 1-255=errors (GNU)
- Standard options: --version, --verbose, --quiet (GNU)
- TTY detection: Rich output for humans, plain for pipes (Heroku, clig.dev)
- Progress indicators for operations >1 second (Atlassian #3)
- NO_COLOR environment variable support (Heroku)
- --json flag for machine-readable output (Heroku, clig.dev)
- Errors to stderr, output to stdout (GNU)
- Suggest next steps after operations (Atlassian #7)
- Flags over arguments (Atlassian #10, Heroku)
- Verb commands, plural noun topics (Heroku)
- Confirmation prompts for destructive operations (clig.dev)
- --yes/--no-input flags for automation (Atlassian #8)
- Sensible defaults that work without configuration (clig.dev)
Error: Cannot connect to database
Connection refused at localhost:5432
Try:
1. Check if PostgreSQL is running
2. Run 'mytool config check'$ mytool process large-file.csv
Processing... [████████░░] 80% (1234/1543 records)Usage: mytool deploy [OPTIONS]
Deploy application to specified environment
Options:
-e, --env TEXT Target environment (dev/staging/prod)
-f, --force Skip confirmation
-h, --help Show this message
Examples:
mytool deploy --env staging
mytool deploy -e prod --forceThis checklist synthesizes:
- clig.dev - Modern CLI guidelines
- Heroku CLI Style Guide
- Atlassian's 10 Principles
- GNU Standards