cobra

Installation
SKILL.md

Cobra CLI Application Reference

Reference for building CLI applications with cobra. Covers the public API, common patterns, and best practices.

Sub-Resources

Load the reference that matches your task. When in doubt, load multiple references.

Keywords Reference
Command, AddCommand, subcommand, root command, project structure, command fields, Use, Short, Long, Example, Aliases, Deprecated, Hidden, GroupID, Run, RunE references/commands.md
flag, PersistentFlags, LocalFlags, required flag, flag group, required together, mutually exclusive, one required, repeated flag, count flag, string slice, TraverseChildren, MarkFlagRequired, MarkPersistentFlagRequired references/flags.md
argument, positional arg, Args, NoArgs, ArbitraryArgs, MinimumNArgs, MaximumNArgs, ExactArgs, RangeArgs, OnlyValidArgs, NoDuplicateArgs, MatchAll, ValidArgs, ArgAliases, custom validator references/arguments.md
hook, lifecycle, PreRun, PostRun, PersistentPreRun, PersistentPostRun, PreRunE, PostRunE, EnableTraverseRunHooks, execution order, inherited hooks references/hooks.md
help, usage, template, SetHelpFunc, SetHelpTemplate, SetUsageFunc, SetUsageTemplate, version, SetVersionTemplate, help command, command grouping, GroupID, SetHelpCommandGroupId, SetCompletionCommandGroupId, ErrPrefix references/help-usage.md
completion, shell completion, ValidArgs, ValidArgsFunction, CompletionFunc, RegisterFlagCompletionFunc, ShellCompDirective, NoFileCompletions, FixedCompletions, active help, AppendActiveHelp, GetActiveHelpConfig, CompletionOptions, completion command, bash, zsh, fish, powershell references/completions.md
viper, config, OnInitialize, BindPFlag, config file, 12-factor, initConfig, AutomaticEnv references/viper-integration.md

Quick Guide

Installs
6
GitHub Stars
2.0K
First Seen
Jun 14, 2026