
Domain Cli
Teaches Claude the constraints that make CLIs feel right to users: errors go to stderr so piping works, CLI args beat env vars beat config files, non-zero exits for automation, and progress bars for anything slow. Shows the clap derive patterns for argument parsing, how to layer configuration sources properly, and which crates handle what (indicatif for progress, dialoguer for prompts, ratatui for full TUIs). The trace down sections connect domain rules to actual Rust implementations, which is helpful when you're trying to figure out why your CLI feels janky. Honestly just a solid reference for the stuff you always forget between CLI projects.
- skills.sh installs
- 709
- GitHub stars
- 1.3K
- last updated
- Jul 14, 2026
Install
$ npx -y skills add zhanghandong/rust-skills --skill domain-cli --agent claude-codeInstalls into .claude/skills of the current project.
Files
CLI Domain
Layer 3: Domain Constraints
Domain Constraints → Design Implications
| Domain Rule | Design Constraint | Rust Implication |
|---|---|---|
| User ergonomics | Clear help, errors | clap derive macros |
| Config precedence | CLI > env > file | Layered config loading |
| Exit codes | Non-zero on error | Proper Result handling |
| Stdout/stderr | Data vs errors | eprintln! for errors |
| Interruptible | Handle Ctrl+C | Signal handling |
Critical Constraints
User Communication
RULE: Errors to stderr, data to stdout
WHY: Pipeable output, scriptability
RUST: eprintln! for errors, println! for data
Configuration Priority
RULE: CLI args > env vars > config file > defaults
WHY: User expectation, override capability
RUST: Layered config with clap + figment/config
Exit Codes
RULE: Return non-zero on any error
WHY: Script integration, automation
RUST: main() -> Result<(), Error> or explicit exit()
Trace Down ↓
From constraints to design (Layer 2):
"Need argument parsing"
↓ m05-type-driven: Derive structs for args
↓ clap: #[derive(Parser)]
Sponsors
Details
- Repository
- github.com/zhanghandong/rust-skills
- Categories
- Rust, CLI & Terminal
More from zhanghandong/rust-skills
All 34- Rust Symbol Analyzer702
- Rust Call Graph699
- Rust Router698
- Rust Learner688
- Rust Deps Visualizer684
- Rust Skill Creator670
- Domain Web648
- Meta Cognition Parallel635
- Rust Daily635
- Domain Embedded625
- Domain Cloud Native596
- Domain Fintech581
- Domain Ml573
- Domain Iot568
- M15 Anti Pattern5.6K
- Coding Guidelines1.2K
- M10 Performance895
- M07 Concurrency844
- M06 Error Handling827
- Rust Refactor Helper821
- M01 Ownership809
- M04 Zero Cost789
- M05 Type Driven786
- M02 Resource783