Customize the Shadcn design system (Tailwind v4 supported). Update design tokens, safe refactoring, and color management.
Resources
2Install
npx skillscat add wiztral/agent-skills/shadcn-theming Install via the SkillsCat registry.
This skill customizes the Shadcn design system by managing design tokens in global stylesheets, supporting both Tailwind v3 and v4. It helps add new OKLCH colors, adjust theming for high-level design changes like softer UI, and refactor tokens safely while preserving semantic meaning. Developers should use it when modifying the visual appearance, adding new color tokens, or evolving the theme of a Shadcn-based application.
Shadcn Theming
Use this skill to modify the look and feel of the application (globals.css / index.css), add new colors, and manage design tokens.
Documentation
Workflow
1. File Identification & Validation
- Locate CSS:
app/globals.css(Next.js) orsrc/index.css(Vite).- If missing: Ask user for the main global stylesheet location.
- Check Version: Look for
tailwind.config.js(v3) or@import "tailwindcss"; / @theme { ... }(v4).- If both missing: The project might not be set up correctly. Use
shadcn-setupor verify Tailwind installation.
- If both missing: The project might not be set up correctly. Use
2. Token Management & Evolution
Adding New Colors (OKLCH Preferred)
- Generate Value: Use the
convert_colors.jsscript to get the OKLCH value for your color.node scripts/convert_colors.js "#ff0000" - Add to CSS:
- v4: Add to
@themeor@layer base. - v3: Add to
:rootand.darkvariables, then reference intailwind.config.jsextend.
- v4: Add to
Adaptive Design Strategy
When the user asks for high-level changes (e.g., "Make it softer"):
- Radius: Increase
--radius(e.g.,0.5rem->1rem). - Colors: Lower contrast or saturation using OKLCH chroma (C) values.
- Density: Adjust spacing tokens if present.
Safe Refactoring
Evolution over Destruction:
- Do not reuse a semantic token for a significantly different purpose (e.g., don't turn
destructiveblue). - Create New: If a new semantic meaning emerges (e.g., "Success State"), create
--success/--success-foreground. - Search First: Before renaming
--primary, search the entire codebase to understand impact.
3. Contrast & Accessibility
- Check Pairs: When changing a background color (e.g.,
--primary), IMMEDIATELY check its pair (--primary-foreground) for contrast. - Rule: Ensure at least 4.5:1 contrast ratio for text.
4. Implementation Details (Tailwind v4)
In Tailwind v4, prefer CSS-first configuration:
@theme {
--color-primary: oklch(0.6 0.1 240);
--color-primary-foreground: oklch(0.98 0 0);
/* ... */
}If the project uses :root variables (standard Shadcn), keep them:
@layer base {
:root {
--primary: 0.6 0.1 240; /* Note: Shadcn often uses space-separated values for HSL/legacy. Adapt as needed. */
}
}Note: If Shadcn is set up with CSS variables, respect the project's existing format (HSL vs OKLCH).