cobra-viper

Installation
SKILL.md

Go CLI Architecture: Cobra & Viper

Idiomatic patterns and best practices for building robust, configuration-driven command-line interfaces using Cobra and Viper.

When to Activate

  • Writing a new CLI application in Go
  • Adding commands, subcommands, or flags to an existing Cobra application
  • Integrating Viper for configuration file, environment variable, or flag management
  • Reviewing or refactoring CLI code that uses Cobra and/or Viper
  • Designing the command structure or configuration schema for a CLI tool
  • Testing CLI commands

Core Philosophy

The Command-First Architecture

Treat your application binary as a router for commands. The CLI framework (Cobra) should solely handle flags, arguments, and routing. Your core business logic should remain completely unaware of the CLI layer, making it highly testable and reusable.

Installs
95
Repository
spf13/go-skills
GitHub Stars
656
First Seen
Mar 25, 2026
cobra-viper — spf13/go-skills