samber avatar

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-code

Installs 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
1samber avatargolang-how-tosamber/cc-skills-golangGolang skills orchestrator — always active on any Golang coding, review, debug, or setup task. Reads the task context and loads the most relevant skills from sa37.9Kskills.sh installs
2firecrawl avatarfirecrawl-workflowsfirecrawl/firecrawl-workflowsRun outcome-focused Firecrawl workflows that produce deliverables such as research reports, SEO audits, QA reports, lead lists, knowledge bases, website design 32.9Kskills.sh installs
3clerk avatarclerkclerk/skillsClerk authentication router. Use when user asks about Clerk CLI operations, adding authentication, setting up Clerk, custom sign-in flows, Swift or native iOS a30.9Kskills.sh installs
4warpdotdev avatarfix-errorswarpdotdev/common-skillsFix compilation errors, linting issues, and test failures in the warp Rust codebase. Covers presubmit checks, WASM-specific errors, and running specific tests. 28.7Kskills.sh installs
5software-mansion avatarargent-screenshot-diffsoftware-mansion/argentCompare saved or live app screenshots with the argent screenshot-diff tool. Use when testing visual regressions, before/after UI comparisons, screenshot diff ch28.6Kskills.sh installs
6warpdotdev avatardiagnose-ci-failureswarpdotdev/common-skillsDiagnose CI failures for a PR using the GitHub CLI, extract error logs, and generate a plan to fix them. Use when the user asks to check CI status, pull CI issu28.6Kskills.sh installs