configargparse-yaml-env-layeringlisted
Install: claude install-skill ajyadav013/claude-kit
Standardize service configuration using a three-layer hierarchy with YAML defaults, configargparse CLI/env merging, and a Pydantic BaseSettings singleton.
## When to use
- Setting up configuration for a new Python backend service or microservice
- Building services with multiple runtime modes (server, consumer, temporal_worker, cron)
- Implementing precedence-ordered configuration (YAML defaults < environment variables < CLI arguments)
- Migrating from flat .env files to structured, type-safe configuration
- Configuring services that need different entrypoints based on MODE environment variable
- Setting up mode-specific dispatch via entrypoint.py pattern
- Building container-deployable services that override defaults via environment variables
- Needing a module-level config singleton accessible throughout the codebase
- Implementing auto-prefixed environment variable parsing for all config keys
- Setting up services with database, Kafka, Temporal, Redis, and other infrastructure dependencies
## Core conventions
1. **Three-layer config hierarchy**: (1) `config/default.yaml` contains structured defaults for all environments; (2) `configargparse.ArgParser` with `auto_env_var_prefix=""` merges CLI args and env vars over YAML; (3) `config/docker_config.py` wraps parsed args in Pydantic `BaseSettings` and exports a module-level singleton `loaded_config`. Precedence: YAML < env vars < CLI args.
2. **YAML defaults in `config/default.yaml`**: define all config keys with developm