Env config loader
Skill baronguyen001/ai-automation-skills/skills/env-config-loader
8 production-tested Claude skills: automation, Gemini cost/structured output, OSS bounty scouting, ML validation.
npx -y skills add baronguyen001/ai-automation-skills --skill env-config-loaderAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Load a .env file, validate that required keys are present, and read typed values (int/bool/float/list) with clear error messages - stdlib only, no python-dotenv, no pydantic. Use when the user asks to load a .env, validate config, fail fast on missing env vars, read an env var as an int or bool, or parse a comma-separated env list.
SKILL.md
2.9 KB, as published. Nobody here has run it
Env Config Loader
Use this skill when a script reads configuration from the environment and you want it to fail fast at startup with a clear message - "missing required keys: API_BASE, RUN_LIMIT" - instead of a KeyError halfway through, or a silent string-vs-int bug. It parses a simple .env, overlays the real environment, checks a required-key list once, and exposes typed getters (get_int, get_bool, get_float, get_list) that raise readable errors on bad values. No python-dotenv, no pydantic.
When to invoke
- User says: "load my .env", "validate config at startup", "fail fast if an env var is missing", "read this env var as an int / bool / list".
- Code in the conversation calls
os.environ[...]scattered around with no central validation.
When NOT to invoke
- A large nested config with deep schemas and cross-field rules - reach for
pydantic-settings. - Secrets live in a vault/secret manager, not env/.env; load from there instead.
Concrete example
User input:
Read API_BASE, RUN_LIMIT (int), and DRY_RUN (bool) from .env, and crash early with a clear message if any are missing.
Output:
# Copy assets/config.py into your project, then:
from config import Config
cfg = Config.load(".env", required=["API_BASE", "RUN_LIMIT"])
base = cfg.get("API_BASE") # str, guaranteed present
limit = cfg.get_int("RUN_LIMIT") # ValueError if not an int
dry_run = cfg.get_bool("DRY_RUN", default=False) # true/1/yes/on -> True
tags = cfg.get_list("TAGS", default=[]) # "a,b,c" -> ["a", "b", "c"]
If API_BASE or RUN_LIMIT is absent, Config.load raises ConfigError: missing required keys: ... at startup, before any work begins. .env ships as .env.example with placeholders only - never real values.
Pattern to apply
- Parse
.envpermissively: skip blanks/#comments, supportexport KEY=valand quoted values. - Let the real process environment win over
.env, so production overrides the file. - Validate the
requiredlist once inload()and raise a single error listing every missing key. - Use typed getters; coerce explicitly and raise a clear
ConfigErroron a bad value, never a silent default. - Commit only
.env.examplewith obvious placeholders; keep the real.envgitignored.
Reference: assets/config.py.
Source
Distilled from production use across the author's automation projects. v1.0.0. See also: [[config-audit-checklist]], [[telegram-alerter]], [[slack-webhook-alerter]].
→ Build the full runnable bot with Trawlkit.