Backend Developer

Build a CLI Tool in Rust β€” Fast, Safe, and Cross-Platform

2-4MB binary with 1ms cold startDevOps & Cloud2 min read

Key Takeaway

The Rust skill helps you build high-performance CLI tools, systems software, and WebAssembly modules. Your agent generates idiomatic Rust with proper error handling, clap argument parsing, and cross-compilation setup.

The Problem

You need a CLI tool that:

  • Runs fast (not "wait 2 seconds for Python to start")
  • Works on Linux, macOS, and Windows (single binary, no runtime)
  • Handles errors properly (not "panic at every edge case")
  • Has good CLI UX (colored output, progress bars, subcommands)

Python/Node.js CLIs: easy to write, slow to start, require runtime installation. Go CLIs: fast, easy cross-compilation, but garbage collector pauses and larger binaries. Rust CLIs: fastest, smallest binary, zero runtime, but steep learning curve.

The Solution

The Rust skill generates production-quality Rust code with proper error handling (thiserror + anyhow), argument parsing (clap), and project structure.

The Process

View details
You: Create a Rust CLI tool that:
- Scans a directory for large files
- Filters by size threshold and file extension
- Outputs results as table or JSON
- Shows progress bar for large directory scans
- Cross-compiles to Linux, macOS, Windows

The agent generates a complete Cargo project:

rustShow code
use clap::Parser;
use indicatif::{ProgressBar, ProgressStyle};
use tabled::{Table, Tabled};
use walkdir::WalkDir;

#[derive(Parser)]
#[command(name = "filescan", about = "Find large files fast")]
struct Cli {
    /// Directory to scan
    #[arg(default_value = ".")]
    path: String,

    /// Minimum file size (e.g., 100MB, 1GB)
    #[arg(short, long, default_value = "100MB")]
    min_size: String,

    /// Filter by extension (e.g., .log, .mp4)
    #[arg(short, long)]
    ext: Option<String>,

    /// Output format
    #[arg(short, long, default_value = "table")]
    format: OutputFormat,
}

// ... complete implementation with error handling,
// progress bar, and formatted output

Plus Cargo.toml with dependencies, .github/workflows/release.yml for automated cross-compilation, and README.md with installation instructions.

Binary size comparison:

LanguageBinary SizeCold StartRuntime Required
PythonN/A (script)800msPython 3.x
Node.jsN/A (script)400msNode.js 20+
Go8-12 MB5msNone
Rust2-4 MB1msNone

Setup on MrChief

yamlShow code
skills:
  - rust
rustclicross-platformsystems-programmingperformance

Want results like these?

Start free with your own AI team. No credit card required.

Build a CLI Tool in Rust β€” Fast, Safe, and Cross-Platform β€” Mr.Chief