| name | sanity-plugin-best-practices |
| description | Anti-patterns and best practices for building Sanity Studio plugins in this monorepo. Use when writing, reviewing, or refactoring plugin code under plugins/ — especially for styling/CSS, component performance, and runtime cost. Triggers on vanilla-extract, raw <style> tags, styled-components, theming, inline styles, or questions about how plugins should be structured here. |
| metadata | {"author":"Sanity.io","version":"1.2.0"} |
Sanity Plugin Best Practices
Conventions for authoring plugins in the sanity-io/plugins monorepo, captured as concrete
anti-patterns and the preferred approach. These rules encode what the existing plugins already do
so new and migrated code stays consistent, fast, and theme-aware.
This complements the broader React performance guide in the
vercel-react-best-practices skill — read that for
general React/Next.js patterns, and this skill for plugin-specific guidance.
When to Use This Skill
Use this skill when you are:
- Writing or reviewing a plugin component under
plugins/ (.ts/.tsx) or a test-studio example.
- Adding or changing styling: authoring
.css.ts (vanilla-extract), reaching for <style> tags,
inline style={{}}, CSS files, or styled-components.
- Migrating an external plugin into the monorepo (pair with the
plugin-transfer skill).
- Investigating runtime cost, re-renders, or styling that does not respect the Studio theme.