Cursor Rules for Design Systems: Why Static Files Drift
Static Cursor rules for a design system drift fast. Split rules into scoped .mdc files, enforce bans with ESLint, and resolve live tokens over MCP.
Nezar MansourContent Writer

Open a pull request in a typical frontend repository with an AI coding setup and look at the diff. Take a multi-theme patient portal repository that already ships .cursor/rules/design-system.mdc with alwaysApply: true. An engineer asks Cursor to add an appointment warning banner. The agent still imports LegacyAlert, writes #fef3c7 and #78350f directly into the stylesheet, and leaves out role="alert". Switch the portal to high-contrast mode (data-contrast="high"), and the banner becomes unreadable.
Cursor rules for a design system are versioned Markdown instructions in .cursor/rules/*.mdc that tell Cursor which design tokens, component APIs, and constraints to apply when editing matching files. When a team pours an entire styleguide into one always-on rule file, the instructions look thorough in review and still lose to legacy code on every sprint.
Fixing that drift takes three structural changes: splitting rules across Cursor's activation modes, enforcing bans with linters, and resolving live tokens over MCP.
Why static Cursor rules fail in a real design system
Static rule files fail because Cursor resolves context from nearby files first, flattens theme tokens when you paste hex palettes into prose, and never receives updates when the design system ships a new release.
Most public systems have not solved this for consuming teams yet. In Supernova's November 16, 2026 audit of 30 public design system repositories (detailed in our guide on what your AGENTS.md should say about your design system), 16 ship an agent instruction file, only 3 of 30 ship Cursor rules, and 0 of 30 are written for consuming product teams rather than library maintainers.
Three recurring mechanics explain why a single .cursor/rules/design-system.mdc file breaks down in production:
- Legacy code outvotes prose instructions: In her June 15, 2026 Builder.io breakdown, Alice Moore demonstrated that coding agents imitate existing repository patterns over markdown rules whenever nearby files conflict with the prompt. In that portal codebase, a dozen older routes still import
LegacyAlertwith inline#fef3c7backgrounds. Cursor scans those neighbors and copies the deprecated component anyway. - Hardcoded hex values break multi-theme token contracts: Popular community templates on awesome-cursorrules and cursor.directory tell teams to paste raw color tables into an always-on rule file. Modern multi-theme systems built around the October 28, 2025 W3C Design Tokens Community Group (DTCG) 2025.10 specification rely on semantic tokens that remap at runtime. Hardcoding
#0b5cador#ffffffbreaksdata-contrast="high", where--action-primary-bgremaps to#60a5faand--surface-cardshifts to#11161d. - Generated starter rules drift after the first release: Tools such as Figma's
create_design_system_rulesprompt scan a repository and generate a broad starter.cursor/rules/design-system.mdcsuited for one-off frame handoff. Once a component prop changes or a semantic token gets renamed, that static snapshot quietly teaches Cursor last quarter's API.
Every line added to a global rule file also loads on unrelated work. When an engineer edits an API handler or database migration, a 400-line UI guide burns context window budget without helping the task.
How should you map design system layers to Cursor activation modes?
Split your design system instructions across Cursor's four rule activation modes so global pointers stay tiny, UI rules load strictly on matching file globs, and live catalog specs stay out of static markdown.
Cursor evaluates .cursor/rules/*.mdc files using frontmatter fields (description, globs, and alwaysApply), supports nested .cursor/rules/ directories in monorepos, and recommends keeping each rule file under 500 lines. Teams working across multiple coding editors also maintain a root AGENTS.md file, a convention now adopted across 60,000+ open-source projects and 20+ tools as of November 2026, alongside tool-specific guidance like what to put in CLAUDE.md for a design system.
| Design system layer | File or endpoint | Cursor activation mode | Frontmatter trigger | What belongs there |
|---|---|---|---|---|
| Repo boundaries and pointers | AGENTS.md or .cursor/rules/ds-index.mdc | Always Apply | alwaysApply: true | Package names, build and test commands, and pointers to scoped UI rule files (under 20 lines) |
| Deprecations and accessibility floor | .cursor/rules/ds-deprecations.mdc | Apply to Specific Files | globs: ["src/**/*.tsx", "src/**/*.jsx", "**/*.css", "**/*.scss"] | Banned legacy components, forbidden raw hex styles, required ARIA roles |
| Semantic tokens and theme modes | .cursor/rules/ds-tokens.mdc | Apply to Specific Files | globs: ["**/*.css", "**/*.scss", "**/tokens/**", "src/**/*.tsx"] | Semantic CSS custom properties, theme pipeline contract, DTCG token tiers |
| Component APIs and composition | .cursor/rules/ds-components.mdc | Apply to Specific Files | globs: ["src/components/**/*.tsx", "src/features/**/*.tsx", "src/app/**/*.tsx"] | Approved React imports, TypeScript prop contracts, composition and form rules |
| Migrations and one-off refactors | .cursor/rules/ds-migration.mdc | Apply Intelligently or Apply Manually | description: "...", alwaysApply: false | Codemod recipes, Tailwind CSS cleanup, @ds-migration tasks |
| Live token values and variant specs | .cursor/mcp.json | On-demand MCP tool call | Remote server endpoint | Current token definitions, component props, states, and release changes |
Reserve alwaysApply: true strictly for a tiny repository boundary and pointer rule under 20 lines (or root AGENTS.md). Put token, component, and deprecation rules behind UI file globs so backend services, API handlers, and SQL migrations never pay a token tax for frontend guidelines.

Three scoped .cursor/rules/*.mdc files you can copy today
Replace a single monolithic design-system.mdc with three small .mdc files, each targeting one specific failure from the patient portal pull request.
1. Semantic token contract (ds-tokens.mdc)
Attach token rules to stylesheets, token packages, and TSX component files so inline styles get caught alongside CSS. Keep every literal color value out of the rule file itself, and require semantic variables that let the theme pipeline handle dark and high-contrast modes automatically.
---
description: Enforce semantic design tokens and multi-theme contrast contracts across styles and TSX files.
globs: ["**/*.css", "**/*.scss", "**/tokens/**", "src/**/*.tsx"]
alwaysApply: false
---
# Design Token Rules
- Never write raw hex, RGB, or HSL color literals in stylesheets or inline component styles.
- Map every color, surface, border, and spacing value to a semantic CSS custom property (`--action-primary-bg`, `--surface-card`, `--feedback-warning-bg`, `--feedback-warning-fg`).
- Never hardcode `[data-contrast="high"]` or `[data-theme="dark"]` color overrides inside feature styles; resolve active theme values from the token pipeline or Supernova MCP.
- Follow the repository's DTCG semantic naming tier (`<role>-<intent>-<property>`) rather than primitive palette names.
Because this rule contains zero static hex lookup tables, design system leads can update light, dark, or high-contrast theme values in the token pipeline without touching .cursor/rules/ds-tokens.mdc.
2. Component import and composition contract (ds-components.mdc)
Scope component rules to component, feature, and app route files. Focus on package boundaries and UI composition patterns that TypeScript types alone cannot enforce.
---
description: Enforce approved design system imports, composition rules, and accessible semantics in TSX files.
globs: ["src/components/**/*.tsx", "src/features/**/*.tsx", "src/app/**/*.tsx"]
alwaysApply: false
---
# Component Usage Rules
- Import UI primitives exclusively from `@clinical-ui/react`. Do not recreate buttons, banners, inputs, or dialogs inside feature folders.
- Use `ClinicalCallout` for inline warnings and notices with an explicit `intent` prop (`"info" | "warning" | "critical"`) and accessible status semantics (`role="alert"` for urgent warnings, `role="status"` for non-blocking notices).
- Allow at most one `variant="primary"` `Button` per toolbar, card footer, or dialog footer.
- Route all destructive actions through `ConfirmDialog` rather than `window.confirm` or ad-hoc modals.
- Wrap all inputs, selects, and textareas in `FormField` so labels, helper text, and `aria-describedby` error states stay bound.
- Verify exported TypeScript prop types or component stories before adding props. Do not pass undocumented `style` overrides for color or spacing.
Pointing Cursor to exported TypeScript interfaces and Storybook stories gives the agent deterministic local files to inspect, while the composition rules block valid-but-broken layouts that pass typechecking.
3. Deprecation and accessibility guardrails (ds-deprecations.mdc)
Scope deprecation bans to all UI source and stylesheet globs (src/**/*.tsx, src/**/*.jsx, **/*.css, **/*.scss) with alwaysApply: false. That keeps deprecated patterns blocked whenever Cursor touches a screen, layout, or stylesheet while keeping backend, API, and SQL work clean.
---
description: Block deprecated LegacyAlert usage and hardcoded warning styles across UI files.
globs: ["src/**/*.tsx", "src/**/*.jsx", "**/*.css", "**/*.scss"]
alwaysApply: false
---
# Deprecated Patterns (Do Not Use)
- Do not import or render `LegacyAlert` from `@clinical-ui/legacy` or local folders. Replace it with `ClinicalCallout` from `@clinical-ui/react`.
- Do not copy inline hex backgrounds or hardcoded text colors from older appointment screens.
- Every warning or error banner must expose `role="alert"` and rely on `--feedback-warning-*` tokens so `[data-contrast="high"]` remains legible.
Three short files outperform one 400-line manual because each rule activates only where it applies and gives Cursor unambiguous pass/fail instructions.
Pairing static Cursor rules with live MCP resolution and lint gates
Static .mdc files define local repository policy, linters reject rule violations before merge, and the Model Context Protocol (MCP) resolves live design system contracts so you stop hand-editing markdown after every release.
Enforcing static rules with linters and types
Prose rules alone remain advisory. Following the enforcement model Alice Moore outlined at Builder.io, pair .cursor/rules/*.mdc with deterministic build checks:
- Block deprecated imports with ESLint: Add an ESLint
no-restricted-importsrule forbidding@clinical-ui/legacyandLegacyAlert, with an error message pointing directly toClinicalCallout. - Reject raw color literals with Stylelint: Enable Stylelint's
color-no-hexrule on feature stylesheets so#fef3c7or#0b5cadfails locally before a pull request ever opens. - Constrain variants with TypeScript: Export strict prop unions (
intent: 'info' | 'warning' | 'critical') so invented variant strings fail typechecking immediately.
Resolving live design system contracts over MCP
Even with linters in place, static rule files hit an upstream scaling wall. Documentation is written for people to read; agents need structured context they can resolve directly into a token, component, variant, and state. Wrapping human-written styleguide pages inside a static rule, the pattern used in zeroheight's ai-plugins Cursor rule, still hands Cursor prose to interpret and leaves consuming repositories holding stale snapshots whenever the design system evolves. Connecting Cursor's MCP client closes that gap by adding .cursor/mcp.json at the workspace root (covered step by step in our guide to connect your design system to Cursor over MCP):
{
"mcpServers": {
"supernova": {
"url": "https://mcp.supernova.io/mcp"
}
}
}
With Supernova design system documentation and MCP, tokens, component metadata, code patterns, and usage rules live in one structured platform. Cursor keeps .cursor/rules/*.mdc strictly for repo-local constraints (forbidden legacy imports, composition boundaries, build scripts) and queries Supernova over MCP for current token mappings, props, and release changes. That same single-source contract approach powers how EGYM documents component contracts once for people and agents, eliminating manual rule rewrites across consuming product repos.
Every tier on Supernova's November 2026 pricing uses flat workspace pricing and includes Supernova Agent and MCP. Teams can test live token resolution on the free Starter plan (3 editors, 1 Consumer MCP server, and 1,000 monthly workspace credits), then scale to Pro ($399/month billed annually for 10 editors, 200 private consumers, and 2 Consumer MCP servers) or Enterprise for unlimited seats, SAML SSO, and adoption tracking.
What changes in the pull request when rules stay small
Return to that appointment warning pull request once the three-layer setup is active. When the engineer prompts Cursor, ds-deprecations.mdc blocks LegacyAlert on the TSX edit, ds-components.mdc and ds-tokens.mdc enforce @clinical-ui/react and semantic variables, and MCP resolves ClinicalCallout's current intent="warning" contract along with --feedback-warning-bg and --feedback-warning-fg. ESLint and Stylelint verify the diff locally, and switching to data-contrast="high" keeps the banner legible with role="alert" intact.
Writing a 400-line .cursor/rules/design-system.mdc file takes one afternoon. Keeping that static file accurate across multiple product repositories shifts maintenance cost off your tooling budget and straight onto senior engineers reviewing broken diffs every sprint.
If you want Cursor to resolve live tokens and component contracts instead of guessing from stale markdown files, explore Supernova's documentation and MCP platform or connect the free Starter plan directly to one repository and test the diff yourself.
Give your agents a system worth following
See how Supernova documents, syncs, and serves your system in one place.