Tooluck logoTooluck
SKILL.md

golang-spf13-viper

Agent skill fromsamber/cc-skills-golang

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`.

How to install golang-spf13-viper

install golang-spf13-viper
# install the cc-skills-golang pack with the skills CLI
npx skills add samber/cc-skills-golang

# or add only this skill to Claude Code: copy the folder

skills/golang-spf13-viper/

# into

~/.claude/skills/golang-spf13-viper/ (all projects)

.claude/skills/golang-spf13-viper/ (one project)

skills/golang-spf13-viper/SKILL.md

MITFull file
1**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.
2
3# Using spf13/viper for layered configuration in Go
4
5Viper 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.
6
7**Official Resources:**
8
9- [pkg.go.dev/github.com/spf13/viper](https://pkg.go.dev/github.com/spf13/viper)
10- [github.com/spf13/viper](https://github.com/spf13/viper)
11
12This skill is not exhaustive — refer to library documentation and code examples for more information:
13
14- For Go package docs, symbols, versions, importers, and known vulnerabilities, → See `samber/cc-skills-golang@golang-pkg-go-dev` skill (`godig`), preferred over Context7 for Go package facts.
15- To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See `samber/cc-skills-golang@golang-gopls` skill (`gopls`).
16- Context7 remains a fallback for docs not indexed on pkg.go.dev.
17
18```bash
19go get github.com/spf13/viper@latest
20```
21
22## Viper vs. cobra
23…

Excerpt shown under the repository's MIT license.

More skills in cc-skills-golang

Keep exploring

Similar skill repositories

thedotmack /

claude-mem
116k

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

CCCXGHGM+135 skills

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates