npx skills add ...
npx skills add wshobson/agents --skill python-configuration
Python configuration management via environment variables and typed settings. Use when externalizing config, setting up pydantic-settings, managing secrets, or implementing environment-specific behavior.
npx skills add wshobson/agents --skill python-configuration
Externalize configuration from code using environment variables and typed settings. Well-managed configuration enables the same code to run in any environment without modification.
All environment-specific values (URLs, secrets, feature flags) come from environment variables, not code.
Parse and validate configuration into typed objects at startup, not scattered throughout code.
Validate all required configuration at application boot. Missing config should crash immediately with a clear message.
Provide reasonable defaults for local development while requiring explicit values for sensitive settings.
Create a central settings class that loads and validates all configuration.
Import settings throughout your application:
Required settings should crash the application immediately with a clear error.
A clear error at startup is better than a cryptic None failure mid-request.
Provide sensible defaults for local development while requiring explicit values for secrets.
Create a .env file for local development (never commit this):
Prefix related variables for clarity and easy debugging.
Makes env | grep DB_ useful for debugging.
Detailed sections (starting with ## Advanced Patterns) live in references/details.md. Read that file when the navigation summary above is insufficient.
.env files (gitignored) or secret managersDB_HOST, REDIS_URL for clarityos.getenv() throughout code