New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Domain guide for building Rust CLI tools, covering argument parsing, config layering, and terminal output conventions.

skills.sh installs
3.5K
GitHub stars
1.6K
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers CLI design constraints: stderr for errors, stdout for data, layered config, non-zero exit codes, and Ctrl+C handling
  • Includes a clap derive example with subcommands plus a crate map for prompts, progress bars, colored output, TUI, and terminal control
  • Enforces the precedence order CLI args, then environment variables, then config file, then defaults
  • Designed for Rust developers building command-line tools who need guidance on argument parsing and terminal UX

Install

$ npx -y skills add actionbook/rust-skills --skill domain-cli -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

CLI Domain

Layer 3: Domain Constraints

Domain Constraints → Design Implications

Domain RuleDesign ConstraintRust Implication
User ergonomicsClear help, errorsclap derive macros
Config precedenceCLI > env > fileLayered config loading
Exit codesNon-zero on errorProper Result handling
Stdout/stderrData vs errorseprintln! for errors
InterruptibleHandle Ctrl+CSignal 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)]

Details

Repository
github.com/actionbook/rust-skills
Categories
Rust, CLI & Terminal
First seen
May 16, 2026

More from actionbook/rust-skills

All 38

Similar to Domain Cli

More Rust