golang-spf13-viper
golang spf13 viper
What it does
- pkg.go.dev/github.com/spf13/viper
- github.com/spf13/viper
- sources-and-formats.md — supported file formats, multi-path search, MergeInConfig, remote KV (etcd/Consul)
- binding-and-env.md — BindEnv, AutomaticEnv, SetEnvPrefix, SetEnvKeyReplacer, AllowEmptyEnv, timing rules
- unmarshal.md — Unmarshal, UnmarshalKey, mapstructure tags, custom DecodeHooks (Duration, IP, slice)
- watch-and-reload.md — WatchConfig, OnConfigChange, fsnotify caveats, atomic-rename trap, race-safe patterns
- testing-and-isolation.md — viper.New() per test, t.Setenv interactions, Reset() limitations, snapshot/restore
Requirements & configuration
- require.NoError(t, v.ReadInConfig())
Configuration: HOMEDATABASEDATABASE_HOSTMYAPP_DATABASE
Derived from the skill's own SKILL.md documentation · extracted 2026-07-23
golang-spf13-viper FAQ
What does the golang-spf13-viper skill do?
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`. pkg.go.dev/github.com/spf13/viper github.com/spf13/viper
What does golang-spf13-viper require?
require.NoError(t, v.ReadInConfig()) Configuration keys: HOME, DATABASE, DATABASE_HOST, MYAPP_DATABASE.
How do I install golang-spf13-viper?
Run: npx -y skills add https://github.com/samber/cc-skills-golang --skill golang-spf13-viper --agent claude-code — the source lives at github.com/samber/cc-skills-golang.
Maintain golang-spf13-viper?
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-spf13-viper?ref=badge) npx agentictools info skills/samber-cc-skills-golang-golang-spf13-viper The second line is the CLI lookup for this page — handy in READMEs and docs.