Skip to content
bobmatnyc avatar

Golang Cli Cobra Viper

Cobra and Viper skill for building production-grade Go CLIs with layered configuration and shell completion.

CCM score
55 of 100
skills.sh installs
446
GitHub stars
79
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers Cobra command structure, persistent and local flags, PreRun and PostRun hooks, and Viper configuration precedence
  • Includes examples for subcommands with arguments, flag validation, and binding flags to Viper, drawn from kubectl, Docker, and gh patterns
  • Enforces configuration priority of explicit set, flags, environment variables, config files, then defaults, and uses RunE-style error returns
  • Designed for Go developers building multi-command developer tools, admin CLIs, or DevOps automation

Install

$ npx -y skills add bobmatnyc/claude-mpm-skills --skill golang-cli-cobra-viper -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Go CLI Development with Cobra & Viper

Overview

Cobra and Viper are the industry-standard libraries for building production-quality CLIs in Go. Cobra provides command structure and argument parsing, while Viper manages configuration from multiple sources with clear precedence rules.

Key Features:

  • 🎯 Cobra Commands: POSIX-compliant CLI with subcommands (app verb noun --flag)
  • βš™οΈ Viper Config: Unified configuration from flags, env vars, and config files
  • πŸ”„ Integration: Seamless Cobra + Viper plumbing patterns
  • 🐚 Shell Completion: Auto-generated completions for bash, zsh, fish, PowerShell
  • βœ… Production Ready: Battle-tested by kubectl, docker, gh, hugo

Used By: Kubernetes (kubectl), Docker CLI, GitHub CLI (gh), Hugo, Helm, and 100+ major projects

When to Use This Skill

Details

Repository
github.com/bobmatnyc/claude-mpm-skills
Categories
Go, CLI & Terminal
First seen
Jun 3, 2026

Questions

What is the golang-cli-cobra-viper skill for?

It guides an agent in building production-quality command-line tools in Go using the Cobra command framework and Viper configuration management. It covers multi-command CLIs, command structure, subcommands with arguments, and shell completion. Viper merges flags, environment variables and config files with clear precedence rules.

How do I install the golang-cli-cobra-viper skill?

Run npx -y skills add bobmatnyc/claude-mpm-skills --skill golang-cli-cobra-viper -y in your project. After installing, the agent can apply Cobra and Viper patterns when you build a Go CLI tool.

Who should use the golang-cli-cobra-viper skill?

It suits Go developers building multi-command CLIs, developer tools, DevOps automation or admin CLIs for services. It is useful when you need flags, environment variables and config files to work together. The skill sits in the Go category, where it ranks in the top 100.

Which skills are related to golang-cli-cobra-viper in the Go category?

The other top skills in the Go category include golang-code-style, golang-testing, golang-error-handling, golang-design-patterns and golang-concurrency. Golang-cli-cobra-viper focuses on CLI structure and configuration, while those cover code style, tests, errors, design and concurrency.

More from bobmatnyc/claude-mpm-skills

All 154

Similar to Golang Cli Cobra Viper

More Go