rust-cli-builder
What it does
This skill helps your AI agent build command-line tools in Rust. It is for developers creating a new CLI or extending one with subcommands, config files and clean output.
When to use it
- βWhen you want to create a new Rust command-line tool from scratch.
- βWhen you need to add subcommands to an existing Rust CLI.
- βWhen you want config file loading or colored output in a Rust tool.
Skill link
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/rust-cli-builder/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βBuild a Rust CLI that converts CSV files to JSON, with a config file for default options.β
5 new skills a week. 1 minute to read.
How it works
The agent first explores any existing project, then asks questions about commands, input and output formats, and how the tool will be shared. After that it writes the code with clap, error handling and config support.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Rust CLI Tool Builder
When to use
Use this skill when you need to:
- Scaffold a new Rust CLI tool from scratch with clap
- Add subcommands to an existing CLI application
- Implement config file loading (TOML/JSON/YAML)
- Set up proper error handling with anyhow/thiserror
- Add colored and formatted terminal output
- Structure a CLI project for distribution via cargo install or GitHub releases
Phase 1: Explore (Plan Mode)
Enter plan mode. Before writing any code, explore the existing project:
If extending an existing project
- Find
Cargo.tomland check current dependencies (clap version, serde, tokio, etc.) - Locate the CLI entry point (
src/main.rsorsrc/cli.rs) - Check if clap is using derive macros or builder pattern
- Identify existing subcommand structure
- Look for existing error types, config structs, and output formatting
- Check if there's a
src/lib.rsseparating library logic from CLI
If starting from scratch
- Check the workspace for any existing Rust projects or workspace
Cargo.toml - Look for a
.cargo/config.tomlwith custom settings - Check for
rust-toolchain.tomlto know the target Rust edition
Phase 2: Interview (AskUserQuestion)
Use AskUserQuestion to clarify requirements. Ask in rounds.
Round 1: Tool purpose and commands
Question: "What kind of CLI tool are you building?"
Header: "Tool type"
Options:
- "Single command (like ripgrep, curl)" β One main action with flags and arguments
- "Multi-command (like git, cargo)" β Multiple subcommands under one binary
- "Interactive REPL (like psql)" β Persistent session with a prompt loop
- "Pipeline tool (like jq, sed)" β Reads stdin, transforms, writes stdout
Question: "What will the tool operate on?"
Header: "Input"
Options:
- "Files/directories" β Read, process, or generate files
- "Network/API" β HTTP requests, TCP connections, API calls
- "System resources" β Processes, hardware info, OS config
- "Data streams (stdin/stdout)" β Pipe-friendly text/binary processing
Round 2: Subcommands (if multi-command)
Question: "Describe the subcommands you need (e.g., 'init', 'build', 'deploy')"
Header: "Commands"
Options:
- "2-3 subcommands (I'll describe them)" β Small focused tool
- "4-8 subcommands with groups" β Medium tool, may need command groups
- "I have a rough list, help me design the API" β Collaborative command design
Round 3: Configuration and output
Question: "How should the tool be configured?"
Header: "Config"
Options:
- "CLI flags only (Recommended)" β All config via command-line arguments
- "Config file (TOML)" β Load defaults from ~/.config/toolname/config.toml
- "Config file + CLI overrides" β Config file for defaults, flags override specific values
- "Environment variables + flags" β Env vars for secrets, flags for everything else
Question: "What output format does the tool need?"
Header: "Output"
Options:
- "Human-readable (colored text)" β Pretty terminal output with colors and formatting
- "Machine-readable (JSON)" β Structured output for piping to other tools
- "Both (--format flag)" β Default human, --json or --format=json for machines
- "Minimal (exit codes only)" β Success/failure via exit code, errors to stderr
Round 4: Async and error handling
Question: "Does the tool need async operations?"
Header: "Async"
Options:
- "No β synchronous is fine (Recommended)" β File I/O, computation, simple operations
- "Yes β tokio (network I/O)" β HTTP requests, concurrent connections, async file I/O
- "Yes β tokio multi-threaded" β Heavy parallelism, multiple concurrent tasks
Question: "How should errors be presented to users?"
Header: "Errors"
Options:
- "Simple messages (anyhow) (Recommended)" β Human-readable error chains, good for most CLIs
- "Typed errors (thiserror)" β Custom error enum with specific variants for each failure
- "Both (thiserror for lib, anyhow for bin)" β Library code is typed, CLI wraps with anyhow
Phase 3: Plan (ExitPlanMode)
Write a concrete implementation plan covering:
- Project structure β
Cargo.tomldependencies,src/file layout - CLI definition β clap derive structs for all commands, args, and flags
- Config loading β config file format and merge strategy with CLI args
- Core logic β main functions for each subcommand, separated from CLI layer
- Error types β error enum or anyhow usage, user-facing error messages
- Output formatting β
FAQ
Does it ask questions before coding?
Yes, the skill plans with you first, covering commands, formats and distribution.
Which argument library does it use?
It uses clap for parsing command-line arguments.
How can the tool be shared?
The skill covers distribution through cargo install or GitHub releases.
Details
Original description by the author
Plan and build production-ready Rust CLI tools using clap for argument parsing, with subcommands, config file support, colored output, and proper error handling. Uses interview-driven planning to clarify commands, input/output formats, and distribution strategy before writing any code.
Popularity
- GitHub stars
- 33k
- Ranking position
- #8795
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
owasp-security
33kTeaches your agent OWASP security guidance for web apps, APIs, mobile, containers and AI agents, so it can spot common weaknesses and suggest fixes.
agent-management
33kLets your agent create, list, hibernate, wake, rename and delete AI agents using the AI Maestro command line, managing each agent's lifecycle.
agent-messaging
33kLets your agent send, receive and reply to signed messages between AI agents, using the Agent Messaging Protocol, mostly on your own machine.
docs-search
33kLets your agent search auto-generated code documentation for function signatures, class definitions and comments, so it checks the real API before changing code.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.