[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7DDGSS5C4TX7V9E60ZJACRW":3,"skill-same:01M7DDGSS5C4TX7V9E60ZJACRW":63},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":13,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7DDGSS5C4TX7V9E60ZJACRW","centralized-configuration",null,"Type-safe, self-documenting environment configuration with idempotent sync","AgentParadise\u002Fagentic-workspace","AgentParadise","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F242330113?v=4","01M6C52MXXSE01NH5GKMC3N7JA","01M7DDFCPP7TW5GGJZYGFPKMK2",0,"MIT","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fcentralized-configuration\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\ndescription: Type-safe, self-documenting environment configuration with idempotent sync\nmodel: sonnet\nallowed-tools: Read, Write, Shell\n---\n\n# Centralized Configuration\n\nA cross-cutting pattern for managing environment variables across polyglot repositories with type safety, self-documentation, and idempotent synchronization.\n\n## Philosophy\n\n### The Problem\n\nEnvironment configuration is often an afterthought, leading to:\n\n- **Documentation drift** - `.env.example` doesn't match actual requirements\n- **Runtime surprises** - Missing vars cause crashes in production\n- **Secret leaks** - Sensitive values accidentally logged\n- **Onboarding friction** - New team members don't know what to configure\n- **Sync anxiety** - Fear of overwriting existing values when updating\n\n### The Solution\n\n**Code is the source of truth.** Environment variables are defined in typed configuration classes, and everything else is generated from that single source.\n\n```\n┌─────────────────────────┐\n│   Configuration Code    │  ← Single source of truth\n│   (typed, documented)   │\n└───────────┬─────────────┘\n            │ generate\n            ▼\n┌─────────────────────────┐\n│     .env.example        │  ← Always fresh, committed\n└───────────┬─────────────┘\n            │ idempotent sync\n            ▼\n┌─────────────────────────┐\n│        .env             │  ← User secrets, gitignored\n├─────────────────────────┤\n│ ✓ Existing values       │  ← Never overwritten\n│ + New variables         │  ← Added with defaults\n│ ⚠️ External vars         │  ← Detected & preserved\n└─────────────────────────┘\n```\n\n---\n\n## Core Principles\n\n### 1. Code as Source of Truth\n\nConfiguration is defined in code, not in `.env` files:\n\n```\n# Instead of this:\n.env.example → manually maintained → gets outdated\n\n# Do this:\nConfigClass → generates → .env.example → syncs → .env\n```\n\n### 2. Type Safety\n\nValidate environment variables at startup, not at usage:\n\n- **Fail fast** - Missing required vars crash immediately with clear errors\n- **Type coercion** - Strings become bools, ints, URLs automatically\n- **Validation** - Check formats, ranges, allowed values\n\n### 3. Self-Documentation\n\nEvery variable includes its purpose and where to get it:\n\n```python\napi_key: str = Field(\n    description=\"API key for ExampleService. Get from: https:\u002F\u002Fexample.com\u002Fkeys\"\n)\n```\n\nThis description becomes a comment in `.env.example`:\n\n```bash\n# API key for ExampleService. Get from: https:\u002F\u002Fexample.com\u002Fkeys\nAPI_KEY=\n```\n\n### 4. Secret Protection\n\nSensitive values are:\n\n- **Typed as secrets** - Masked in logs and repr()\n- **Never defaulted** - Must be explicitly set\n- **Separate from config** - Clear which vars are sensitive\n\n### 5. Idempotent Sync\n\nRunning the generator is always safe:\n\n| Scenario | Behavior |\n|----------|----------|\n| Variable exists in `.env` | **Preserved** - never overwritten |\n| New variable in config | **Added** with default value |\n| Secret field | **Added** with empty value |\n| Removed from config | **Moved** to \"External\" section |\n| Unknown variable | **Preserved** with warning |\n\n### 6. Modular Namespacing\n\nRelated variables share a prefix:\n\n| Module | Prefix | Example |\n|--------|--------|---------|\n| Database | `DB_` | `DB_HOST`, `DB_PORT` |\n| GitHub App | `GITHUB_` | `GITHUB_APP_ID` |\n| AWS | `AWS_` | `AWS_ACCESS_KEY_ID` |\n| Logging | `LOG_` | `LOG_LEVEL`, `LOG_FORMAT` |\n\nThis prevents collisions and makes grouping obvious.\n\n---\n\n## Strategies\n\n### Strategy 1: Structured Settings Classes\n\nDefine configuration in typed classes with:\n\n- **Fields** - Name, type, default, description\n- **Validation** - Custom validators for complex rules\n- **Computed properties** - Derived values from other fields\n- **Nested modules** - Group related settings\n\n### Strategy 2: Generator Script\n\nA script that:\n\n1. **Introspects** configuration classes\n2. **Generates** `.env.example` with comments\n3. **Parses** existing `.env`\n4. **Merges** preserving user values\n5. **Detects** external variables\n\n### Strategy 3: Startup Validation\n\nLoad and validate all settings at application startup:\n\n```python\n# main.py - validate immediately\nsettings = get_settings()  # Crashes here if invalid\napp = create_app(settings)\n```\n\nNot lazily at usage:\n\n```python\n# ❌ Bad - crashes at runtime when accessed\ndef some_function():\n    api_key = os.getenv(\"API_KEY\")  # Might be None!\n```\n\n---\n\n## Project Structure\n\n```\nproject\u002F\n├── config\u002F                    # or settings\u002F, src\u002Fconfig\u002F\n│   ├── __init__.py           # Exports get_settings()\n│   ├── settings.py           # Main Settings class\n│   ├── database.py           # DatabaseSettings (DB_*)\n│   ├── github.py             # GitHubSettings (GITHUB_*)\n│   └── logging.py            # LoggingSettings (LOG_*)\n├── scripts\u002F\n│   └── generate_env.py       # Generator script\n├── .env.example              # Generated, committed\n├── .env                      # User secrets, gitignored\n└── justfile \u002F Makefile       # gen-env command\n```\n\n---\n\n## Language Implementations\n\n### Python (Pydantic Settings)\n\nThe gold standard for Python configuration.\n\n**Dependencies:**\n\n```toml\n# pyproject.toml\ndependencies = [\n    \"pydantic>=2.0\",\n    \"pydantic-settings>=2.0\",\n]\n```\n\n**Main Settings Class:**\n\n```python\n# config\u002Fsettings.py\nfrom functools import lru_cache\nfrom typing import TYPE_CHECKING\n\nfrom pydantic import Field, SecretStr\nfrom pydantic_settings import BaseSettings, SettingsConfigDict\n\nif TYPE_CHECKING:\n    from config.github import GitHubSettings\n\nclass Settings(BaseSettings):\n    \"\"\"Application settings - validated on startup.\"\"\"\n\n    model_config = SettingsConfigDict(\n        env_file=\".env\",\n        env_file_encoding=\"utf-8\",\n        case_sensitive=False,\n        extra=\"ignore\",\n    )\n\n    # Application\n    app_name: str = Field(\n        default=\"my-app\",\n        description=\"Application name for logging\",\n    )\n\n    debug: bool = Field(\n        default=False,\n        description=\"Enable debug mode. Never in production.\",\n    )\n\n    # Database\n    database_url: str | None = Field(\n        default=None,\n        description=(\n            \"PostgreSQL connection URL. \"\n            \"Format: postgresql:\u002F\u002Fuser:pass@host:port\u002Fdb\"\n        ),\n    )\n\n    # Secrets\n    api_key: SecretStr | None = Field(\n        default=None,\n        description=\"External API key. Get from: https:\u002F\u002Fexample.com\u002Fkeys\",\n    )\n\n    # Nested settings via property\n    @property\n    def github(self) -> \"GitHubSettings\":\n        from config.github import GitHubSettings\n        return GitHubSettings()\n\n\n@lru_cache\ndef get_settings() -> Settings:\n    \"\"\"Cached settings - validates on first access.\"\"\"\n    return Settings()\n\n\ndef reset_settings() -> None:\n    \"\"\"Clear cache for testing.\"\"\"\n    get_settings.cache_clear()\n```\n\n**Modular Settings with Prefix:**\n\n```python\n# config\u002Fgithub.py\nfrom typing import Self\n\nfrom pydantic import Field, SecretStr, model_validator\nfrom pydantic_settings import BaseSettings, SettingsConfigDict\n\n\nclass GitHubSettings(BaseSettings):\n    \"\"\"GitHub App settings with GITHUB_ prefix.\"\"\"\n\n    model_config = SettingsConfigDict(\n        env_prefix=\"GITHUB_\",  # All vars become GITHUB_*\n        env_file=\".env\",\n        extra=\"ignore\",\n    )\n\n    app_id: str | None = Field(\n        default=None,\n        description=\"GitHub App ID from app settings page\",\n    )\n\n    app_name: str | None = Field(\n        default=None,\n        description=\"App slug for commit attribution\",\n    )\n\n    installation_id: str | None = Field(\n        default=None,\n        description=\"Installation ID per organization\",\n    )\n\n    private_key: SecretStr | None = Field(\n        default=None,\n        description=\"RSA private key (PEM format)\",\n    )\n\n    @property\n    def is_configured(self) -> bool:\n        return bool(self.app_id and self.installation_id and self.private_key)\n\n    @property\n    def bot_username(self) -> str | None:\n        return f\"{self.app_name}[bot]\" if self.app_name else None\n\n    @model_validator(mode=\"after\")\n    def validate_complete(self) -> Self:\n        \"\"\"Ensure all-or-nothing configuration.\"\"\"\n        required = [self.app_id, self.installation_id, self.private_key]\n        provided = sum(1 for f in required if f is not None)\n\n        if 0 \u003C provided \u003C 3:\n            missing = [\n                \"GITHUB_APP_ID\" if not self.app_id else None,\n                \"GITHUB_INSTALLATION_ID\" if not self.installation_id else None,\n                \"GITHUB_PRIVATE_KEY\" if not self.private_key else None,\n            ]\n            raise ValueError(f\"Incomplete config: {[m for m in missing if m]}\")\n        return self\n```\n\n**Generator Script:**\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n# scripts\u002Fgenerate_env.py\n\"\"\"Generate .env.example and sync .env idempotently.\"\"\"\n\nfrom pathlib import Path\nfrom pydantic import SecretStr\nfrom pydantic_settings import BaseSettings\n\nPROJECT_ROOT = Path(__file__).parent.parent\n\n\ndef get_default(field_info) -> str:\n    from pydantic_core import PydanticUndefined\n    d = field_info.default\n    if d is None or d is PydanticUndefined:\n        return \"\"\n    if isinstance(d, bool):\n        return str(d).lower()\n    if hasattr(d, \"value\"):\n        return str(d.value)\n    return str(d)\n\n\ndef is_secret(field_type) -> bool:\n    from typing import get_args, get_origin\n    if field_type is SecretStr:\n        return True\n    origin = get_origin(field_type)\n    return origin and SecretStr in get_args(field_type)\n\n\ndef generate_section(cls: type[BaseSettings], name: str, prefix: str = \"\") -> list[str]:\n    import textwrap\n    lines = [\"\", \"# \" + \"=\" * 70, f\"# {name}\", \"# \" + \"=\" * 70, \"\"]\n\n    for fname, finfo in cls.model_fields.items():\n        ftype = cls.__annotations__.get(fname, str)\n        env_name = f\"{prefix}{fname.upper()}\"\n\n        if finfo.description:\n            for line in textwrap.wrap(finfo.description, 70):\n                lines.append(f\"# {line}\")\n\n        lines.append(f\"{env_name}={'' if is_secret(ftype) else get_default(finfo)}\")\n        lines.append(\"\")\n\n    return lines\n\n\ndef generate() -> str:\n    from config.settings import Settings\n    from config.github import GitHubSettings\n\n    lines = [\n        \"# \" + \"=\" * 70,\n        \"# ENVIRONMENT CONFIGURATION\",\n        \"# \" + \"=\" * 70,\n        \"# AUTO-GENERATED - run: just gen-env\",\n        \"# \" + \"=\" * 70,\n    ]\n    lines.extend(generate_section(Settings, \"APPLICATION\"))\n    lines.extend(generate_section(GitHubSettings, \"GITHUB\", \"GITHUB_\"))\n    return \"\\n\".join(lines)\n\n\ndef parse_env(path: Path) -> dict[str, str]:\n    if not path.exists():\n        return {}\n    env = {}\n    for line in path.read_text().split(\"\\n\"):\n        line = line.strip()\n        if line and not line.startswith(\"#\") and \"=\" in line:\n            k, _, v = line.partition(\"=\")\n            env[k.strip()] = v.strip()\n    return env\n\n\ndef sync(example: Path, env: Path) -> tuple[int, int, list[str]]:\n    existing = parse_env(env)\n    content = example.read_text()\n\n    template_keys = set()\n    new_vars = []\n    out = []\n\n    for line in content.split(\"\\n\"):\n        s = line.strip()\n        if not s or s.startswith(\"#\"):\n            out.append(line)\n            continue\n        if \"=\" in line:\n            k, _, default = line.partition(\"=\")\n            k = k.strip()\n            template_keys.add(k)\n            out.append(f\"{k}={existing.get(k, default.strip())}\")\n            if k not in existing:\n                new_vars.append(k)\n        else:\n            out.append(line)\n\n    extra = [k for k in existing if k not in template_keys]\n    if extra:\n        out.extend([\"\", \"# \" + \"=\" * 70, \"# EXTERNAL VARIABLES\", \"# \" + \"=\" * 70, \"\"])\n        for k in sorted(extra):\n            out.append(f\"{k}={existing[k]}\")\n\n    env.write_text(\"\\n\".join(out))\n    return len(new_vars), len(extra), extra\n\n\ndef main():\n    content = generate()\n    example = PROJECT_ROOT \u002F \".env.example\"\n    env = PROJECT_ROOT \u002F \".env\"\n\n    example.write_text(content)\n    print(f\"✅ Generated {example.name}\")\n\n    if env.exists():\n        new, ext, ext_vars = sync(example, env)\n        print(f\"✅ Synced .env ({new} new)\" if new else \"✅ .env up to date\")\n        if ext_vars:\n            print(f\"⚠️  {ext} external: {', '.join(ext_vars)}\")\n    else:\n        env.write_text(content)\n        print(\"✅ Created .env\")\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\n**Usage:**\n\n```python\nfrom config import get_settings\n\nsettings = get_settings()\n\n# Direct access\nprint(settings.app_name)\n\n# Nested with prefix\nif settings.github.is_configured:\n    print(settings.github.bot_username)\n\n# Secrets require explicit access\nif settings.api_key:\n    key = settings.api_key.get_secret_value()\n```\n\n---\n\n### TypeScript (Zod + dotenv)\n\n*(Future implementation)*\n\n```typescript\n\u002F\u002F config\u002Fsettings.ts\nimport { z } from 'zod';\nimport { config } from 'dotenv';\n\nconfig();\n\nconst SettingsSchema = z.object({\n  APP_NAME: z.string().default('my-app'),\n  DEBUG: z.coerce.boolean().default(false),\n  DATABASE_URL: z.string().url().optional(),\n  API_KEY: z.string().optional(),\n});\n\nexport const settings = SettingsSchema.parse(process.env);\n```\n\n---\n\n### Go (envconfig)\n\n*(Future implementation)*\n\n```go\n\u002F\u002F config\u002Fconfig.go\npackage config\n\nimport \"github.com\u002Fkelseyhightower\u002Fenvconfig\"\n\ntype Settings struct {\n    AppName     string `envconfig:\"APP_NAME\" default:\"my-app\"`\n    Debug       bool   `envconfig:\"DEBUG\" default:\"false\"`\n    DatabaseURL string `envconfig:\"DATABASE_URL\"`\n    APIKey      string `envconfig:\"API_KEY\"`\n}\n\nfunc Load() (*Settings, error) {\n    var s Settings\n    err := envconfig.Process(\"\", &s)\n    return &s, err\n}\n```\n\n---\n\n## Best Practices Checklist\n\n- [ ] **Single source of truth** - Config classes define all variables\n- [ ] **Type safety** - All variables have explicit types\n- [ ] **Secrets masked** - Use SecretStr\u002Fsecret types for sensitive values\n- [ ] **Descriptions** - Every field has description with \"where to get\"\n- [ ] **Prefixes** - Modular settings use unique prefixes\n- [ ] **Validation** - Custom validators for complex rules\n- [ ] **Startup check** - Load settings at app start, not lazily\n- [ ] **Generator script** - One command to sync everything\n- [ ] **Justfile\u002FMakefile** - `gen-env` command documented\n- [ ] **Gitignore** - `.env` ignored, `.env.example` committed\n\n---\n\n## Related Skills\n\n- `devops\u002Flogging` - Structured logging configuration\n- `devops\u002Fsecrets-management` - Vault, AWS Secrets Manager integration\n- `devops\u002Fdocker-compose` - Container environment configuration\n","# Centralized Configuration\n\nA cross-cutting pattern for managing environment variables across polyglot repositories with type safety, self-documentation, and idempotent synchronization.\n\n## Philosophy\n\n### The Problem\n\nEnvironment configuration is often an afterthought, leading to:\n\n- **Documentation drift** - `.env.example` doesn't match actual requirements\n- **Runtime surprises** - Missing vars cause crashes in production\n- **Secret leaks** - Sensitive values accidentally logged\n- **Onboarding friction** - New team members don't know what to configure\n- **Sync anxiety** - Fear of overwriting existing values when updating\n\n### The Solution\n\n**Code is the source of truth.** Environment variables are defined in typed configuration classes, and everything else is generated from that single source.\n\n```\n┌─────────────────────────┐\n│   Configuration Code    │  ← Single source of truth\n│   (typed, documented)   │\n└───────────┬─────────────┘\n            │ generate\n            ▼\n┌─────────────────────────┐\n│     .env.example        │  ← Always fresh, committed\n└───────────┬─────────────┘\n            │ idempotent sync\n            ▼\n┌─────────────────────────┐\n│        .env             │  ← User secrets, gitignored\n├─────────────────────────┤\n│ ✓ Existing values       │  ← Never overwritten\n│ + New variables         │  ← Added with defaults\n│ ⚠️ External vars         │  ← Detected & preserved\n└─────────────────────────┘\n```\n\n---\n\n## Core Principles\n\n### 1. Code as Source of Truth\n\nConfiguration is defined in code, not in `.env` files:\n\n```\n# Instead of this:\n.env.example → manually maintained → gets outdated\n\n# Do this:\nConfigClass → generates → .env.example → syncs → .env\n```\n\n### 2. Type Safety\n\nValidate environment variables at startup, not at usage:\n\n- **Fail fast** - Missing required vars crash immediately with clear errors\n- **Type coercion** - Strings become bools, ints, URLs automatically\n- **Validation** - Check formats, ranges, allowed values\n\n### 3. Self-Documentation\n\nEvery variable includes its purpose and where to get it:\n\n```python\napi_key: str = Field(\n    description=\"API key for ExampleService. Get from: https:\u002F\u002Fexample.com\u002Fkeys\"\n)\n```\n\nThis description becomes a comment in `.env.example`:\n\n```bash\n# API key for ExampleService. Get from: https:\u002F\u002Fexample.com\u002Fkeys\nAPI_KEY=\n```\n\n### 4. Secret Protection\n\nSensitive values are:\n\n- **Typed as secrets** - Masked in logs and repr()\n- **Never defaulted** - Must be explicitly set\n- **Separate from config** - Clear which vars are sensitive\n\n### 5. Idempotent Sync\n\nRunning the generator is always safe:\n\n| Scenario | Behavior |\n|----------|----------|\n| Variable exists in `.env` | **Preserved** - never overwritten |\n| New variable in config | **Added** with default value |\n| Secret field | **Added** with empty value |\n| Removed from config | **Moved** to \"External\" section |\n| Unknown variable | **Preserved** with warning |\n\n### 6. Modular Namespacing\n\nRelated variables share a prefix:\n\n| Module | Prefix | Example |\n|--------|--------|---------|\n| Database | `DB_` | `DB_HOST`, `DB_PORT` |\n| GitHub App | `GITHUB_` | `GITHUB_APP_ID` |\n| AWS | `AWS_` | `AWS_ACCESS_KEY_ID` |\n| Logging | `LOG_` | `LOG_LEVEL`, `LOG_FORMAT` |\n\nThis prevents collisions and makes grouping obvious.\n\n---\n\n## Strategies\n\n### Strategy 1: Structured Settings Classes\n\nDefine configuration in typed classes with:\n\n- **Fields** - Name, type, default, description\n- **Validation** - Custom validators for complex rules\n- **Computed properties** - Derived values from other fields\n- **Nested modules** - Group related settings\n\n### Strategy 2: Generator Script\n\nA script that:\n\n1. **Introspects** configuration classes\n2. **Generates** `.env.example` with comments\n3. **Parses** existing `.env`\n4. **Merges** preserving user values\n5. **Detects** external variables\n\n### Strategy 3: Startup Validation\n\nLoad and validate all settings at application startup:\n\n```python\n# main.py - validate immediately\nsettings = get_settings()  # Crashes here if invalid\napp = create_app(settings)\n```\n\nNot lazily at usage:\n\n```python\n# ❌ Bad - crashes at runtime when accessed\ndef some_function():\n    api_key = os.getenv(\"API_KEY\")  # Might be None!\n```\n\n---\n\n## Project Structure\n\n```\nproject\u002F\n├── config\u002F                    # or settings\u002F, src\u002Fconfig\u002F\n│   ├── __init__.py           # Exports get_settings()\n│   ├── settings.py           # Main Settings class\n│   ├── database.py           # DatabaseSettings (DB_*)\n│   ├── github.py             # GitHubSettings (GITHUB_*)\n│   └── logging.py            # LoggingSettings (LOG_*)\n├── scripts\u002F\n│   └── generate_env.py       # Generator script\n├── .env.example              # Generated, committed\n├── .env                      # User secrets, gitignored\n└── justfile \u002F Makefile       # gen-env command\n```\n\n---\n\n## Language Implementations\n\n### Python (Pydantic Settings)\n\nThe gold standard for Python configuration.\n\n**Dependencies:**\n\n```toml\n# pyproject.toml\ndependencies = [\n    \"pydantic>=2.0\",\n    \"pydantic-settings>=2.0\",\n]\n```\n\n**Main Settings Class:**\n\n```python\n# config\u002Fsettings.py\nfrom functools import lru_cache\nfrom typing import TYPE_CHECKING\n\nfrom pydantic import Field, SecretStr\nfrom pydantic_settings import BaseSettings, SettingsConfigDict\n\nif TYPE_CHECKING:\n    from config.github import GitHubSettings\n\nclass Settings(BaseSettings):\n    \"\"\"Application settings - validated on startup.\"\"\"\n\n    model_config = SettingsConfigDict(\n        env_file=\".env\",\n        env_file_encoding=\"utf-8\",\n        case_sensitive=False,\n        extra=\"ignore\",\n    )\n\n    # Application\n    app_name: str = Field(\n        default=\"my-app\",\n        description=\"Application name for logging\",\n    )\n\n    debug: bool = Field(\n        default=False,\n        description=\"Enable debug mode. Never in production.\",\n    )\n\n    # Database\n    database_url: str | None = Field(\n        default=None,\n        description=(\n            \"PostgreSQL connection URL. \"\n            \"Format: postgresql:\u002F\u002Fuser:pass@host:port\u002Fdb\"\n        ),\n    )\n\n    # Secrets\n    api_key: SecretStr | None = Field(\n        default=None,\n        description=\"External API key. Get from: https:\u002F\u002Fexample.com\u002Fkeys\",\n    )\n\n    # Nested settings via property\n    @property\n    def github(self) -> \"GitHubSettings\":\n        from config.github import GitHubSettings\n        return GitHubSettings()\n\n\n@lru_cache\ndef get_settings() -> Settings:\n    \"\"\"Cached settings - validates on first access.\"\"\"\n    return Settings()\n\n\ndef reset_settings() -> None:\n    \"\"\"Clear cache for testing.\"\"\"\n    get_settings.cache_clear()\n```\n\n**Modular Settings with Prefix:**\n\n```python\n# config\u002Fgithub.py\nfrom typing import Self\n\nfrom pydantic import Field, SecretStr, model_validator\nfrom pydantic_settings import BaseSettings, SettingsConfigDict\n\n\nclass GitHubSettings(BaseSettings):\n    \"\"\"GitHub App settings with GITHUB_ prefix.\"\"\"\n\n    model_config = SettingsConfigDict(\n        env_prefix=\"GITHUB_\",  # All vars become GITHUB_*\n        env_file=\".env\",\n        extra=\"ignore\",\n    )\n\n    app_id: str | None = Field(\n        default=None,\n        description=\"GitHub App ID from app settings page\",\n    )\n\n    app_name: str | None = Field(\n        default=None,\n        description=\"App slug for commit attribution\",\n    )\n\n    installation_id: str | None = Field(\n        default=None,\n        description=\"Installation ID per organization\",\n    )\n\n    private_key: SecretStr | None = Field(\n        default=None,\n        description=\"RSA private key (PEM format)\",\n    )\n\n    @property\n    def is_configured(self) -> bool:\n        return bool(self.app_id and self.installation_id and self.private_key)\n\n    @property\n    def bot_username(self) -> str | None:\n        return f\"{self.app_name}[bot]\" if self.app_name else None\n\n    @model_validator(mode=\"after\")\n    def validate_complete(self) -> Self:\n        \"\"\"Ensure all-or-nothing configuration.\"\"\"\n        required = [self.app_id, self.installation_id, self.private_key]\n        provided = sum(1 for f in required if f is not None)\n\n        if 0 \u003C provided \u003C 3:\n            missing = [\n                \"GITHUB_APP_ID\" if not self.app_id else None,\n                \"GITHUB_INSTALLATION_ID\" if not self.installation_id else None,\n                \"GITHUB_PRIVATE_KEY\" if not self.private_key else None,\n            ]\n            raise ValueError(f\"Incomplete config: {[m for m in missing if m]}\")\n        return self\n```\n\n**Generator Script:**\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n# scripts\u002Fgenerate_env.py\n\"\"\"Generate .env.example and sync .env idempotently.\"\"\"\n\nfrom pathlib import Path\nfrom pydantic import SecretStr\nfrom pydantic_settings import BaseSettings\n\nPROJECT_ROOT = Path(__file__).parent.parent\n\n\ndef get_default(field_info) -> str:\n    from pydantic_core import PydanticUndefined\n    d = field_info.default\n    if d is None or d is PydanticUndefined:\n        return \"\"\n    if isinstance(d, bool):\n        return str(d).lower()\n    if hasattr(d, \"value\"):\n        return str(d.value)\n    return str(d)\n\n\ndef is_secret(field_type) -> bool:\n    from typing import get_args, get_origin\n    if field_type is SecretStr:\n        return True\n    origin = get_origin(field_type)\n    return origin and SecretStr in get_args(field_type)\n\n\ndef generate_section(cls: type[BaseSettings], name: str, prefix: str = \"\") -> list[str]:\n    import textwrap\n    lines = [\"\", \"# \" + \"=\" * 70, f\"# {name}\", \"# \" + \"=\" * 70, \"\"]\n\n    for fname, finfo in cls.model_fields.items():\n        ftype = cls.__annotations__.get(fname, str)\n        env_name = f\"{prefix}{fname.upper()}\"\n\n        if finfo.description:\n            for line in textwrap.wrap(finfo.description, 70):\n                lines.append(f\"# {line}\")\n\n        lines.append(f\"{env_name}={'' if is_secret(ftype) else get_default(finfo)}\")\n        lines.append(\"\")\n\n    return lines\n\n\ndef generate() -> str:\n    from config.settings import Settings\n    from config.github import GitHubSettings\n\n    lines = [\n        \"# \" + \"=\" * 70,\n        \"# ENVIRONMENT CONFIGURATION\",\n        \"# \" + \"=\" * 70,\n        \"# AUTO-GENERATED - run: just gen-env\",\n        \"# \" + \"=\" * 70,\n    ]\n    lines.extend(generate_section(Settings, \"APPLICATION\"))\n    lines.extend(generate_section(GitHubSettings, \"GITHUB\", \"GITHUB_\"))\n    return \"\\n\".join(lines)\n\n\ndef parse_env(path: Path) -> dict[str, str]:\n    if not path.exists():\n        return {}\n    env = {}\n    for line in path.read_text().split(\"\\n\"):\n        line = line.strip()\n        if line and not line.startswith(\"#\") and \"=\" in line:\n            k, _, v = line.partition(\"=\")\n            env[k.strip()] = v.strip()\n    return env\n\n\ndef sync(example: Path, env: Path) -> tuple[int, int, list[str]]:\n    existing = parse_env(env)\n    content = example.read_text()\n\n    template_keys = set()\n    new_vars = []\n    out = []\n\n    for line in content.split(\"\\n\"):\n        s = line.strip()\n        if not s or s.startswith(\"#\"):\n            out.append(line)\n            continue\n        if \"=\" in line:\n            k, _, default = line.partition(\"=\")\n            k = k.strip()\n            template_keys.add(k)\n            out.append(f\"{k}={existing.get(k, default.strip())}\")\n            if k not in existing:\n                new_vars.append(k)\n        else:\n            out.append(line)\n\n    extra = [k for k in existing if k not in template_keys]\n    if extra:\n        out.extend([\"\", \"# \" + \"=\" * 70, \"# EXTERNAL VARIABLES\", \"# \" + \"=\" * 70, \"\"])\n        for k in sorted(extra):\n            out.append(f\"{k}={existing[k]}\")\n\n    env.write_text(\"\\n\".join(out))\n    return len(new_vars), len(extra), extra\n\n\ndef main():\n    content = generate()\n    example = PROJECT_ROOT \u002F \".env.example\"\n    env = PROJECT_ROOT \u002F \".env\"\n\n    example.write_text(content)\n    print(f\"✅ Generated {example.name}\")\n\n    if env.exists():\n        new, ext, ext_vars = sync(example, env)\n        print(f\"✅ Synced .env ({new} new)\" if new else \"✅ .env up to date\")\n        if ext_vars:\n            print(f\"⚠️  {ext} external: {', '.join(ext_vars)}\")\n    else:\n        env.write_text(content)\n        print(\"✅ Created .env\")\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\n**Usage:**\n\n```python\nfrom config import get_settings\n\nsettings = get_settings()\n\n# Direct access\nprint(settings.app_name)\n\n# Nested with prefix\nif settings.github.is_configured:\n    print(settings.github.bot_username)\n\n# Secrets require explicit access\nif settings.api_key:\n    key = settings.api_key.get_secret_value()\n```\n\n---\n\n### TypeScript (Zod + dotenv)\n\n*(Future implementation)*\n\n```typescript\n\u002F\u002F config\u002Fsettings.ts\nimport { z } from 'zod';\nimport { config } from 'dotenv';\n\nconfig();\n\nconst SettingsSchema = z.object({\n  APP_NAME: z.string().default('my-app'),\n  DEBUG: z.coerce.boolean().default(false),\n  DATABASE_URL: z.string().url().optional(),\n  API_KEY: z.string().optional(),\n});\n\nexport const settings = SettingsSchema.parse(process.env);\n```\n\n---\n\n### Go (envconfig)\n\n*(Future implementation)*\n\n```go\n\u002F\u002F config\u002Fconfig.go\npackage config\n\nimport \"github.com\u002Fkelseyhightower\u002Fenvconfig\"\n\ntype Settings struct {\n    AppName     string `envconfig:\"APP_NAME\" default:\"my-app\"`\n    Debug       bool   `envconfig:\"DEBUG\" default:\"false\"`\n    DatabaseURL string `envconfig:\"DATABASE_URL\"`\n    APIKey      string `envconfig:\"API_KEY\"`\n}\n\nfunc Load() (*Settings, error) {\n    var s Settings\n    err := envconfig.Process(\"\", &s)\n    return &s, err\n}\n```\n\n---\n\n## Best Practices Checklist\n\n- [ ] **Single source of truth** - Config classes define all variables\n- [ ] **Type safety** - All variables have explicit types\n- [ ] **Secrets masked** - Use SecretStr\u002Fsecret types for sensitive values\n- [ ] **Descriptions** - Every field has description with \"where to get\"\n- [ ] **Prefixes** - Modular settings use unique prefixes\n- [ ] **Validation** - Custom validators for complex rules\n- [ ] **Startup check** - Load settings at app start, not lazily\n- [ ] **Generator script** - One command to sync everything\n- [ ] **Justfile\u002FMakefile** - `gen-env` command documented\n- [ ] **Gitignore** - `.env` ignored, `.env.example` committed\n\n---\n\n## Related Skills\n\n- `devops\u002Flogging` - Structured logging configuration\n- `devops\u002Fsecrets-management` - Vault, AWS Secrets Manager integration\n- `devops\u002Fdocker-compose` - Container environment configuration\n",{"model":23,"description":7,"allowed-tools":24},"sonnet","Read, Write, Shell","main","8341ffb3b4128f405d0797b5f3f3affb25de91ea","plugins\u002Fsdlc\u002Fskills\u002Fcentralized-configuration","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace","https:\u002F\u002Fgithub.com\u002FAgentParadise","2026-11-09 13:31:42",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add AgentParadise\u002Fagentic-workspace --skill centralized-configuration",{"tool":37,"command":38},"bunx","bunx skills add AgentParadise\u002Fagentic-workspace --skill centralized-configuration",{"tool":40,"command":41},"pnpm","pnpm dlx skills add AgentParadise\u002Fagentic-workspace --skill centralized-configuration","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fcentralized-configuration\u002FSKILL.md",true,[45,51,55,59],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"resources\u002Fpython\u002F__init__.py","SCRIPT","脚本",272,"https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fcentralized-configuration\u002Fresources\u002Fpython\u002F__init__.py",{"path":52,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":53,"sourceHtmlUrl":54},"resources\u002Fpython\u002Fgenerate_env.py",9134,"https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fcentralized-configuration\u002Fresources\u002Fpython\u002Fgenerate_env.py",{"path":56,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":57,"sourceHtmlUrl":58},"resources\u002Fpython\u002Fgithub.py",5373,"https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fcentralized-configuration\u002Fresources\u002Fpython\u002Fgithub.py",{"path":60,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":61,"sourceHtmlUrl":62},"resources\u002Fpython\u002Fsettings.py",4508,"https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fcentralized-configuration\u002Fresources\u002Fpython\u002Fsettings.py",[64,71,78,85,92,99],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":18},"01M7DDJG3VACD4G63HQ3WWDTV5","testing-expert","Expert knowledge for analyzing testing architecture and planning improvements","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Ftesting-expert\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":18},"01M7DDJ3Z86RTM7YBDFF4QED1A","security-hardening","Audit and harden repository security — supply chain, CI\u002FCD scanners, secrets, credentials","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fsecurity-hardening\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M7DDHZY3KRZ1PM4YTVR8Y5B5","review","Review implementation against project plan and verify completeness","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Freview\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":18},"01M7DDHVFQK785K8Z7HX5GRN4A","qa-setup","Verify or create standardized QA commands for polyglot projects","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fqa-setup\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":18},"01M7DDHSD25FQ20METGDRWAWED","prioritize","Prioritize review comments by severity","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fprioritize\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":18},"01M7DDHPHRVKHR1TZBYNSTA0XX","pre-commit-qa","Run standardized QA checks before committing changes","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fpre-commit-qa\u002FSKILL.md",[],[]]