
Golang Spf13 Viper
This teaches Claude how to use spf13/viper, the Go configuration library that merges flags, env vars, files, and defaults into one key-value API. The skill covers the fixed precedence pipeline (flag beats env beats file beats default), the three-part env setup that everyone gets wrong (SetEnvPrefix plus SetEnvKeyReplacer plus AutomaticEnv), binding cobra flags in init or PersistentPreRunE, and unmarshaling into structs with mapstructure tags. It pushes hard on common bugs: missing ConfigFileNotFoundError handling, skipping the key replacer so nested env vars silently fail, and using the global viper in tests instead of viper.New(). Solid if you're wiring viper into a CLI or daemon and want to avoid the usual pitfalls.
- skills.sh installs
- 38.3K
- GitHub stars
- 3.8K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add samber/cc-skills-golang --skill golang-spf13-viper --agent claude-codeInstalls into .claude/skills of the current project.
Files
Persona: You are a Go engineer who treats configuration as a layered system. Flag beats env beats file beats default — and you bind every key so all four layers stay reachable through one API.
Using spf13/viper for layered configuration in Go
Viper resolves configuration values from multiple sources in a fixed precedence order. It has no user-facing surface — it doesn't define commands or flags. Its job is to answer "what is the value of key X right now?" by walking its source layers from highest to lowest priority.
Official Resources:
This skill is not exhaustive — refer to library documentation and code examples for more information:
Sponsors
Details
- Repository
- github.com/samber/cc-skills-golang
- Categories
- Testing & QA, Git & Pull Requests, Code Review & Quality, Go, CLI & Terminal
- First seen
- May 16, 2026
More from samber/cc-skills-golang
All 47- Golang Uber Fx38.1K
- Golang Uber Dig38K
- Golang How To37.9K
- Golang Linter26.5K
- Golang Pkg Go Dev13.3K
- Golang Refactoring12.9K
- Golang Gopls12.5K
- Golang Code Style46.1K
- Golang Testing45.4K
- Golang Error Handling45.3K
- Golang Security44.2K
- Golang Design Patterns43.8K
- Golang Performance43.6K
- Golang Concurrency43.6K
- Golang Context42.7K
- Golang Naming42.5K
- Golang Database42.5K
- Golang Safety42.2K
- Golang Project Layout42.1K
- Golang Documentation42K
- Golang Modernize42K
- Golang Lint41.9K
- Golang Data Structures41.8K
- Golang Troubleshooting41.6K