env-configlisted
Install: claude install-skill aiskillstore/marketplace
# Environment Configuration Skill
Expert environment configuration management for Python/FastAPI projects with secure secrets handling and multi-environment support.
## Quick Reference
| Pattern | Usage |
|---------|-------|
| Load .env | `load_dotenv()` at application start |
| Access var | `settings.DB_URL`, `settings.JWT_SECRET` |
| Required var | `Field(..., description="Database URL")` |
| Optional var | `DB_HOST: str = "localhost"` |
| Secret type | `SecretStr` for sensitive values |
## Project Structure
```
project/
├── .env # Local development (NOT committed)
├── .env.example # Template with all required vars (committed)
├── .env.staging # Staging environment
├── .env.production # Production environment (managed by infra)
└── config/
├── __init__.py
└── settings.py # Pydantic BaseSettings
```
## settings.py - Base Configuration
```python
# config/settings.py
from functools import lru_cache
from pydantic import Field, SecretStr
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(
env_file=".env",
env_file_encoding="utf-8",
extra="ignore",
)
# Application
APP_NAME: str = "ERP System"
DEBUG: bool = False
API_V1_PREFIX: str = "/v1"
# Database
DB_URL: str = Field(
...,
description="PostgreSQL connection URL",
examples=["postgresql://user:pass@localhost:543