rust-cli
Skill1 starsChanged 39 days agoMITView on GitHub
Command-line and terminal apps in Rust — argument parsing with clap, subcommands, config, output/exit-code conventions, and full-screen TUIs with ratatui. Use when building a CLI, parsing args/subcommands, designing output, or writing a terminal UI. Triggers: clap, subcommand, exit code, TUI, ratatui, crossterm, indicatif.
8 other projects use a version of this.
Adopted by
Most recently taken up by
- marcioaltoe/skillstheir own version, first seen Nov 29, 2026
- sajaddp/sonjoo-seo-audittheir own version, first seen Nov 29, 2026
- Galvarcus/claude-skillstheir own version, first seen Nov 8, 2026
- po4yka/rust-skillstheir own version, first seen Nov 2, 2026
- adxptived/Rust-Skillstheir own version, first seen Oct 17, 2026
- full-stack-skills/rust-skillstheir own version, first seen Oct 15, 2026
Used with
Projects with it also use rust-observability and rust-database.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
huialiSkillrust-observability
Also in 3 projects that use this
huialiSkillrust-database
Also in 3 projects that use this
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- full-stack-skills/rust-skills★ 8same name
- Galvarcus/claude-skills★ 8same name
- po4yka/rust-skills★ 7same name
- tumf/skills★ 4same name
- adxptived/Rust-Skills★ 1same name
- Microbiosis/rust-claude-skills★ 1same name
- sajaddp/sonjoo-seo-audit★ 1same name
- marcioaltoe/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository42 other files it gives its agents.
- AGENTS.mdAGENTS.md
- addressing-findingsSkill
- auditSkill
- codebase-onboardingSkill
- codex-reviewSkill
- compatibilitySkill
- debuggingSkill
- developSkill
- distributed-racesSkill
- memorySkill
- nix-dev-envSkill
- nix-flakesSkill
- nixosSkill
- nix-packagingSkill
- nix-reviewSkill
- refactoringSkill
- retroSkill
- review-initSkill
- review-rulesSkill
- rust-architecture-reviewSkill
- rust-architectureSkill
- rust-cloud-nativeSkill
- rust-concurrencySkill
- rust-ecosystemSkill
- rust-embeddedSkill
- rust-errorsSkill
- rust-fintechSkill
- rust-idiomsSkill
- rust-macrosSkill
- rust-mlSkill
- rust-navigationSkill
- rust-ownershipSkill
- rust-performanceSkill
- rust-pluginsSkill
- rust-reviewSkill
- rust-securitySkill
- rust-testingSkill
- rust-traitsSkill
- rust-unsafeSkill
- rust-webSkill
- specsSkill
- sql-reviewSkill
The file
Files
Rust CLI & TUI
Terminal programs come in two shapes with different models — pick the right one first. Both put
real logic in a library and keep the entrypoint thin (→ rust-architecture, rust-ecosystem).
When to Use
- Building a command-line tool (args, subcommands, config, output)
- Designing exit codes and stdout/stderr behavior
- Writing an interactive full-screen terminal UI
Decision: CLI or TUI?
| You're building | Model | Crate | Where |
| A tool: parse args → do work → print → exit | one-shot, non-interactive | clap | clap.md |
| A full-screen interactive app (dashboard, editor) | render loop + events + state | ratatui | tui.md |
Most "CLIs" are the first kind — don't reach for a TUI unless the app is genuinely interactive and stateful. They can coexist (a clap subcommand that launches a TUI).
CLI anatomy
use anyhow::Result;
use clap::Parser;
#[derive(Parser)]
#[command(version, about)]
struct Cli { /* args — see clap.md */ }
fn main() -> std::process::ExitCode {
if let Err(e) = run(Cli::parse()) {
eprintln!("error: {e:#}"); // errors to stderr, with the full chain
return std::process::ExitCode::FAILURE;
}
std::process::ExitCode::SUCCESS
}
fn run(cli: Cli) -> Result<()> { /* the actual work, returns Result */ }main parses and maps the result to an exit code; run holds the logic and returns Result
(→ rust-errors CLI pattern). Keep run thin too — call into a library.
Output conventions
A well-behaved CLI is a good Unix citizen:
- stdout = data, stderr = diagnostics. Machine-readable results go to stdout so they pipe; logs, progress, and errors go to stderr.
- Exit codes:
0success, non-zero failure. Use distinct codes if scripts need to branch. - Respect the pipe: disable color/progress when stdout isn't a TTY (clap's color does this;
std::io::IsTerminal/ theanstreamcrate help). Don't emit ANSI into a file. --quiet/--verboseto control chatter; offer--jsonfor scriptable output where it makes sense.- Progress for long work: the
indicatifcrate (indicatif = "0.18") — to stderr.
Config layering
Precedence, highest first: CLI flags → environment → config file → defaults. clap reads
flags and env (#[arg(env = "...")]); for file + merge, layer with figment (or the config
crate) and let flags win. Validate the merged config once at startup — a bad config should fail
fast, not mid-run (→ rust-errors: startup precondition is a defect).
figment merges typed config from layered providers, last
wins:
[dependencies]
figment = { version = "0.10", features = ["toml", "env"] }
serde = { version = "1", features = ["derive"] }use figment::{Figment, providers::{Format, Toml, Env, Serialized}};
#[derive(Default, serde::Deserialize, serde::Serialize)]
struct Config { port: u16, log_level: String }
let config: Config = Figment::new()
.merge(Serialized::defaults(Config::default())) // defaults
.merge(Toml::file("app.toml")) // file overrides defaults
.merge(Env::prefixed("APP_")) // env overrides file (APP_PORT=...)
.extract()?; // typed + validated in one stepLayer CLI flags on top last (highest precedence) by merging parsed clap values. The same
figment setup serves long-running services too (→ rust-cloud-native config). Load secrets
into a secrecy::SecretString rather than a plain field (→ rust-security).
Boundaries
- Argument parsing, subcommands, derive API → clap.md.
- Interactive full-screen UIs (render loop, widgets, events) → tui.md.
- Error reporting style (
anyhowat the top,eprintln!, exit) →rust-errors. - Logic-in-lib, thin binary →
rust-ecosystem(project layout),rust-architecture.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

