Golang configuration
Skill ComeOnOliver/skillshub/skills/HoangNguyen0403/agent-skills-standard/golang-configuration
🧠The right skill, one API call. AI agent skills registry with token-efficient skill resolution. 5,000+ skills from 500+ top repos.
npx -y skills add ComeOnOliver/skillshub --skill golang-configurationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
What its author says it does
Copied from the file, not written here
Standards for application configuration using environment variables and libraries. Use when managing Go application config with environment variables or viper. (triggers: configs/**, cmd/**, configuration, env var, viper, koanf)
SKILL.md
1.3 KB, as published. Nobody here has run it
Golang Configuration Standards
Priority: P1 (STANDARD)
Principles
- 12-Factor App: Store config in environment variables.
- Typed Config: Load config into a struct, validate it immediately.
- Secrets: Never commit secrets. Use env vars or secret managers.
- No Globals: Return a Config struct and inject it.
Libraries
- Standard Lib:
os.Getenvfor simple apps. - Viper: Industry standard for complex configs (supports env, config files, remote config).
- Koanf: Lighter, cleaner alternative to Viper.
- Caarlos0/env: Good for strict struct tagging.
Pattern
- Define
Configstruct. - Load from defaults.
- Override from file (optional).
- Override from Env (priority).
- Validate.
References
Anti-Patterns
- No hardcoded secrets: Load all secrets from env vars or a secret manager.
- No global config vars: Return a typed Config struct and inject it via constructors.
- No startup without validation: Crash immediately on missing required env vars.