What problem does it solve? Building a Go CLI with subcommands, flags, argument validation, and shell completions involves many cobra-specific pitfalls — using Run instead of RunE, writing manual len(args) checks, leaking flag state across tests, or losing the parent's PersistentPreRunE hook. This Skill encodes the correct patterns so generated cobra code follows the library's intended design. ## Core Features & Use Cases - Command tree and hook wiring: Guides root command setup, AddCommand/AddGroup ordering, the PersistentPreRunE → PreRunE → RunE → PostRunE → PersistentPostRunE lifecycle, and the child-hook-replaces-parent trap. - Flags, args, and completions: Covers persistent vs local flags, StringArray vs StringSlice, MarkFlagsMutuallyExclusive/RequiredTogether/OneRequired, Args validators composed with MatchAll, ValidArgsFunction, RegisterFlagCompletionFunc, and ShellCompDirective. - Testing and doc generation: Shows SetArgs/SetOut/SetErr test patterns, fresh command tree per test for isolation, golden files, and man-page/markdown doc generation via cobra/doc and cobra-cli. - Use Case: When adding a 'delete' subcommand that requires exactly one validated resource argument, the Skill produces a command using Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs) with RunE returning errors and output written via cmd.OutOrStdout(). ## Quick Start Ask the AI to create a cobra root command with a serve subcommand that uses RunE, a required port flag, and a unit test using SetArgs and SetOut.