SKILL37.0K installs3.7K

Golang Spf13 Viper

Golang configuration library using spf13/viper — layered precedence (flag > env > file > KV > default), BindPFlag/BindPFlags, SetEnvPrefix + SetEnvKeyReplacer + AutomaticEnv, ReadInConfig + ConfigFileNotFoundError, Unmarshal + mapstructure struct tags, Sub for sub-trees, WatchConfig + OnConfigChange for hot reload, viper.New() for test isolation, and remote KV integration. Apply when using or adopting spf13/viper, or when the codebase imports `github.com/spf13/viper`. For CLI command structure alongside viper, see the `samber/cc-skills-golang@golang-spf13-cobra` skill. For general CLI architecture, see `samber/cc-skills-golang@golang-cli`.

Type
Skill
Author
samber
Category
Backend
GitHub stars
3.7K
Installs
37.0K
Last updated
November 1, 2026

Install

npx skills add https://github.com/samber/cc-skills-golang --skill golang-spf13-viper

Use cases


Frequently Asked Questions

What precedence order does viper use?

Flag > env > file > KV > default, as described in the skill.

How does it handle struct mapping?

Through Unmarshal with mapstructure struct tags.

Where do I look for CLI command structure?

The related samber/cc-skills-golang@golang-spf13-cobra skill covers cobra, and golang-cli covers general CLI architecture.


About this skill

Covers the spf13/viper configuration library for Go, including layered precedence, BindPFlag, environment binding, config file reading, Unmarshal with mapstructure tags, sub-trees, hot reload via WatchConfig, and remote KV integration. Use when adopting viper or when a codebase imports github.com/spf13/viper. Related skills cover cobra command structure and general CLI architecture.

Summary written with AI assistance from the project's public description.


Categories


More from samber


Similar Skills