building-clis

Build command-line interfaces in Python, Go, and Rust using Typer, Cobra, and clap.

1|Updated Feb 24, 2026
One-click install
npx skills add https://github.com/masermediagroup-stack/maser-media --skill building-clis-masermediagroup-stack
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: building-clis
Source: https://github.com/masermediagroup-stack/maser-media/tree/main/.cursor/skills/community/ai-design-components/skills/building-clis
Command: npx skills add https://github.com/masermediagroup-stack/maser-media --skill building-clis-masermediagroup-stack

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building a professional CLI requires many decisions—framework selection, argument design, configuration precedence, output formatting, shell completion, and distribution packaging—that are easy to get wrong without established conventions. ## Core Features & Use Cases - Framework Selection Guidance: Decision trees for choosing Typer or Click (Python), Cobra or urfave/cli (Go), and clap v4 (Rust) based on project complexity and requirements. - CLI Design Patterns: Reference guides covering arguments vs. options vs. flags, subcommand hierarchies, configuration precedence (CLI args > env vars > config files > defaults), and human vs. machine-readable output. - Distribution & Packaging: Instructions for publishing via PyPI, Cargo, Homebrew, and cross-platform binary releases with GitHub Actions and GoReleaser. - Use Case: When asked to create a deployment tool in Go, the Skill scaffolds a Cobra-based CLI with subcommands, Viper configuration, shell completions, and a release workflow. ## Quick Start Create a Python CLI tool with Typer that has subcommands, colored output, and a config file with environment variable overrides.

Frequently Asked Questions about building-clis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a CLI tool in Python?▼

Use Typer for new Python CLIs: define commands with decorators and type hints, which provide automatic validation and help text. Install with pip install "typer[all]" to include rich for colored output, then distribute via PyPI with a console_scripts entry point in pyproject.toml.

Should I use Cobra or urfave/cli for a Go CLI?▼

Use Cobra for enterprise tools with complex subcommand hierarchies and Viper configuration integration—it powers Kubernetes, Docker, and the GitHub CLI. Choose urfave/cli for simple utilities with 5-10 commands where minimal boilerplate matters.

What is the correct configuration precedence for CLI tools?▼

Standard precedence from highest to lowest: CLI arguments, environment variables, local config file, user config file (~/.config/app/), system config file (/etc/), then built-in defaults. Document this order in help text and provide a command to show the effective merged configuration.

How do I generate shell completions for my CLI?▼

Typer generates completions via environment variables like _MYAPP_COMPLETE=bash_source. Cobra provides GenBashCompletion and GenZshCompletion methods exposed through a completion subcommand. Rust's clap uses the clap_complete crate to generate scripts for bash, zsh, fish, and PowerShell.

When should I use positional arguments versus options in a CLI?▼

Use positional arguments for primary required inputs, limited to 2-3 maximum. Use named options for configuration values and optional inputs, and boolean flags for toggles like --verbose or --dry-run. More than three positional arguments becomes confusing and should be converted to named options.

How do I distribute a Rust CLI to users?▼

Publish to crates.io with cargo publish so users can run cargo install, or build cross-platform binaries with GitHub Actions and attach them to releases. You can also create a Homebrew formula that builds from source using cargo install.