CLI user experience best practices for error messages, colors, progress indicators, and output formatting. Use when improving CLI usability and user experience.
View on GitHubgeoffjay/claude-plugins
rust-cli-developer
January 20, 2026
Select agents to install to:
npx add-skill https://github.com/geoffjay/claude-plugins/blob/main/plugins/rust-cli-developer/skills/cli-ux-patterns/SKILL.md -a claude-code --skill cli-ux-patternsInstallation paths:
.claude/skills/cli-ux-patterns/# CLI UX Patterns Skill
Best practices and patterns for creating delightful command-line user experiences.
## Error Message Patterns
### The Three Parts of Good Error Messages
1. **What went wrong** - Clear description of the error
2. **Why it matters** - Context about the operation
3. **How to fix it** - Actionable suggestions
```rust
bail!(
"Failed to read config file: {}\n\n\
The application needs a valid configuration to start.\n\n\
To fix this:\n\
1. Create a config file: myapp init\n\
2. Or specify a different path: --config /path/to/config.toml\n\
3. Check file permissions: ls -l {}",
path.display(),
path.display()
);
```
### Using miette for Rich Diagnostics
```rust
#[derive(Error, Debug, Diagnostic)]
#[error("Configuration error")]
#[diagnostic(
code(config::invalid),
url("https://docs.example.com/config"),
help("Check the syntax of your configuration file")
)]
struct ConfigError {
#[source_code]
src: String,
#[label("invalid value here")]
span: SourceSpan,
}
```
## Color Usage Patterns
### Semantic Colors
- **Red** - Errors, failures, destructive actions
- **Yellow** - Warnings, cautions
- **Green** - Success, completion, safe operations
- **Blue** - Information, hints, links
- **Cyan** - Highlights, emphasis
- **Dim/Gray** - Less important info, metadata
```rust
use owo_colors::OwoColorize;
// Status indicators with colors
println!("{} Build succeeded", "✓".green().bold());
println!("{} Warning: using default", "⚠".yellow().bold());
println!("{} Error: file not found", "✗".red().bold());
println!("{} Info: processing 10 files", "ℹ".blue().bold());
```
### Respecting NO_COLOR
```rust
use owo_colors::{OwoColorize, Stream};
fn print_status(message: &str, is_error: bool) {
let stream = if is_error { Stream::Stderr } else { Stream::Stdout };
if is_error {
eprintln!("{}", message.if_supports_color(stream, |text| text.red()));
} else {
println!("{}", mes