ancoleman/ai-design-components/building-clis
Claude Code and agent skill by ancoleman/ai-design-components
- community
Checking that the SKILL.md file is still in the repository.
Build professional command-line interfaces in Python, Go, and Rust using modern frameworks like Typer, Cobra, and clap. Use when creating developer tools, automation scripts, or infrastructure management CLIs with robust argument parsing, interactive features, and multi-platform distribution.
Install
npx vskill@latest install ancoleman/ai-design-components/building-clisSKILL.md
Building CLIs
Build professional command-line interfaces across Python, Go, and Rust using modern frameworks with robust argument parsing, configuration management, and shell integration.
When to Use This Skill
Use this skill when:
- Building developer tooling or automation CLIs
- Creating infrastructure management tools (deployment, monitoring)
- Implementing API client command-line tools
- Adding CLI capabilities to existing projects
- Packaging utilities for distribution (PyPI, Homebrew, binary releases)
Common triggers: "create a CLI tool", "build a command-line interface", "add CLI arguments", "parse command-line options", "generate shell completions"
Framework Selection
Quick Decision Guide
Python Projects:
- Typer (recommended): Modern type-safe CLIs with minimal boilerplate
- Click: Mature, flexible CLIs for complex command hierarchies
Go Projects:
- Cobra (recommended): Industry standard for enterprise tools (Kubernetes, Docker, GitHub CLI)
- urfave/cli: Lightweight alternative for simple CLIs
Rust Projects:
- clap v4 (recommended): Type-safe with derive API or builder API for runtime flexibility
For detailed framework comparison and selection criteria, see references/framework-selection.md.
Core Patterns
Arguments vs. Options vs. Flags
Positional Arguments:
- Primary input, identified by position
- Use for required inputs (max 2-3 arguments)
- Example:
convert input.jpg output.png
Options:
- Named parameters with values
- Use for configuration and optional inputs
- Example:
--output file.txt,--config app.yaml
Flags:
- Boolean options (presence = true)
- Use for switches and toggles
- Example:
--verbose,--dry-run,--force
Decision Matrix:
| Use Case | Type | Example | |
|---|---|---|---|
| Primary required input | Positional Argument | git commit -m "message" | |
| Optional configuration | Option | --config app.yaml | |
| Boolean setting | Flag | --verbose, --force | |
| Multiple values | Variadic Argument | files... |
See references/argument-patterns.md for comprehensive parsing patterns.
Subcommand Organization
Flat Structure (1 Level):
Use for: Small CLIs with 5-10 operations
Grouped Structure (2 Levels):
Use for: Medium CLIs with logical groupings (10-30 commands) Example: kubectl get pods, kubectl create deployment
Nested Structure (3+ Levels):
Use for: Large CLIs with deep hierarchies (30+ commands) Example: gcloud compute instances create
See references/subcommand-design.md for structuring strategies.
Configuration Management
Standard Precedence (Highest to Lowest):
- CLI Arguments/Flags (explicit user input)
- Environment Variables (session overrides)
- Config File - Local (
./config.yaml) - Config File - User (
~/.config/app/config.yaml) - Config File - System (
/etc/app/config.yaml) - Built-in Defaults (hardcoded)
Best Practices:
- Document precedence in
--help - Validate config files before execution
- Provide
--print-configto show effective configuration - Use XDG Base Directory (
~/.config/app/) for config files
See references/configuration-management.md for implementation patterns across languages.
Output Formatting
Format Selection:
| Use Case | Format | When | |
|---|---|---|---|
| Human consumption | Colored text, tables | Default interactive mode | |
| Machine consumption | JSON, YAML | --output json, piping | |
| Logging/debugging | Plain text | --verbose, stderr | |
| Progress tracking | Progress bars, spinners | Long operations |
Best Practices:
- Default to human-readable output
- Provide
--outputflag (json, yaml, table) - Use stderr for logs, stdout for data
- Auto-detect TTY (disable colors if not interactive)
- Use exit codes: 0 = success, 1 = error, 2 = usage error
See references/output-formatting.md for formatting strategies.
Language-Specific Quick Starts
Python with Typer
Installation:
Basic Example:
Key Features:
- Type hints for automatic validation
- Minimal boilerplate with decorators
- Auto-generated help text
- Rich integration for colored output
See examples/python/ for complete working examples including subcommands, config management, and interactive features.
Go with Cobra
Installation:
Basic Example:
Key Features:
- POSIX-compliant flags
- Viper integration for configuration
- Subcommand architecture
- Shell completion generation
See examples/go/ for complete working examples including Viper config and multi-level subcommands.
Rust with clap
Installation (Cargo.toml):
Basic Example (Derive API):
Key Features:
- Compile-time type safety
- Derive API (declarative) or Builder API (programmatic)
- Comprehensive validation
- Performance optimized
See examples/rust/ for complete working examples including subcommands and builder API patterns.
Interactive Features
Progress Indicators
Python (rich):
Go (progressbar):
Rust (indicatif):
Prompts and Confirmations
Python:
Go:
Rust:
Shell Completion
Generating Completions
Python (Typer):
Go (Cobra):
Rust (clap):
See references/shell-completion.md for installation instructions.
Distribution and Packaging
Python (PyPI)
pyproject.toml:
Publish:
Go (Homebrew)
Formula:
Rust (Cargo)
Publish:
Installation:
See references/distribution.md for comprehensive packaging strategies including binary releases.
Best Practices
Universal CLI Conventions
Always Provide:
--helpand-hfor usage information--versionand-Vfor version display- Clear error messages with actionable suggestions
Argument Handling:
- Use
--separator for options vs. positional args - Support both short (
-v) and long (--verbose) forms - Validate and sanitize all user inputs
Error Handling:
- Exit code 0 for success
- Exit code 1 for general errors
- Exit code 2 for usage errors
- Write errors to stderr, data to stdout
Interactivity:
- Detect TTY (interactive vs. piped input)
- Provide
--yes/--forceto skip prompts for automation - Show progress for operations longer than 2 seconds
Configuration Best Practices
File Formats:
- Use YAML, TOML, or JSON consistently
- Separate files per environment (dev, staging, prod)
- Validate configuration in CI/CD with
--check-config
Secret Management:
- Never commit secrets to config files
- Use environment variables or secret managers
- Document required environment variables
Precedence:
- CLI args > env vars > config file > defaults
- Document precedence in help text
- Provide
--print-configto show effective configuration
Integration with Other Skills
testing-strategies:
- CLI testing with mocks and fixtures
- Integration tests for end-to-end workflows
- See examples/python/test_cli.py
building-ci-pipelines:
- Binary builds for multiple platforms
- Automated releases via GitHub Actions
- See references/distribution.md
api-patterns:
- Building API client CLIs
- Authentication and token management
- Formatting API responses
secret-management:
- Secure credential storage
- Environment variable integration
- Vault/secrets manager integration
Reference Files
Decision Frameworks:
- framework-selection.md - Which framework to choose
- argument-patterns.md - Arguments vs. options vs. flags
- subcommand-design.md - Structuring command hierarchies
Implementation Guides:
- configuration-management.md - Config files and precedence
- output-formatting.md - Human vs. machine-readable output
- shell-completion.md - Generating completions
- distribution.md - Packaging and releasing CLIs
Code Examples:
- examples/python/ - Typer examples (basic, subcommands, config, interactive)
- examples/go/ - Cobra examples (basic, subcommands, Viper integration)
- examples/rust/ - clap examples (derive, builder, subcommands)
Quick Reference
Framework Recommendations:
- Python: Typer (modern) or Click (mature)
- Go: Cobra (enterprise) or urfave/cli (simple)
- Rust: clap v4 (derive or builder)
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/building-clis/SKILL.md
Popularity
- Repository stars
- 521
- Repository forks
- 73
- 7-day trend score
- 31
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 30 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ancoleman/ai-design-components/building-clis)