sanity-default-plugins

Create and wire Sanity core plugins using the monorepo's default plugin conventions.

6.3k|550|Updated Jan 18, 2017
One-click install
npx skills add https://github.com/sanity-io/sanity --skill sanity-default-plugins
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sanity-default-plugins
Source: https://github.com/sanity-io/sanity/tree/main/.agents/skills/sanity-default-plugins
Command: npx skills add https://github.com/sanity-io/sanity --skill sanity-default-plugins

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Adding a new core plugin to the Sanity monorepo requires following specific internal conventions for plugin definition, i18n locale bundles, and default plugin wiring in resolveDefaultPlugins.ts, which are easy to get wrong without guidance.

Core Features & Use Cases

  • Plugin Scaffolding: Defines the standard plugin shape using definePlugin with a stable internal name constant and studio component middleware.
  • Locale Resource Setup: Provides the exact i18n bundle pattern (index.ts, resources.ts, plugin registration) for core plugins that render UI text.
  • Default Plugin Wiring: Walks through registering plugins in resolveDefaultPlugins.ts, adding gated options to DefaultPluginsWorkspaceOptions, and writing focused config tests.
  • Use Case: When adding a new feature plugin under packages/sanity/src/core, follow this Skill to register it in the default plugin chain, add its locale bundle, and verify with the resolveConfig test suite.

Quick Start

Ask the AI to add a new core plugin for a feature under packages/sanity/src/core and wire it into the default plugins with its locale bundle and tests.

Frequently Asked Questions about sanity-default-plugins

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new core plugin in the Sanity monorepo?

Create the plugin under packages/sanity/src/core using definePlugin with a stable name constant, then register it in resolveDefaultPlugins.ts by adding it to defaultPlugins(options) and optionally gating it in getDefaultPlugins with a name check.

How do I add locale resources to a Sanity core plugin?

Create an i18n folder with index.ts exporting the namespace and US English LocaleResourceBundle, resources.ts exporting the default strings and keyof type, then register the bundle under i18n.bundles in the plugin definition.

How are default plugins gated behind config flags in Sanity?

Add the option to DefaultPluginsWorkspaceOptions in types.ts, build defaults in getDefaultPluginsOptions from workspace config, and add a plugin.name === FEATURE_NAME branch in getDefaultPlugins to conditionally include the plugin.

How do I test default plugin registration in Sanity?

Update packages/sanity/src/core/config/__tests__/resolveConfig.test.ts with tests verifying the plugin is not added by default and is added when the config flag is enabled, then run pnpm vitest run --project=sanity on that test file.

Why does plugin order matter for Sanity studio components?

User plugins are appended before default plugins in prepareConfig.tsx, and the component middleware chain reverses the flattened config order. Check the existing chain before relying on wrapper order for UI composition.