specx Settings
SkillDev toolsAdd runtime configuration to specx Python services with `pydantic-settings`. Use when creating settings classes, environment variables, `.env.example`, injecting settings at delivery, infrastructure, or composition edges, documenting config, mapping configuration into typed core policy collaborators, or removing direct environment reads from core code.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the specx Settings skill
What this skill tells your AI
The instructions your AI receives, as published by maksimzayats/specx in skills/specx-settings/SKILL.md and read by ahel’s review.
Use this skill whenever runtime configuration is needed. Read
references/settings.md before adding settings code.
Rules
- Model runtime config with classes that inherit
BaseRuntimeSettings. - Give each settings class a docstring that explains the configuration scope
and includes a concrete
Example:. - Place settings near the class that consumes them unless the setting is truly application-wide.
- Logging settings are application-wide and live beside
infrastructure/logging/configurator.pyand itsLoggingConfigurator. - Use
BaseStrEnumfor finite configuration values such as logging levels. - Inject settings objects only into delivery, infrastructure, and composition
classes. Do not inject
BaseRuntimeSettingssubclasses into core use cases, services, capabilities, entities, repositories, or gateway ports. - When configuration represents a genuine business policy, map it at the
composition root into a typed core value or capability that has no dependency
on Pydantic or
BaseRuntimeSettings. - Let
diwireauto-register settings as root-scoped singletons. Register a settings instance explicitly only for an intentional override. - At operational entrypoints, load required runtime values with
SettingsClass.from_environment(). Build explicit test or composition overrides withSettingsClass.model_validate({...})so strict type checking does not mistake raw input strings for already-validated field types. - Do not read
os.environoutside settings classes or composition code. - Use clear environment variable names and safe defaults only when safe.
- Type secret fields with
SecretStr, keep secrets out of examples, and unwrap them only at the adapter call that needs the raw value. - Update
.env.examplewhen adding user-provided environment variables. - Isolate settings-source tests from a developer's
.envby changing totmp_path, then override environment values withmonkeypatch. - Do not inherit raw
BaseSettings; inheritspecx.infrastructure.foundation.settings.BaseRuntimeSettings.
Code Style
Use blank lines as logical separators in all code. Keep related statements together, but separate independent setup, action, assertion, response, branch, and transformation groups so long blocks stay readable.
References
references/settings.md- settings placement, examples, env naming, and test overrides.
Signals
- GitHub stars
- 201
- Forks
- 35
- Last commit
- Aug 2026
Advanced
- Catalog kind
- skill
- Gateway key
specx-settings- Source
- github.com/maksimzayats/specx