
Description
golang-spf13-viper is an agent skill for configuration in Go with the spf13/viper library. Viper reads values from several sources and resolves them in a fixed order of precedence: a command-line flag beats an environment variable, which beats a configuration file, which beats a key-value store, which beats a default. The skill teaches the agent to bind every key so that all of these layers stay reachable through one API. It covers binding flags with BindPFlag and BindPFlags, setting an environment prefix with SetEnvPrefix, and mapping key names to environment variable names with SetEnvKeyReplacer. Viper has no user-facing surface of its own, since it defines no commands or flags. Its job is to answer the question of what the value of a given key is right now, by walking the source layers from highest to lowest priority. Command-line parsing is handled by the cobra library, which has its own skill. The skill points to the official Viper documentation for anything it does not cover, and it is part of the samber cc-skills-golang collection. It is added to a compatible agent with the skills command, and it is useful for Go services and tools that need one configuration model.…
Highlights
- Layered precedence: flag, env, file, KV, default
- BindPFlag and BindPFlags for flags
- SetEnvPrefix and SetEnvKeyReplacer for env vars
- One API for every configuration layer
Ratings & Reviews
No ratings yet
Be the first to rate golang-spf13-viper.
People also visit

setup-matt-pocock-skills
Configuration scaffold for engineering skills to locate issue tracker

configure-ecc
Run the conversational ECC setup wizard inside the current harness: inventory

golang-patterns
Idiomatic Go patterns, best practices, and conventions for building robust

golang-testing
Go testing patterns including table-driven tests, subtests, benchmarks, fuzzing
golang-spf13-viper FAQ
What does golang-spf13-viper do?
It guides an agent to set up layered configuration in a Go program with the spf13/viper library.
What is the order of precedence?
A flag beats an environment variable, which beats a file, which beats a key-value store, which beats a default.
Does viper parse commands or flags?
No. Viper defines no commands or flags. The skill notes that cobra handles command-line parsing.
How do flags and env vars connect?
The skill covers BindPFlag and BindPFlags for flags, and SetEnvPrefix with SetEnvKeyReplacer for environment variables.
How do I install it?
Run: npx skills add https://github.com/samber/cc-skills-golang --skill golang-spf13-viper
What security audits has it passed?
Gen Agent Trust Hub, Socket and Snyk all passed.
What are the best golang-spf13-viper alternatives?
Popular alternatives to golang-spf13-viper include setup-matt-pocock-skills, config-gc and configure-ecc. See all golang-spf13-viper alternatives






