一键导入
settings-singleton
Apply partitioned settings and singleton provider patterns; use when adding or refactoring settings and provider wiring.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Apply partitioned settings and singleton provider patterns; use when adding or refactoring settings and provider wiring.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Run and triage Python quality gates with minimal, root-cause fixes; use when validating feature work before completion.
Apply project testing standards for app/tests layout, naming, dependency overrides, and route/service coverage.
Apply typed FastAPI route patterns with clean dependency boundaries, stable error mapping, and test coverage for success/failure paths.
Author review-ready implementation plans grounded in real code, with a hard single-PR size gate and decomposition into safe incremental tasks when exceeded.
Operate Backlog.md tasks through the backlog CLI only; use when reading, planning, executing, or finalizing any task under backlog/tasks.
Apply pluggy registration and lifespan startup patterns for package discovery, initialization ordering, and testable startup behavior.
| name | settings-singleton |
| description | Apply partitioned settings and singleton provider patterns; use when adding or refactoring settings and provider wiring. |
Use this skill when introducing settings for new package domains, adjusting providers, or refactoring legacy settings usage.
app/packages/<feature>/settings.py.@lru_cache(maxsize=1) for singleton providers.get_settings() from within service constructors.When touching legacy settings:
@model_validator(mode="after") raising ValueError for insecure combinations (e.g. "*" combined with allow_credentials=True) - this fires at settings construction, which is effectively boot time. Enforce in every environment, not just production.ENVIRONMENT/PREFIX shape. CORS authorizes a different origin than the API itself; same-origin traffic never needs it. Populate real values explicitly via settings/deployment config instead of computing them.ENVIRONMENT (Literal["local","ci","dev","staging","production"]), on app settings. It is the sole environment signal and may be read for legitimate environment-conditional behavior (dev-only commands, local-service endpoints, prod-only side effects). Never re-derive environment from PREFIX, hostname, or sys.modules.app/infrastructure/<platform>/settings.py) as an explicit field (COMMAND_PREFIX), never derived from ENVIRONMENT. Transport-agnostic features never read platform settings; the transport applies command naming at registration.AppSettings.PREFIX carries no environment meaning and is not a home for new config — it survives only as the legacy Slack command-namespace read by frozen app/modules/, deleted when they are. New code uses ENVIRONMENT (identity) or the transport's COMMAND_PREFIX (naming). Reference: decisions/configuration.md, decisions/transport-slack.md.ENVIRONMENT/PREFIX instead of reading an explicit settings field.COMMAND_PREFIX) in app/root settings or deriving it from ENVIRONMENT/PREFIX; it is a transport-owned explicit setting.