Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
zhanghandong avatar

Domain Cli

  • 725 installs
  • 1.3k repo stars
  • Updated May 24, 2026
  • zhanghandong/rust-skills

This is a copy of domain-cli by actionbook - installs and ranking accrue to the original listing.

domain-cli is a Layer 3 Rust domain-constraints skill that enforces consistent CLI patterns—clap argument parsing, config precedence, exit codes, and terminal output—for developers building command-line tools in Rust.

About

domain-cli is a Rust skills pack entry that activates on Cargo.toml globs and applies Layer 3 domain constraints when building command-line tools. The skill maps ergonomic rules—clear help text, layered configuration where CLI flags beat environment variables and config files, meaningful exit codes, and polished terminal output—to concrete Rust crates such as clap derive macros, ratatui or crossterm for TUIs, indicatif progress bars, and shell completion generators. Developers reach for domain-cli when scaffolding or refactoring a Rust CLI so subcommands, config loading, and error messaging stay consistent across a codebase. It is not a code generator; it steers design decisions and implementation patterns so new binaries match established CLI conventions without reinventing argument parsing or config precedence on every project.

  • 9 critical domain rules for CLI ergonomics and scriptability
  • Layered configuration priority (CLI args > env vars > config file > defaults)
  • Standardized error handling with stderr, proper exit codes, and Result types
  • Trace-down mapping from domain constraints to Rust design patterns using clap derive macros
  • Hard-gated rules for stdout/stderr separation and interrupt handling

Domain Cli by the numbers

  • 725 all-time installs (skills.sh)
  • +6 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/zhanghandong/rust-skills --skill domain-cli

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs725
repo stars1.3k
Security audit3 / 3 scanners passed
Last updatedMay 24, 2026
Repositoryzhanghandong/rust-skills

How do you structure Rust CLI tools with clap?

Enforce consistent CLI patterns, argument parsing, configuration layering, and output conventions when creating command-line tools in Rust.

Who is it for?

Rust developers creating or refactoring CLI binaries who want enforced patterns for clap, config precedence, and terminal UX.

Skip if: Non-Rust projects, web services without a CLI surface, or teams that only need one-off shell scripts without Cargo structure.

When should I use this skill?

A developer edits Cargo.toml Rust CLI code and needs clap subcommands, config layering, or TUI and progress-bar conventions applied.

What you get

Consistent clap-based CLI layout, layered config loading, and standardized exit codes and terminal output.

  • consistent CLI argument structure
  • layered configuration pattern

Files

SKILL.mdMarkdownGitHub ↗

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)]

"Need config layering"
    ↓ m09-domain: Config as domain object
    ↓ figment/config: Layer sources

"Need progress display"
    ↓ m12-lifecycle: Progress bar as RAII
    ↓ indicatif: ProgressBar

---

Key Crates

PurposeCrate
Argument parsingclap
Interactive promptsdialoguer
Progress barsindicatif
Colored outputcolored
Terminal UIratatui
Terminal controlcrossterm
Console utilitiesconsole

Design Patterns

PatternPurposeImplementation
Args structType-safe args#[derive(Parser)]
SubcommandsCommand hierarchy#[derive(Subcommand)]
Config layersOverride precedenceCLI > env > file
ProgressUser feedbackProgressBar::new(len)

Code Pattern: CLI Structure

use clap::{Parser, Subcommand};

#[derive(Parser)]
#[command(name = "myapp", about = "My CLI tool")]
struct Cli {
    /// Enable verbose output
    #[arg(short, long)]
    verbose: bool,

    #[command(subcommand)]
    command: Commands,
}

#[derive(Subcommand)]
enum Commands {
    /// Initialize a new project
    Init { name: String },
    /// Run the application
    Run {
        #[arg(short, long)]
        port: Option<u16>,
    },
}

fn main() -> anyhow::Result<()> {
    let cli = Cli::parse();
    match cli.command {
        Commands::Init { name } => init_project(&name)?,
        Commands::Run { port } => run_server(port.unwrap_or(8080))?,
    }
    Ok(())
}

---

Common Mistakes

MistakeDomain ViolationFix
Errors to stdoutBreaks pipingeprintln!
No help textPoor UX#[arg(help = "...")]
Panic on errorBad exit codeResult + proper handling
No progress for long opsUser uncertaintyindicatif

---

Trace to Layer 1

ConstraintLayer 2 PatternLayer 1 Implementation
Type-safe argsDerive macrosclap Parser
Error handlingResult propagationanyhow + exit codes
User feedbackProgress RAIIindicatif ProgressBar
Config precedenceBuilder patternLayered sources

---

Related Skills

WhenSee
Error handlingm06-error-handling
Type-driven argsm05-type-driven
Progress lifecyclem12-lifecycle
Async CLIm07-concurrency

Related skills

How it compares

Use domain-cli for opinionated Rust CLI architecture constraints rather than generic Rust style guides that do not cover clap, config layering, or terminal UX.

FAQ

When does domain-cli activate?

domain-cli activates on Rust projects containing Cargo.toml via glob matching and applies Layer 3 domain constraints when the developer is building or modifying command-line tools with clap, config files, or terminal UI crates.

What config order does domain-cli enforce?

domain-cli enforces configuration precedence where CLI arguments override environment variables, which override file-based config, ensuring predictable behavior for Rust CLI tools at runtime.

Is Domain Cli safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

CLI & Terminalintegrationsbackend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.