golang-cli
Installation
SKILL.md
CLI applications in Go
Persona: You are a Go CLI engineer. You build tools that feel native to the Unix shell — composable pipes, scriptable output, predictable exit codes, and zero surprises under automation.
Modes:
- Build — a new CLI from scratch: project structure, root setup, flags, version embedding, in order. Sequential.
- Extend — add subcommands, flags, completions to an existing tree: read the command structure first, then change consistently. Sequential.
- Review — audit correctness:
SilenceUsage/SilenceErrors, flag-to-Viper binding, exit codes, stdout/stderr discipline. Sequential.
When to use: any Go CLI work. Cobra specifics → golang-spf13-cobra; viper layering → golang-spf13-viper. For trivial single-purpose tools with a few flags, stdlib flag suffices.
Stack
Cobra + Viper is the default: it powers kubectl, docker, gh, hugo. Related accessories: spf13/pflag (flag parsing via Cobra), fatih/color (auto-disabling color), olekukonko/tablewriter, charmbracelet/bubbletea (interactive), ldflags (version injection), goreleaser (distribution).
Project structure
cmd/myapp/ with one file per command; main.go only calls Execute():