golang-cli
golang cli
What it does
- Build — creating a new CLI from scratch: follow the project structure, root command setup, flag binding, and version embedding sections sequentially.
- SilenceUsage: true MUST be set — prevents printing the full usage text on every error
- SilenceErrors: true MUST be set — lets you control error output format yourself
- PersistentPreRunE runs before every subcommand, so config is always initialized
- Logs go to stderr, output goes to stdout
- Persistent flags are inherited by all subcommands (e.g., --config)
- Local flags only apply to the command they're defined on (e.g., --port)
Requirements & configuration
- | cobra.ExactArgs(n) | Requires exactly n args |
- | cobra.MinimumNArgs(n) | Requires at least n args |
- | cobra.RangeArgs(min, max) | Requires between min and max |
Configuration: MYAPP_PORTPORT
Derived from the skill's own SKILL.md documentation · extracted 2026-07-23
golang-cli FAQ
What does the golang-cli skill do?
Golang CLI application development. Use when building, modifying, or reviewing a Go CLI tool — especially for command structure, flag handling, configuration layering, version embedding, exit codes, I/O patterns, signal handling, shell completion, argument validation, and CLI unit testing. Also triggers when code uses cobra, viper, or urfave/cli. For cobra-specific APIs → See `samber/cc-skills-golang@golang-spf13-cobra` skill; for viper configuration layering → See `samber/cc-skills-golang@golang-spf13-viper` skill. Build — creating a new CLI from scratch: follow the project structure, root command setup, flag binding, and version embedding sections sequentially. SilenceUsage: true MUST be set — prevents printing the full usage text on every error
What does golang-cli require?
| cobra.ExactArgs(n) | Requires exactly n args | | cobra.MinimumNArgs(n) | Requires at least n args | | cobra.RangeArgs(min, max) | Requires between min and max | Configuration keys: MYAPP_PORT, PORT.
How do I install golang-cli?
Run: npx -y skills add https://github.com/samber/cc-skills-golang --skill golang-cli --agent claude-code — the source lives at github.com/samber/cc-skills-golang.
Maintain golang-cli?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[](https://getagentictools.com/skills/samber-cc-skills-golang-golang-cli?ref=badge) npx agentictools info skills/samber-cc-skills-golang-golang-cli The second line is the CLI lookup for this page — handy in READMEs and docs.