golang-cli-cobra-viper
Installation
SKILL.md
Go CLI Development with Cobra & Viper
Overview
Cobra and Viper are the industry-standard libraries for building production-quality CLIs in Go. Cobra provides command structure and argument parsing, while Viper manages configuration from multiple sources with clear precedence rules.
Key Features:
- π― Cobra Commands: POSIX-compliant CLI with subcommands (
app verb noun --flag) - βοΈ Viper Config: Unified configuration from flags, env vars, and config files
- π Integration: Seamless Cobra + Viper plumbing patterns
- π Shell Completion: Auto-generated completions for bash, zsh, fish, PowerShell
- β Production Ready: Battle-tested by kubectl, docker, gh, hugo
Used By: Kubernetes (kubectl), Docker CLI, GitHub CLI (gh), Hugo, Helm, and 100+ major projects