npx skills add ...
npx skills add sanity-io/sanity --skill sanity-config-reducers
npx skills add sanity-io/sanity --skill sanity-config-reducers
Add and review Sanity config properties that are reduced across root config and plugins. Use when adding beta flags, feature config, workspace/source options, default plugin gates, or resolved Source fields in packages/sanity/src/core/config.
Use this skill when a config value can be supplied by root config or plugins and needs deterministic merge behavior.
Inspect these files first:
packages/sanity/src/core/config/types.tspackages/sanity/src/core/config/configPropertyReducers.tspackages/sanity/src/core/config/prepareConfig.tsxpackages/sanity/src/core/config/flattenConfig.tspackages/sanity/src/core/config/resolveDefaultPlugins.ts if the config gates default plugin injection.Reducers usually:
flattenConfig(config, []).initialValue.innerConfig.undefined.getPrintableType(value) for invalid values.Config namespaces should usually be objects, even when they initially only contain one flag. This keeps room for future options without changing the public shape. For booleans, prefer feature.enabled and follow this shape:
Root config is flattened after plugin config, so root values usually win when a reducer overwrites with the latest defined value.
When adding a config property:
PluginOptions, WorkspaceOptions, or the relevant nested type in types.ts.beta.feature.enabled over direct booleans such as beta.feature.Source, Workspace, or the relevant prepared object in prepareConfig.tsx.source.__internal.options as an implementation detail, not the primary runtime API.Default plugin lists are computed before full source resolution. If a config value controls default plugin injection:
prepareConfig.tsx, before calling getDefaultPlugins.getDefaultPluginsOptions or the options passed to getDefaultPlugins.Beta flags live under BetaFeatures in types.ts and resolved runtime values under source.beta.
Prefer a dedicated reducer when:
Do not special-case beta flags in components by reading raw config if a resolved value can be exposed instead.
Add focused config tests for:
enabled is not the documented type.