What problem does it solve? Go CLI tools often suffer from inconsistent flag handling, broken configuration layering, polluted stdout streams, and hardcoded versions. This Skill encodes the conventions used by kubectl, docker, and gh so an AI agent builds, extends, or reviews Go CLIs that behave correctly under Unix pipelines and automation. ## Core Features & Use Cases - Command & Flag Structure: Sets up Cobra root commands with SilenceUsage/SilenceErrors, persistent vs local flags, required flags, mutual exclusion, and argument validators. - Configuration Layering: Wires Viper precedence (flags > env vars > config file > defaults) with env prefixes, key replacers, and graceful handling of missing config files. - Production Behaviors: Covers ldflags version injection, Unix exit codes, stdout/stderr discipline, signal.NotifyContext graceful shutdown, shell completions, and programmatic CLI testing. - Use Case: Ask the agent to add a 'serve' subcommand with a --port flag configurable via MYAPP_PORT and ~/.myapp.yaml, and it produces the full Cobra/Viper wiring with tests. ## Quick Start Ask the agent to scaffold a Go CLI with Cobra and Viper including a root command, a serve subcommand, and a version command injected via ldflags.