Who it is forA design system owner who ships shared components and wants pages and agents to change only the parts the design allows.
The problemShared components get restyled in ways the design did not intend, and typed props alone cannot express rules like allow margin but keep padding.
The outcomeEach component gets its own allow and deny rules in config, and violations show a message that explains the allowed options.
What you need first
- Node.js 20.19 or later
- A Tailwind v4 project (shadcn/ui is not required)
- ESLint 9.30 or later, or Oxlint 1.80 or later
- A React, Vue, or Svelte project
Steps
- Run
npm install -D @shadcn/lint eslint @typescript-eslint/parserin the project. - In eslint.config.mjs, set "shadcn/no-restyle" with allow: ["layout"] and a contracts entry such as { pattern: "^Button$", allow: ["w-full", "mt-*", "mb-*"] }.
- Add a custom message under message, such as spacing: "Use the size prop instead of padding.", so the error tells the agent what to do.
- Run
npx eslint .and check that an allowed class passes while a disallowed class such as a custom padding is reported.
Prompt for your agent
Use the GitHub repo shadcn-ui/lint to add a no-restyle contract for <component-name> in <project-path>. Write the contract in the ESLint config, then run the lint command. Expected output: the contract allows the listed classes and reports the others. Verify that one disallowed class on <component-name> produces the custom message from the config.
Caveat. The README examples use component names such as Button and CardTitle, so contract patterns must match the names in your own code.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for shadcn-ui/lint and "Lock component styling with per-component contracts"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer