Loading...
Loading...
This skill should be used when setting up, configuring, or initializing Tailwind CSS (v3 or v4) and shadcn/ui for Next.js 16 App Router projects. Configure dark mode, design tokens, base layout with header/sidebar, accessibility defaults, and generate example components. Includes comprehensive setup automation, theme customization, and production-ready patterns. Use when the user requests "setup Tailwind", "configure shadcn/ui", "add dark mode", "initialize design system", or "setup UI framework" for Next.js projects.
npx skill4agent add hopeoverture/worldbuilding-app-skills tailwind-shadcn-ui-setupnext-themesapp/npm installpackage.json.tsx.ts# Check Next.js version
cat package.json | grep "\"next\":"
# Confirm app/ directory exists
ls -la app/AskUserQuestionnext-themesThemeProviderSheetcd /path/to/nextjs-project
python /path/to/skill/scripts/setup_tailwind_shadcn.pycomponents.jsonlib/utils.tscn()assets/# Copy and create
cp assets/tailwind.config.ts.template project/tailwind.config.ts
cp assets/postcss.config.js.template project/postcss.config.js# Copy and replace {{THEME_PRESET}} with user's choice
cp assets/globals.css.template project/app/globals.css
# Replace: {{THEME_PRESET}} → zinc | slate | neutralcp assets/lib/utils.ts project/lib/utils.tsassets/components/cp assets/components/theme-provider.tsx project/components/theme-provider.tsx
cp assets/components/mode-toggle.tsx project/components/mode-toggle.tsxcp assets/components/app-shell.tsx project/components/app-shell.tsxapp/layout.tsx# If layout.tsx exists, carefully merge changes
# If not, copy template
cp assets/app/layout.tsx.template project/app/layout.tsxglobals.cssThemeProvider<Toaster />ThemeProviderToasterbodysuppressHydrationWarning<html># Copy home page
cp assets/app/page.tsx.template project/app/page.tsx
# Copy examples directory structure
cp -r assets/app/examples/ project/app/examples/app/page.tsxapp/examples/forms/page.tsxapp/examples/dialogs/page.tsxapp/examples/theme/page.tsx# Common components for examples
npx shadcn-ui@latest add dropdown-menu
npx shadcn-ui@latest add sheet
npx shadcn-ui@latest add separator
# Optional: Form components
npx shadcn-ui@latest add form
npx shadcn-ui@latest add checkbox
npx shadcn-ui@latest add selectreferences/shadcn-component-list.md# Check for TypeScript errors
npx tsc --noEmit
# Start dev server
npm run dev
# Open browser to http://localhost:3000README.md## Design System & UI
This project uses Tailwind CSS and shadcn/ui for styling and components.
### Customizing Colors
Edit CSS variables in `app/globals.css`:
```css
:root {
--primary: 270 80% 45%; /* Your brand color (HSL) */
--radius: 0.75rem; /* Border radius */
}
```
Test contrast ratios: https://webaim.org/resources/contrastchecker/
### Adding Components
```bash
# Add any shadcn/ui component
npx shadcn-ui@latest add [component-name]
# Example: Add a combobox
npx shadcn-ui@latest add combobox
```
Available components: https://ui.shadcn.com/docs/components
### Dark Mode
Toggle theme programmatically:
```tsx
import { useTheme } from 'next-themes'
export function Example() {
const { theme, setTheme } = useTheme()
// theme: 'light' | 'dark' | 'system'
// setTheme('dark')
}
```
### Accessibility
- All components meet WCAG 2.1 Level AA
- Focus indicators on all interactive elements
- Keyboard navigation supported
- Screen reader compatible
See `references/accessibility-checklist.md` for full guidelines.--primary: 240 5.9% 10%;
--muted: 240 4.8% 95.9%;--primary: 222.2 47.4% 11.2%;
--muted: 210 40% 96.1%;--primary: 0 0% 9%;
--muted: 0 0% 96.1%;app/globals.css:root.darknpm view tailwindcss version@themereferences/tailwind-v4-migration.md// TODO: Upgrade to Tailwind v4 when stablesidebarLayout = trueAppShellSheetsidebarLayout = falsenavigation<AppShell
navigation={[
{ title: 'Home', href: '/', icon: Home },
{ title: 'About', href: '/about', icon: Info },
]}
siteTitle="My App"
>
{children}
</AppShell># Clear npm cache
npm cache clean --force
# Retry with verbose logging
npm install --verbose
# Or use specific registry
npm install --registry https://registry.npmjs.org/# Install missing types
npm install --save-dev @types/react @types/react-dom @types/node
# Check tsconfig.json paths
{
"compilerOptions": {
"paths": {
"@/*": ["./*"]
}
}
}suppressHydrationWarning<html suppressHydrationWarning>ThemeProvider{children}tailwind.config.tsdarkMode: 'class'components.json# Reinitialize shadcn/ui
npx shadcn-ui@latest init
# Re-add components
npx shadcn-ui@latest add button card inputapp/globals.css*:focus-visible--ringtailwind-v4-migration.mdshadcn-component-list.mdtheme-tokens.md# From skill directory
cat references/theme-tokens.mdsetup_tailwind_shadcn.pypython scripts/setup_tailwind_shadcn.pytailwind.config.ts.templatepostcss.config.js.templateglobals.css.templatetheme-provider.tsxmode-toggle.tsxapp-shell.tsxlib/utils.tsapp/layout.tsx.templateapp/page.tsx.templateapp/examples/forms/app/examples/dialogs/app/examples/theme/[OK] Good (semantic)
<div className="bg-primary text-primary-foreground">
[ERROR] Bad (hard-coded)
<div className="bg-blue-600 text-white">interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
variant?: 'default' | 'destructive' | 'outline'
}aria-label--primaryapp/globals.cssnpx shadcn-ui add [component]references/shadcn-component-list.mdscreenstailwind.config.tseslint-plugin-jsx-a11ynpm run build
npm start