BigHugger
sk Skill · samber

golang-spf13-cobra

Golang CLI command tree library using spf13/cobra — cobra.Command, RunE vs Run, PersistentPreRunE hook chain, Args validators (NoArgs, ExactArgs, MatchAll, custom), persistent vs local flags, command groups, ValidArgsFunction, RegisterFlagCompletionFunc, ShellCompDirective, usage/help template customization, man-page and markdown doc generation, and testing with SetArgs/SetOut/SetErr. Apply when using or adopting…

installs 8w
3,717
30-day movement
starts with the next reading
Related entries
1
Connections
0
gobashGo

An agent skill that teaches correct use of spf13/cobra for Go CLI command trees: command structure, RunE vs Run, hook chains, Args validators, persistent vs local flags, shell completions, doc generation, and programmatic testing. It bundles rules, pitfalls, and reference files on commands, flags, completions, generators, and testing.

Reach for it when writing, reviewing, or adopting cobra-based CLIs so commands follow cobra's idioms instead of bypassing them.

Use it to

  • Structure root and subcommand trees with AddCommand
  • Choose RunE and wire PersistentPreRunE hooks
  • Validate positional args with NoArgs, ExactArgs, or MatchAll
  • Extend shell completions with ValidArgsFunction and RegisterFlagCompletionFunc
  • Test commands with SetArgs, SetOut, and SetErr

For Go developers building or maintaining spf13/cobra CLIs

Host repository
samber/cc-skills-golang
Version
1.1.2
Installs, lifetime
35k
Installs, 8 weeks
3,717
Compatible with
Designed for Claude Code, Codex or similar harness, and for projects using Golang.
Licence
MIT
Invocable by
user
Host stars
3,273
Host language
Go
topicsgolangcobracliflagscompletionstesting