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

Rust Cli Clap

  • 5 installs
  • 5 repo stars
  • Updated August 5, 2026
  • bjornmelin/dev-skills

Rust-cli-clap is a Claude Code skill for building Rust command-line tools with clap, stable output contracts, and CLI tests.

About

Rust-cli-clap is a Claude Code skill for building Rust command-line tools with the clap library. It covers clap derive and builder APIs, subcommands, flags, config and env precedence, stdout/stderr contracts, JSON output, exit codes, completions, and manpages. A developer uses it when working on scriptable, terminal-friendly Rust CLIs and their tests and binary distribution.

  • Builds Rust command-line tools with clap derive or builder APIs
  • Designs stdout/stderr contracts, JSON output, exit codes, and completions
  • Covers CLI testing with assert_cmd/trycmd and binary distribution via cargo-dist

Rust Cli Clap by the numbers

  • 5 all-time installs (skills.sh)
  • Ranked #93 of 121 Rust skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

rust-cli-clap capabilities & compatibility

Free; uses the Rust toolchain and cargo.

Capabilities
rust cli · cli testing · binary distribution
Use cases
api development · testing · devops
Pricing
Free
From the docs

What rust-cli-clap says it does

Build Rust command-line tools that are predictable, scriptable, pleasant in terminals, and easy to ship.
SKILL.md
Prefer `clap` derive for ordinary CLIs.
SKILL.md
Design command output as an API: human output on stdout, diagnostics on stderr, deterministic `--json`/machine output where automation is expected, and stable exit codes.
SKILL.md
npx skills add https://github.com/bjornmelin/dev-skills --skill rust-cli-clap

Add your badge

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

Listed on Skillselion
Installs5
repo stars5
Last updatedAugust 5, 2026
Repositorybjornmelin/dev-skills

What it does

Build predictable, scriptable Rust command-line tools with clap, stable output contracts, and CLI tests.

Who is it for?

Rust CLIs with clap derive or builder APIs, subcommands, config precedence, JSON output, exit codes, and completions.

Skip if: Non-CLI Rust work or terminal UIs, which route to other Rust specialist skills.

When should I use this skill?

Building command-line apps and tools, clap definitions, stdin/stdout/stderr contracts, or CLI tests and distribution.

What you get

Rust command-line tools that are predictable, scriptable, pleasant in terminals, and easy to ship.

  • clap argument definitions
  • stdout/stderr and JSON output contracts
  • CLI tests and completions/manpages

By the numbers

  • 3 reference guides (clap-parser, terminal-contracts, testing-packaging)
  • 5-point operating model

Files

SKILL.mdMarkdownGitHub ↗

Rust CLI Clap

Build Rust command-line tools that are predictable, scriptable, pleasant in terminals, and easy to ship.

Operating Model

1. Discover the existing CLI contract first: Cargo.toml, src/bin, clap definitions, integration tests, snapshots, release scripts, and README examples. 2. Preserve user-facing command behavior unless the task explicitly asks for a breaking change. If behavior changes, update tests and docs in the same patch. 3. Prefer clap derive for ordinary CLIs. Use the builder API when commands are generated dynamically, hidden/unstable command surfaces need custom construction, or macros make the shape harder to read. 4. Design command output as an API: human output on stdout, diagnostics on stderr, deterministic --json/machine output where automation is expected, and stable exit codes. 5. Keep command handlers thin. Parse into typed arguments, normalize config once, then call library code that tests can exercise without spawning a process.

Reference Map

Open only the section needed for the task:

  • references/clap-parser-playbook.md for clap derive/builder design, argument groups, validators, completions, and migration notes.
  • references/terminal-contracts.md for stdout/stderr, color, progress, config precedence, error messages, and shell automation rules.
  • references/testing-packaging.md for assert_cmd, trycmd, snapshots, binaries, completions, manpages, cargo-dist, and release checks.

Defaults

  • Use clap = { features = ["derive", "env"] } when environment variables are part of the contract; otherwise avoid unused features.
  • Use camino or Utf8PathBuf only when UTF-8 paths are an explicit invariant. Otherwise keep PathBuf.
  • Use anstream/anstyle or clap styling for color-aware output; respect NO_COLOR, CLICOLOR, and non-TTY behavior.
  • Use tracing for diagnostics when the CLI has subcommands, network calls, daemon/client modes, or hidden debugging flags.
  • Use thiserror for domain errors and miette or color-eyre at the presentation boundary only when rich reports add value.

Verification

For CLI changes, prefer the smallest ladder that proves the contract:

cargo fmt --all --check
cargo test --all-targets
cargo clippy --workspace --all-targets --all-features -- -D warnings

Add focused command tests for new flags, output modes, exit codes, config precedence, and examples shown in docs. Snapshot CLI output only after normalizing volatile paths, timestamps, colors, and ordering.

Related skills

FAQ

Should I use clap derive or the builder API?

Prefer clap derive for ordinary CLIs; use the builder API for dynamically generated commands or hidden/unstable command surfaces.

How does it design CLI output?

Human output on stdout, diagnostics on stderr, deterministic --json for automation, and stable exit codes.

Rustbackendtesting

This week in AI coding

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

unsubscribe anytime.