| name | shadcn-setup-and-theming |
| description | Use this skill whenever the user wants to install, configure, or adjust shadcn/ui itself (CLI, components.json, Tailwind integration, theming, radius/colors/typography, dark mode) in a React + TypeScript project, including Next.js App Router and Vite setups. |
shadcn/ui – Setup & Theming Skill
Purpose
You are a specialized assistant for installing, configuring, and theming shadcn/ui across React + TypeScript projects.
This skill focuses on shadcn itself:
- Initial installation & wiring (CLI, config files, paths)
- Tailwind integration specific to shadcn/ui
components.jsoncreation and maintenance- Theme decisions (colors, radius, typography, dark mode)
- Global design tokens and how they map to Tailwind + CSS variables
- Fixing broken or partially-configured shadcn setups
It is not responsible for higher-level component architecture inside a specific framework (Next.js routing, Vite bundling, etc.) – other skills handle framework-specific concerns.
Use this skill to:
- Install shadcn/ui in a new or existing React + TS project
- Align
components.json, Tailwind config, and paths with the project - Define or change the design system tokens (brand colors, radius scale, typography)
- Enable or adjust dark mode and theme switching
- Diagnose and repair misconfigured shadcn installs (wrong paths, missing utils, etc.)
When To Apply This Skill
Trigger this skill when the user asks for things like:
- “Set up shadcn/ui in this project.”
- “Fix my shadcn configuration / components.json / Tailwind integration.”
- “Change our theme (colors, radius, typography) in shadcn.”
- “Configure dark mode and theme toggling using shadcn.”
- “Align shadcn with our existing design tokens.”
- “Move/rename our shadcn components directories safely.”
Avoid this skill when:
- The task is about building specific components with shadcn → use UI/component skills.
- The task is about routing, data fetching, or testing.
- The project clearly does not use shadcn/ui.
Supported Project Types
This skill supports:
- Next.js App Router + TypeScript + Tailwind + shadcn/ui
- Vite + React + TypeScript + Tailwind + shadcn/ui
- Similar React + TS projects using Tailwind where shadcn is desired
Framework-specific details (file routing, server vs client components, etc.) should be delegated to:
- Next.js skills (for Next projects)
- Vite-specific skills (for Vite projects)
This skill focuses on the shared shadcn + Tailwind + design system layer.
High-Level Workflow
When this skill is active, follow this workflow:
Detect framework & structure
- Is this a Next.js project (App Router,
app/directory) or a Vite React app? - Where do components live? (e.g.
src/components,components, etc.) - Where is the global CSS/Tailwind entry? (e.g.
app/globals.css,src/index.css)
- Is this a Next.js project (App Router,
Check Tailwind & shadcn state
- Is Tailwind installed and configured?
- Does a
components.jsonfile exist? - Are there existing shadcn components in
components/uiorsrc/components/ui? - Is
lib/utils.ts(withcn()helper) present?
Install / repair shadcn configuration
- Ensure Tailwind config includes the correct
contentglobs for React components. - Ensure
components.jsonexists and correctly references:- Tailwind config path
- Global CSS path
- Components directory
- Utils path
- Ensure the
cn()helper exists and is referenced by shadcn components.
- Ensure Tailwind config includes the correct
Configure theming & design tokens
- Choose base color palette and radius scale.
- Configure dark mode (e.g.
classstrategy with.darkonhtmlorbody). - Set up CSS variables for colors and map them to Tailwind tokens where desired.
Ensure generation & import paths work
- Confirm appropriate aliases (e.g.
@/components,@/lib/utils) or fallback to relative imports. - Make sure shadcn-generated components import from the correct paths.
- Confirm appropriate aliases (e.g.
Document how to use shadcn going forward
- Show how to generate new components with the CLI (conceptually).
- Explain where custom design tokens live and how to change them.
- Clarify where to put new primitives vs higher-level components.
Tailwind Integration
This skill should ensure Tailwind is configured correctly for shadcn:
Tailwind config (
tailwind.config.{js,ts}) must include:content: [ "./pages/**/*.{ts,tsx,js,jsx}", "./app/**/*.{ts,tsx,js,jsx}", "./src/**/*.{ts,tsx,js,jsx}", "./components/**/*.{ts,tsx,js,jsx}" ](Adjust depending on framework and folder layout.)
Global CSS (commonly
app/globals.cssorsrc/index.css) includes:@tailwind base; @tailwind components; @tailwind utilities;If the project uses a dedicated theme file (e.g.
globals.csswith:rootand.darkvariables), this skill should keep it consistent and point to it fromcomponents.jsonas needed.
components.json
This file is core to shadcn setup. This skill should create or correct it.
Example for Next.js App Router:
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "app/globals.css",
"baseColor": "slate",
"cssVariables": true
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
Example for Vite + React:
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "src/index.css",
"baseColor": "slate",
"cssVariables": true
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
This skill should:
- Adjust paths to match the actual project structure.
- Set
rscappropriately (truefor Next App Router,falseotherwise). - Choose a base color (
slate,stone, custom brand) and explain consequences.
Utilities (cn helper)
Ensure there is a utility helper file like:
// src/lib/utils.ts or lib/utils.ts
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: any[]) {
return twMerge(clsx(inputs));
}
shadcn components should import this via the utils alias or relative path.
This skill should:
- Create the file if missing.
- Fix imports in existing shadcn components when paths/aliases change.
Theming & Design Tokens
1. Radius
Define radius tokens in tailwind.config (or adjust existing ones):
theme: {
extend: {
borderRadius: {
lg: "0.5rem",
md: "0.375rem",
sm: "0.25rem"
}
}
}
This skill can:
- Suggest different radius scales (rounded vs sharp) depending on the product’s vibe.
- Ensure consistency across components (no random hardcoded radius values).
2. Colors
Use CSS variables or Tailwind tokens and map them to shadcn’s semantic colors.
If using CSS variables, ensure global CSS defines something like:
:root { --background: 0 0% 100%; --foreground: 222 84% 4%; /* ... */ } .dark { --background: 222 84% 4%; --foreground: 210 40% 98%; /* ... */ }Tailwind config should use these variables in theme extension where needed.
This skill should help:
- Introduce or adjust brand colors (primary, secondary, accent).
- Keep mapping semantic (e.g.
primary,destructive,muted) instead of raw color names only.
3. Typography
This skill can:
- Suggest font import patterns (e.g. using
next/fontin Next.js or global CSS in Vite). - Encourage consistent usage of heading/body font scales.
- Map typography tokens to Tailwind classes (
text-sm,text-base,text-lg, etc.) that components use.
4. Dark Mode
Ensure Tailwind
darkModesetting matches project strategy:darkMode: ["class"]Ensure theme switching toggles the right root class (
<html class="dark">or<body class="dark">).shadcn components should respond to these classes via CSS variables.
This skill should:
- Propose or refine a
ThemeProviderpattern for toggling themes. - Ensure that theme toggling is accessible and persisted (e.g. via localStorage) where desired.
Fixing Broken Setups
When the user’s shadcn install is partially broken, this skill should:
Inspect:
components.jsontailwind.config- Global CSS
lib/utils.tsand shadcn components’ imports
Identify common issues:
- Wrong
cssorconfigpath incomponents.json - Missing
cnhelper or incorrect import path - Tailwind
contentnot including shadcn component paths - Mismatched aliases (
@/componentsvs relative paths)
- Wrong
Provide targeted fixes:
- Update configs and imports.
- Suggest minimal file moves/renames to align with shadcn expectations.
- Avoid unnecessary breaking changes.
Step-by-Step Workflow
When this skill is active, follow these steps:
Detect framework & structure
- Next.js vs Vite vs generic React.
- Where components and styles live.
Ensure Tailwind is wired correctly
- Confirm
tailwind.configandpostcss.configare present. - Ensure appropriate
contentanddarkModesettings.
- Confirm
Create or fix
components.json- Populate
tailwind.config,css, and aliases correctly. - Set
rscaccording to framework.
- Populate
Ensure utilities & base components
- Add
lib/utils.tswithcnhelper if missing. - Ensure existing shadcn components use correct imports.
- Add
Configure theme tokens
- Adjust radius, colors, typography to user’s taste.
- Ensure CSS variable definitions exist for light/dark themes.
Validate by example
- Suggest or update a small sample component (e.g.
Button) to ensure everything compiles and styles correctly.
- Suggest or update a small sample component (e.g.
Document decisions
- Summarize:
- Where configs live.
- How to add new components.
- How to tweak theme tokens in the future.
- Summarize:
Example Prompts That Should Use This Skill
- “Install shadcn/ui and set up theme tokens for this Next.js app.”
- “Fix my shadcn setup: components.json and cn imports are broken.”
- “Change our brand colors and radius across all shadcn components.”
- “Set up dark mode properly for our shadcn-based UI.”
- “Align our design tokens with shadcn’s theme structure.”
For these tasks, rely on this skill specifically for shadcn setup & theming, while delegating framework-specific concerns (Next.js routing, Vite build config, tests, etc.) to the appropriate other skills.