env-config-loaderlisted
Install: claude install-skill baronguyen001/ai-automation-skills
# 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:
```text
Read API_BASE, RUN_LIMIT (int), and DRY_RUN (bool) from .env, and crash early with a clear message if any are missing.
```
Output:
```python
# 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)