What problem does it solve? Go developers building command-line tools with spf13/cobra repeatedly hit the same pitfalls: using Run instead of RunE, writing manual len(args) checks, printing to os.Stdout so tests cannot capture output, and losing parent PersistentPreRunE hooks when a child overrides them. This Skill encodes the correct patterns for command trees, hooks, args validators, flags, completions, and testing. ## Core Features & Use Cases - Command tree and hook guidance: Covers the PersistentPreRunE → PreRunE → RunE → PostRunE → PersistentPostRunE lifecycle, inheritance rules, command groups, and SilenceUsage/SilenceErrors configuration. - Flags, validators, and completions: Explains persistent vs local flags, MarkFlagsMutuallyExclusive/RequiredTogether/OneRequired, StringArray vs StringSlice, MatchAll validator composition, ValidArgsFunction, and RegisterFlagCompletionFunc. - Testing patterns: Shows SetArgs/SetOut/SetErr test harnesses, fresh command tree per test for isolation, golden files, and completion testing via __complete. - Use Case: When adding a 'delete' subcommand that requires exactly one validated resource argument, the Skill directs you to declare Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs) instead of hand-rolled checks inside RunE. ## Quick Start Ask the agent to review or scaffold a cobra command in your Go project, for example by requesting a new subcommand with proper RunE error handling, args validation, and testable output.