Logical
Commands guide users through tasks logically and intuitively to remove doubt.
Arguments and flags
- Try to use flags instead of arguments
- Boolean flags must default to false and be set to true when present
- If the default of a boolean flag is true, use the prefix no- to flip the default
- Abbreviated flags are only used for frequent use cases
- Abbreviated flags must have full length versions
- Always use standard flag names when available
- Defaults must match the most common use case and follow the principle of least astonishment (POLA)
- Avoid creating order-dependent commands
- Ask for confirmation before executing long-lasting operations or unrecoverable actions
- Clearly state consequential actions
- Offer flags to bypass confirmation dialogs, e.g. -f / --force
- Never expose confidential information inside the CLI
- Use a prompt or read from a file to prevent exposing confidential information
Naming
Use names that are:
- memorable
- logical
- short
- simple
- specific
- guessable
- lower case (small letters)
- without spacing
- without punctuation
- without special characters
- written in full (no abbreviations or aconyms unless unique)