Go Viper config library (spf13/viper). Use for config files (SetConfigName, AddConfigPath), defaults, env binding (SetEnvPrefix, AutomaticEnv, BindEnv), or struct unmarshaling with mapstructure tags.
Ships in golang-viper. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Viper is Go's most popular configuration library. It handles config files, environment variables, defaults, and remote config stores with a unified API.
viper.Set() - explicit runtime overridesviper.SetDefault() - defaults// Basic setup
viper.SetConfigName("config") // filename without extension
viper.SetConfigType("yaml") // explicit format
viper.AddConfigPath(".") // search current dir
viper.AddConfigPath("$HOME/.myapp") // search home dir
// Set defaults before reading
viper.SetDefault("server.port", 8080)
// Read config
if err := viper.ReadInConfig(); err != nil {
if _, ok := err.(viper.ConfigFileNotFoundError); ok {
// Config file not found; use defaults
} else {
return fmt.Errorf("config error: %w", err)
}
}
// Get values
host := viper.GetString("server.host")
port := viper.GetInt("server.port")
debug := viper.GetBool("debug")
// Unmarshal to struct
var config Config
viper.Unmarshal(&config)
viper.UnmarshalKey("server", &config.Server)
server.PORT and server.port are the sameAPP_PORT differs from app_portserver.host maps to YAML server: { host: ... }Detailed documentation for each feature area:
references/core-config.md - Config files, paths, defaults, reading; multiple configs + AllSettingsreferences/environment-vars.md - Env binding, prefixes, key replacers, AutomaticEnv; gotchas + patternsreferences/unmarshaling.md - Structs, mapstructure tags, type getters, custom types; sub-configs, strict mode, gotchareferences/advanced-features.md - Watching changes, remote config, writing configs// Main config
viper.SetConfigName("config")
viper.ReadInConfig()
// Separate secrets file
secretsViper := viper.New()
secretsViper.SetConfigName("secrets")
secretsViper.AddConfigPath(".")
secretsViper.ReadInConfig()
viper.SetEnvPrefix("MYAPP") // MYAPP_SERVER_PORT
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
viper.AutomaticEnv()
config.yaml (opens in a new tab)references/advanced-features.md (opens in a new tab)references/core-config-multi.md (opens in a new tab)references/core-config.md (opens in a new tab)references/environment-vars-patterns.md (opens in a new tab)references/environment-vars.md (opens in a new tab)references/unmarshaling-advanced.md (opens in a new tab)references/unmarshaling.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/golang-viper:golang-viperfrom golang-viper
npx claudepluginhub kettleofketchup/kettleofskills --plugin golang-viper