x-env-config

Validate Go envconfig tags against doc.go and .env files.

2|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/pure-golang/level85 --skill x-env-config
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: x-env-config
Source: https://github.com/pure-golang/level85/tree/main/.agents/skills/x-env-config
Command: npx skills add https://github.com/pure-golang/level85 --skill x-env-config

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

It prevents configuration drift by ensuring that Go Config structs, doc.go documentation, and .env variables stay aligned when using envconfig and env.InitConfig.

Core Features & Use Cases

  • Keeps Config contracts consistent: validates that envconfig tags match what you document and what you place in .env.
  • Guides correct configuration loading: standardizes loading via env.InitConfig from .env (optional) and environment variables.
  • Supports nested adapter/platform configs: documents top-level variables explicitly while pointing to nested configs to avoid documentation noise.
  • Improves test reliability: clarifies how to handle defaults/parsing/required behavior and warns against t.Setenv combined with t.Parallel() when process-wide state is involved.

Quick Start

Run scripts/check-env-config.py for your <config.go>, <doc.go>, and optionally your .env file to immediately verify the env variables are synchronized.

Frequently Asked Questions about x-env-config

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent configuration drift between Go envconfig tags and .env files?

To validate Go envconfig struct tags, run a check script against your config.go and doc.go files to verify that environment variables match what you document and place in .env files. This ensures stable env var naming and presence alignment.

How does env.InitConfig load configuration from .env files in Go?

env.InitConfig standardizes configuration loading by reading from optional .env files and environment variables. This ensures consistent loading semantics across your Go application while supporting nested platform adapter configs.

Can I use t.Setenv with t.Parallel in Go configuration tests?

You should avoid combining t.Setenv with t.Parallel when process-wide state is involved. This precaution improves test reliability by preventing race conditions when handling defaults, parsing, or required behavior in environment configuration tests.

What is the best way to document nested adapter Config structs in Go?

Documenting nested adapter Config structs requires explicitly listing top-level environment variables while pointing to nested configs to avoid documentation noise. This keeps Config contracts consistent across envconfig tags and doc.go files.

Does this configuration validation work with nested platform adapter configs?

Yes, the validation supports nested adapter and platform configs by documenting top-level variables explicitly while pointing to nested configs. This avoids documentation noise and validates presence alignment across component-scoped environment variables.