Skip to content

Skills for Claude Code CLI such as full stack dev Cloudflare, React, Tailwind v4, and AI integrations.

refactor: inline critical references into tailwind-theme-builder SKILL.md

Marcus Webb30bc1fd7369f
diff --git a/plugins/frontend/skills/tailwind-theme-builder/SKILL.md b/plugins/frontend/skills/tailwind-theme-builder/SKILL.md
index 2cdf893a..b663c564 100644
--- a/plugins/frontend/skills/tailwind-theme-builder/SKILL.md
+++ b/plugins/frontend/skills/tailwind-theme-builder/SKILL.md
@@ -13,6 +13,35 @@ compatibility: claude-code-only
Set up a fully themed Tailwind v4 + shadcn/ui project with dark mode. Produces configured CSS, theme provider, and working component library.
+## Architecture: The Four-Step Pattern
+
+Tailwind v4 requires a specific architecture for CSS variable-based theming. This pattern is **mandatory** -- skipping or modifying steps breaks the theme.
+
+### How It Works
+
+```
+CSS Variable Definition --> @theme inline Mapping --> Tailwind Utility Class
+--background --> --color-background --> bg-background
+(with hsl() wrapper) (references variable) (generated class)
+```
+
+Dark mode switching:
+```
+ThemeProvider toggles .dark class on <html>
+ --> CSS variables update automatically (.dark overrides :root)
+ --> Tailwind utilities reference updated variables
+ --> UI updates without re-render
+```
+
+### Best Practices
+
+- **Semantic names:** Use `--primary` not `--blue-500`
+- **Foreground pairing:** Every background colour needs a foreground (`--primary` + `--primary-foreground`)
+- **WCAG contrast:** Normal text 4.5:1, large text 3:1, UI components 3:1
+- **Chart colours:** Use separate variables with `@theme inline` mapping, reference via `var(--chart-1)` in style props
+
+---
+
## Workflow
### Step 1: Install Dependencies
@@ -85,7 +114,7 @@ This exact order is required. Skipping steps breaks the theme.
}
```
-**Result:** `bg-background`, `text-primary` etc. work automatically. Dark mode switches via `.dark` class — no `dark:` variants needed for semantic colours.
+**Result:** `bg-background`, `text-primary` etc. work automatically. Dark mode switches via `.dark` class -- no `dark:` variants needed for semantic colours.
### Step 4: Set Up Dark Mode
@@ -101,12 +130,45 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
)
```
-Add a theme toggle:
+Add a theme toggle -- install the dropdown menu then use the ModeToggle component below:
+
```bash
pnpm dlx shadcn@latest add dropdown-menu
```
-See `references/dark-mode.md` for the ModeToggle component.
+```typescript
+// src/components/mode-toggle.tsx
+import { Moon, Sun } from "lucide-react"
+import { Button } from "@/components/ui/button"
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu"
+import { useTheme } from "@/components/theme-provider"
+
+export function ModeToggle() {
+ const { setTheme } = useTheme()
+
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="outline" size="icon">
+ <Sun className="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
+ <Moon className="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
+ <span className="sr-only">Toggle theme</span>
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem onClick={() => setTheme("light")}>Light</DropdownMenuItem>
+ <DropdownMenuItem onClick={() => setTheme("dark")}>Dark</DropdownMenuItem>
+ <DropdownMenuItem onClick={() => setTheme("system")}>System</DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
+```
### Step 5: Configure components.json
@@ -121,7 +183,7 @@ See `references/dark-mode.md` for the ModeToggle component.
}
```
-`"config": ""` is critical — v4 doesn't use tailwind.config.ts.
+`"config": ""` is critical -- v4 doesn't use tailwind.config.ts.
---
@@ -141,33 +203,217 @@ See `references/dark-mode.md` for the ModeToggle component.
---
-## Common Errors
+## All 18 Gotchas
+
+### Quick Diagnosis
+
+| # | Symptom | Cause | Fix |
+|---|---------|-------|-----|
+| 1 | Variables ignored / theme broken | `:root` inside `@layer base` | Move `:root` and `.dark` to root level |
+| 2 | Dark mode colours not switching | `.dark { @theme { } }` | Use CSS variables + single `@theme inline` |
+| 3 | Colours all black/white | Double `hsl()` wrapping | Use `var(--background)` not `hsl(var(...))` |
+| 4 | `bg-primary` not generated | Colours in `tailwind.config.ts` | Delete config, use `@theme inline` |
+| 5 | `bg-background` class missing | No `@theme inline` block | Add `@theme inline` mapping variables |
+| 6 | shadcn components break | `components.json` has config path | Set `"config": ""` (empty string) |
+| 7 | Tailwind not processing | Using PostCSS plugin | Switch to `@tailwindcss/vite` plugin |
+| 8 | `@/` imports fail | Missing path aliases | Add `paths` to `tsconfig.app.json` |
+| 9 | Redundant `dark:` variants | Using `dark:bg-primary-dark` | Just use `bg-primary` -- variables handle it |
+| 10 | Hardcoded colours everywhere | Using `bg-blue-600 dark:bg-blue-400` | Use semantic tokens: `bg-primary` |
+| 11 | Class merging bugs | String concatenation for classes | Use `cn()` from `@/lib/utils` |
+| 12 | Radix Select crashes | Empty string value `value=""` | Use `value="placeholder"` |
+| 13 | Wrong Tailwind version | Installed `tailwindcss@^3` | Install `tailwindcss@^4.1.0` + `@tailwindcss/vite` |
+| 14 | Missing peer deps | Only installed `tailwindcss` | Also install `clsx`, `tailwind-merge`, `@types/node` |
+| 15 | Broken in dark mode | Only tested light mode | Test light, dark, system, and toggle transitions |
+| 16 | Fails WCAG contrast | Looks fine visually | Check ratios: 4.5:1 normal text, 3:1 large/UI |
+| 17 | Build fails on animation import | Using `tailwindcss-animate` (deprecated) | Use `tw-animate-css` or native CSS animations |
+| 18 | CSS priority issues | Duplicate `@layer base` after shadcn init | Merge into single `@layer base` block |
+
+### Gotcha Details with Code Examples
+
+**#1 -- :root inside @layer base**
+
+Tailwind v4 strips CSS outside `@theme`/`@layer`, but `:root` must be at root level to persist. This is the most common setup failure.
+
+WRONG:
+```css
+@layer base {
+ :root { --background: hsl(0 0% 100%); }
+}
+```
+
+CORRECT:
+```css
+:root { --background: hsl(0 0% 100%); }
+@layer base {
+ body { background-color: var(--background); }
+}
+```
+
+**#2 -- Nested @theme**
+
+Tailwind v4 does not support `@theme` inside selectors. Use CSS variables in `:root`/`.dark` with a single `@theme inline` block.
+
+WRONG:
+```css
+@theme { --color-primary: hsl(0 0% 0%); }
+.dark { @theme { --color-primary: hsl(0 0% 100%); } }
+```
+
+CORRECT:
+```css
+:root { --primary: hsl(0 0% 0%); }
+.dark { --primary: hsl(0 0% 100%); }
+@theme inline { --color-primary: var(--primary); }
+```
+
+**#3 -- Double hsl() wrapping**
+
+Variables already contain `hsl()`. Double-wrapping creates `hsl(hsl(...))`.
+
+WRONG: `background-color: hsl(var(--background));`
+CORRECT: `background-color: var(--background);`
+
+**#4 -- Colours in tailwind.config.ts**
+
+Tailwind v4 completely ignores `theme.extend.colors` in config files. Delete the file or leave it empty. Set `"config": ""` in `components.json`.
+
+**#5 -- Missing @theme inline**
+
+Without `@theme inline`, Tailwind has no knowledge of your CSS variables. Utility classes like `bg-background` simply won't be generated.
+
+WRONG:
+```css
+:root { --background: hsl(0 0% 100%); }
+/* No @theme inline block -- bg-background won't exist */
+```
+
+CORRECT:
+```css
+:root { --background: hsl(0 0% 100%); }
+@theme inline { --color-background: var(--background); }
+```
+
+**#7 -- PostCSS vs Vite plugin**
-| Symptom | Cause | Fix |
-|---------|-------|-----|
-| `bg-primary` doesn't work | Missing `@theme inline` | Add `@theme inline` block |
-| Colours all black/white | Double `hsl()` wrapping | Use `var(--colour)` not `hsl(var(--colour))` |
-| Dark mode not switching | Missing ThemeProvider | Wrap app in `<ThemeProvider>` |
-| Build fails | `tailwind.config.ts` exists | Delete the file |
-| Animation errors | Using `tailwindcss-animate` | Install `tw-animate-css` instead |
-| `@apply` fails on custom class | v4 breaking change | Use `@utility` instead of `@layer components` |
+WRONG:
+```typescript
+export default defineConfig({
+ css: { postcss: './postcss.config.js' } // Old v3 way
+})
+```
+
+CORRECT:
+```typescript
+import tailwindcss from '@tailwindcss/vite'
+export default defineConfig({
+ plugins: [react(), tailwindcss()] // v4 way
+})
+```
+
+**#8 -- Path aliases**
+
+Add to `tsconfig.app.json`:
+```json
+{
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": { "@/*": ["./src/*"] }
+ }
+}
+```
+
+**#11 -- cn() utility for class merging**
+
+WRONG: `` className={`base ${isActive && 'active'}`} ``
+CORRECT: `className={cn("base", isActive && "active")}`
+
+`cn()` from `@/lib/utils` properly merges and deduplicates Tailwind classes.
+
+**#12 -- Radix Select empty value**
+
+Radix UI Select does not allow empty string values. Use `value="placeholder"` instead of `value=""`.
+
+**#14 -- Required dependencies**
+
+```json
+{
+ "dependencies": {
+ "tailwindcss": "^4.1.0",
+ "@tailwindcss/vite": "^4.1.0",
+ "clsx": "^2.1.1",
+ "tailwind-merge": "^3.3.1"
+ },
+ "devDependencies": {
+ "@types/node": "^24.0.0"
+ }
+}
+```
+
+**#17 -- tw-animate-css**
+
+`tailwindcss-animate` is deprecated in Tailwind v4. shadcn/ui docs may still reference it. Causes build failures and import errors. Use `tw-animate-css` or `@tailwindcss/motion` instead.
+
+**#18 -- Duplicate @layer base after shadcn init**
+
+`shadcn init` adds its own `@layer base` block. Check `src/index.css` immediately after running init and merge any duplicate blocks into one.
+
+WRONG:
+```css
+@layer base { body { background-color: var(--background); } }
+@layer base { * { border-color: hsl(var(--border)); } } /* duplicate from shadcn */
+```
-See `references/common-gotchas.md` for detailed error explanations with sources.
+CORRECT:
+```css
+@layer base {
+ * { border-color: var(--border); }
+ body { background-color: var(--background); color: var(--foreground); }
+}
+```
+
+### Prevention Checklist
+
+- [ ] No `tailwind.config.ts` file (or it's empty)
+- [ ] `components.json` has `"config": ""`
+- [ ] All colors have `hsl()` wrapper in `:root`
+- [ ] `@theme inline` maps all variables
+- [ ] `@layer base` doesn't wrap `:root`
+- [ ] Theme provider wraps app
+- [ ] Tested in light, dark, and system modes
+- [ ] All text has sufficient contrast
+
+---
+
+## Dark Mode Testing Checklist
+
+- [ ] Light mode displays correctly
+- [ ] Dark mode displays correctly
+- [ ] System mode respects OS setting
+- [ ] Theme persists after page refresh
+- [ ] Toggle component shows current state
+- [ ] All text has proper contrast
+- [ ] No flash of wrong theme on load
+- [ ] Works in incognito mode (graceful fallback)
---
## Asset Files
Copy from `assets/` directory:
-- `index.css` — Complete CSS with all colour variables
-- `components.json` — shadcn/ui v4 config
-- `vite.config.ts` — Vite + Tailwind plugin
-- `theme-provider.tsx` — Dark mode provider
-- `utils.ts` — `cn()` utility
+- `index.css` -- Complete CSS with all colour variables
+- `components.json` -- shadcn/ui v4 config
+- `vite.config.ts` -- Vite + Tailwind plugin
+- `theme-provider.tsx` -- Dark mode provider
+- `utils.ts` -- `cn()` utility
## Reference Files
-- `references/common-gotchas.md` — 8 documented errors with GitHub sources
-- `references/dark-mode.md` — Complete dark mode implementation
-- `references/architecture.md` — Deep dive into 4-step pattern
-- `references/migration-guide.md` — v3 to v4 migration
+- `references/migration-guide.md` -- v3 to v4 migration
+
+## Official Documentation
+
+- shadcn/ui Tailwind v4 Guide: https://ui.shadcn.com/docs/tailwind-v4
+- shadcn/ui Dark Mode (Vite): https://ui.shadcn.com/docs/dark-mode/vite
+- shadcn/ui Theming: https://ui.shadcn.com/docs/theming
+- Tailwind v4 Docs: https://tailwindcss.com/docs
+- Tailwind Dark Mode: https://tailwindcss.com/docs/dark-mode
diff --git a/plugins/frontend/skills/tailwind-theme-builder/references/architecture.md b/plugins/frontend/skills/tailwind-theme-builder/references/architecture.md
deleted file mode 100644
index 90f6f881..00000000
--- a/plugins/frontend/skills/tailwind-theme-builder/references/architecture.md
+++ /dev/null
@@ -1,206 +0,0 @@
-# Tailwind v4 + shadcn/ui Theming Architecture
-
-## The Four-Step Pattern
-
-Tailwind v4 requires a specific architecture for CSS variable-based theming. This pattern is **mandatory** - skipping or modifying steps will break your theme.
-
-### Step 1: Define CSS Variables at Root Level
-
-```css
-:root {
- --background: hsl(0 0% 100%);
- --foreground: hsl(222.2 84% 4.9%);
- /* ... more colors */
-}
-
-.dark {
- --background: hsl(222.2 84% 4.9%);
- --foreground: hsl(210 40% 98%);
- /* ... dark mode colors */
-}
-```
-
-**Critical Rules:**
-- ✅ Define at root level (NOT inside `@layer base`)
-- ✅ Use `hsl()` wrapper on all color values
-- ✅ Use `.dark` for dark mode overrides (NOT `.dark { @theme { } }`)
-- ❌ Never put `:root` or `.dark` inside `@layer base`
-
-### Step 2: Map Variables to Tailwind Utilities
-
-```css
-@theme inline {
- --color-background: var(--background);
- --color-foreground: var(--foreground);
- /* ... map all CSS variables */
-}
-```
-
-**Why This Is Required:**
-- Tailwind v4 doesn't read `tailwind.config.ts` for colors
-- `@theme inline` generates utility classes (`bg-background`, `text-foreground`)
-- Without this, utilities like `bg-primary` won't exist
-
-### Step 3: Apply Base Styles
-
-```css
-@layer base {
- body {
- background-color: var(--background); /* NO hsl() wrapper here */
- color: var(--foreground);
- }
-}
-```
-
-**Critical Rules:**
-- ✅ Reference variables directly: `var(--background)`
-- ❌ Never double-wrap: `hsl(var(--background))` (already has hsl)
-
-### Step 4: Result - Automatic Dark Mode
-
-With this architecture:
-- `<div className="bg-background text-foreground">` works automatically
-- No `dark:` variants needed in components
-- Theme switches via `.dark` class on `<html>`
-- Single source of truth for all colors
-
----
-
-## Why This Architecture Works
-
-### Color Variable Flow
-
-```
-CSS Variable Definition → @theme inline Mapping → Tailwind Utility Class
---background → --color-background → bg-background
-(with hsl() wrapper) (references variable) (generated class)
-```
-
-### Dark Mode Switching
-
-```
-ThemeProvider toggles `.dark` class on <html>
- ↓
-CSS variables update automatically (.dark overrides)
- ↓
-Tailwind utilities reference updated variables
- ↓
-UI updates without re-render
-```
-
----
-
-## Common Mistakes
-
-### ❌ Mistake 1: Variables Inside @layer base
-
-```css
-/* WRONG */
-@layer base {
- :root {
- --background: hsl(0 0% 100%);
- }
-}
-```
-
-**Why It Fails:** Tailwind v4 strips CSS outside `@theme`/`@layer`, but `:root` must be at root level to persist.
-
-### ❌ Mistake 2: Using .dark { @theme { } }
-
-```css
-/* WRONG */
-@theme {
- --color-primary: hsl(0 0% 0%);
-}
-
-.dark {
- @theme {
- --color-primary: hsl(0 0% 100%);
- }
-}
-```
-
-**Why It Fails:** Tailwind v4 doesn't support nested `@theme` directives.
-
-### ❌ Mistake 3: Double hsl() Wrapping
-
-```css
-/* WRONG */
-@layer base {
- body {
- background-color: hsl(var(--background));
- }
-}
-```
-
-**Why It Fails:** `--background` already contains `hsl()`, results in `hsl(hsl(...))`.
-
-### ❌ Mistake 4: Config-Based Colors
-
-```typescript
-// WRONG (tailwind.config.ts)
-export default {
- theme: {
- extend: {
- colors: {
- primary: 'hsl(var(--primary))'
- }
- }
- }
-}
-```
-
-**Why It Fails:** Tailwind v4 completely ignores `theme.extend.colors` in config files.
-
----
-
-## Best Practices
-
-### 1. Semantic Color Names
-
-Use semantic names, not color values:
-```css
---primary /* ✅ Semantic */
---blue-500 /* ❌ Not semantic */
-```
-
-### 2. Foreground Pairing
-
-Every background color needs a foreground:
-```css
---primary: hsl(...);
---primary-foreground: hsl(...);
-```
-
-### 3. WCAG Contrast Ratios
-
-Ensure proper contrast:
-- Normal text: 4.5:1 minimum
-- Large text: 3:1 minimum
-- UI components: 3:1 minimum
-
-### 4. Chart Colors
-
-Charts need separate variables (don't use hsl wrapper in components):
-```css
-:root {
- --chart-1: hsl(12 76% 61%);
-}
-
-@theme inline {
- --color-chart-1: var(--chart-1);
-}
-```
-
-Use in components:
-```tsx
-<div style={{ backgroundColor: 'var(--chart-1)' }} />
-```
-
----
-
-## Official Documentation
-
-- shadcn/ui Tailwind v4 Guide: https://ui.shadcn.com/docs/tailwind-v4
-- Tailwind v4 Docs: https://tailwindcss.com/docs
-- shadcn/ui Theming: https://ui.shadcn.com/docs/theming
diff --git a/plugins/frontend/skills/tailwind-theme-builder/references/common-gotchas.md b/plugins/frontend/skills/tailwind-theme-builder/references/common-gotchas.md
deleted file mode 100644
index f876df15..00000000
--- a/plugins/frontend/skills/tailwind-theme-builder/references/common-gotchas.md
+++ /dev/null
@@ -1,469 +0,0 @@
-# Common Gotchas & Solutions
-
-## Critical Failures (Will Break Your Build)
-
-### 1. `:root` Inside `@layer base`
-
-❌ **WRONG:**
-```css
-@layer base {
- :root {
- --background: hsl(0 0% 100%);
- }
-}
-```
-
-✅ **CORRECT:**
-```css
-:root {
- --background: hsl(0 0% 100%);
-}
-
-@layer base {
- body {
- background-color: var(--background);
- }
-}
-```
-
-**Why:** Tailwind v4 strips CSS outside `@theme`/`@layer`, but `:root` must be at root level.
-
----
-
-### 2. Nested `@theme` Directive
-
-❌ **WRONG:**
-```css
-@theme {
- --color-primary: hsl(0 0% 0%);
-}
-
-.dark {
- @theme {
- --color-primary: hsl(0 0% 100%);
- }
-}
-```
-
-✅ **CORRECT:**
-```css
-:root {
- --primary: hsl(0 0% 0%);
-}
-
-.dark {
- --primary: hsl(0 0% 100%);
-}
-
-@theme inline {
- --color-primary: var(--primary);
-}
-```
-
-**Why:** Tailwind v4 doesn't support `@theme` inside selectors.
-
----
-
-### 3. Double `hsl()` Wrapping
-
-❌ **WRONG:**
-```css
-@layer base {
- body {
- background-color: hsl(var(--background));
- }
-}
-```
-
-✅ **CORRECT:**
-```css
-@layer base {
- body {
- background-color: var(--background); /* Already has hsl() */
- }
-}
-```
-
-**Why:** Variables already contain `hsl()`, double-wrapping creates `hsl(hsl(...))`.
-
----
-
-### 4. Colors in `tailwind.config.ts`
-
-❌ **WRONG:**
-```typescript
-// tailwind.config.ts
-export default {
- theme: {
- extend: {
- colors: {
- primary: 'hsl(var(--primary))'
- }
- }
- }
-}
-```
-
-✅ **CORRECT:**
-```typescript
-// Delete tailwind.config.ts entirely OR leave it empty
-export default {}
-
-// components.json
-{
- "tailwind": {
- "config": "" // ← Empty string
- }
-}
-```
-
-**Why:** Tailwind v4 completely ignores `theme.extend.colors`.
-
----
-
-### 5. Missing `@theme inline` Mapping
-
-❌ **WRONG:**
-```css
-:root {
- --background: hsl(0 0% 100%);
-}
-
-/* No @theme inline block */
-```
-
-Result: `bg-background` class doesn't exist
-
-✅ **CORRECT:**
-```css
-:root {
- --background: hsl(0 0% 100%);
-}
-
-@theme inline {
- --color-background: var(--background);
-}
-```
-
-**Why:** `@theme inline` generates the utility classes.
-
----
-
-## Configuration Gotchas
-
-### 6. Wrong components.json Config
-
-❌ **WRONG:**
-```json
-{
- "tailwind": {
- "config": "tailwind.config.ts" // ← No!
- }
-}
-```
-
-✅ **CORRECT:**
-```json
-{
- "tailwind": {
- "config": "" // ← Empty for v4
- }
-}
-```
-
----
-
-### 7. Using PostCSS Instead of Vite Plugin
-
-❌ **WRONG:**
-```typescript
-// vite.config.ts
-export default defineConfig({
- css: {
- postcss: './postcss.config.js' // Old v3 way
- }
-})
-```
-
-✅ **CORRECT:**
-```typescript
-import tailwindcss from '@tailwindcss/vite'
-
-export default defineConfig({
- plugins: [react(), tailwindcss()] // v4 way
-})
-```
-
----
-
-### 8. Missing Path Aliases
-
-❌ **WRONG:**
-```typescript
-// tsconfig.json has no paths
-import { Button } from '../../components/ui/button'
-```
-
-✅ **CORRECT:**
-```json
-// tsconfig.app.json
-{
- "compilerOptions": {
- "baseUrl": ".",
- "paths": {
- "@/*": ["./src/*"]
- }
- }
-}
-```
-
-```typescript
-import { Button } from '@/components/ui/button'
-```
-
----
-
-## Color System Gotchas
-
-### 9. Using `dark:` Variants for Semantic Colors
-
-❌ **WRONG:**
-```tsx
-<div className="bg-primary dark:bg-primary-dark" />
-```
-
-✅ **CORRECT:**
-```tsx
-<div className="bg-primary" />
-```
-
-**Why:** With proper CSS variable setup, `bg-primary` automatically responds to theme.
-
----
-
-### 10. Hardcoded Color Values
-
-❌ **WRONG:**
-```tsx
-<div className="bg-blue-600 dark:bg-blue-400" />
-```
-
-✅ **CORRECT:**
-```tsx
-<div className="bg-primary" /> {/* Or bg-info, bg-success, etc. */}
-```
-
-**Why:** Semantic tokens enable theme switching and reduce repetition.
-
----
-
-## Component Gotchas
-
-### 11. Missing `cn()` Utility
-
-❌ **WRONG:**
-```tsx
-<div className={`base ${isActive && 'active'}`} />
-```
-
-✅ **CORRECT:**
-```tsx
-import { cn } from '@/lib/utils'
-<div className={cn("base", isActive && "active")} />
-```
-
-**Why:** `cn()` properly merges and deduplicates Tailwind classes.
-
----
-
-### 12. Empty String in Radix Select
-
-❌ **WRONG:**
-```tsx
-<SelectItem value="">Select an option</SelectItem>
-```
-
-✅ **CORRECT:**
-```tsx
-<SelectItem value="placeholder">Select an option</SelectItem>
-```
-
-**Why:** Radix UI Select doesn't allow empty string values.
-
----
-
-## Installation Gotchas
-
-### 13. Wrong Tailwind Package
-
-❌ **WRONG:**
-```bash
-npm install tailwindcss@^3.4.0 # v3
-```
-
-✅ **CORRECT:**
-```bash
-npm install tailwindcss@^4.1.0 # v4
-npm install @tailwindcss/vite
-```
-
----
-
-### 14. Missing Dependencies
-
-❌ **WRONG:**
-```json
-{
- "dependencies": {
- "tailwindcss": "^4.1.0"
- // Missing @tailwindcss/vite
- }
-}
-```
-
-✅ **CORRECT:**
-```json
-{
- "dependencies": {
- "tailwindcss": "^4.1.0",
- "@tailwindcss/vite": "^4.1.0",
- "clsx": "^2.1.1",
- "tailwind-merge": "^3.3.1"
- },
- "devDependencies": {
- "@types/node": "^24.0.0"
- }
-}
-```
-
----
-
-### 17. tw-animate-css Import Error (REAL-WORLD ISSUE)
-
-❌ **WRONG:**
-```bash
-npm install tailwindcss-animate # Deprecated package
-```
-
-```css
-@import "tw-animate-css"; # Package doesn't exist in v4
-```
-
-✅ **CORRECT:**
-```bash
-# Don't install tailwindcss-animate at all
-# Use native CSS animations or @tailwindcss/motion
-```
-
-**Why:**
-- `tailwindcss-animate` is deprecated in Tailwind v4
-- Causes import errors during build
-- shadcn/ui docs may still reference it (outdated)
-- The skill handles animations differently in v4
-
-**Impact:** Build failure, requires manual CSS file cleanup
-
----
-
-### 18. Duplicate @layer base After shadcn init (REAL-WORLD ISSUE)
-
-❌ **WRONG:**
-```css
-/* After running shadcn init, you might have: */
-@layer base {
- body {
- background-color: var(--background);
- }
-}
-
-@layer base { /* ← Duplicate added by shadcn init */
- * {
- border-color: hsl(var(--border));
- }
-}
-```
-
-✅ **CORRECT:**
-```css
-/* Merge into single @layer base block */
-@layer base {
- * {
- border-color: var(--border);
- }
-
- body {
- background-color: var(--background);
- color: var(--foreground);
- }
-}
-```
-
-**Why:**
-- `shadcn init` adds its own `@layer base` block
-- Results in duplicate layer declarations
-- Can cause unexpected CSS priority issues
-- Easy to miss during setup
-
-**Prevention:**
-- Check `src/index.css` immediately after running `shadcn init`
-- Merge any duplicate `@layer base` blocks
-- Keep only one base layer section
-
-**Impact:** CSS priority issues, harder to debug styling problems
-
----
-
-## Testing Gotchas
-
-### 15. Not Testing Both Themes
-
-❌ **WRONG:**
-Only testing in light mode
-
-✅ **CORRECT:**
-Test in:
-- Light mode
-- Dark mode
-- System mode
-- Both initial load and toggle
-
----
-
-### 16. Not Checking Contrast
-
-❌ **WRONG:**
-Colors look good but fail WCAG
-
-✅ **CORRECT:**
-- Use browser DevTools Lighthouse
-- Check contrast ratios (4.5:1 minimum)
-- Test with actual users
-
----
-
-## Quick Diagnosis
-
-**Symptoms → Likely Cause:**
-
-| Symptom | Likely Cause |
-|---------|-------------|
-| `bg-primary` doesn't work | Missing `@theme inline` mapping |
-| Colors all black/white | Double `hsl()` wrapping |
-| Dark mode not switching | Missing ThemeProvider |
-| Build fails | `tailwind.config.ts` exists with theme config |
-| Text invisible | Wrong contrast colors |
-| `@/` imports fail | Missing path aliases in tsconfig |
-
----
-
-## Prevention Checklist
-
-Before deploying:
-- [ ] No `tailwind.config.ts` file (or it's empty)
-- [ ] `components.json` has `"config": ""`
-- [ ] All colors have `hsl()` wrapper in `:root`
-- [ ] `@theme inline` maps all variables
-- [ ] `@layer base` doesn't wrap `:root`
-- [ ] Theme provider wraps app
-- [ ] Tested in both light and dark modes
-- [ ] All text has sufficient contrast
diff --git a/plugins/frontend/skills/tailwind-theme-builder/references/dark-mode.md b/plugins/frontend/skills/tailwind-theme-builder/references/dark-mode.md
deleted file mode 100644
index 5c5008e9..00000000
--- a/plugins/frontend/skills/tailwind-theme-builder/references/dark-mode.md
+++ /dev/null
@@ -1,239 +0,0 @@
-# Dark Mode Implementation
-
-## Overview
-
-Tailwind v4 + shadcn/ui dark mode requires:
-1. `ThemeProvider` component to manage state
-2. `.dark` class toggling on `<html>` element
-3. localStorage persistence
-4. System theme detection
-
----
-
-## ThemeProvider Component
-
-### Full Implementation
-
-```typescript
-// src/components/theme-provider.tsx
-import { createContext, useContext, useEffect, useState, ReactNode } from 'react'
-
-type Theme = 'dark' | 'light' | 'system'
-
-type ThemeProviderProps = {
- children: ReactNode
- defaultTheme?: Theme
- storageKey?: string
-}
-
-type ThemeProviderState = {
- theme: Theme
- setTheme: (theme: Theme) => void
-}
-
-const initialState: ThemeProviderState = {
- theme: 'system',
- setTheme: () => null,
-}
-
-const ThemeProviderContext = createContext<ThemeProviderState>(initialState)
-
-export function ThemeProvider({
- children,
- defaultTheme = 'system',
- storageKey = 'vite-ui-theme',
- ...props
-}: ThemeProviderProps) {
- const [theme, setTheme] = useState<Theme>(() => {
- try {
- return (localStorage.getItem(storageKey) as Theme) || defaultTheme
- } catch (e) {
- return defaultTheme
- }
- })
-
- useEffect(() => {
- const root = window.document.documentElement
- root.classList.remove('light', 'dark')
-
- if (theme === 'system') {
- const systemTheme = window.matchMedia('(prefers-color-scheme: dark)')
- .matches ? 'dark' : 'light'
- root.classList.add(systemTheme)
- return
- }
-
- root.classList.add(theme)
- }, [theme])
-
- const value = {
- theme,
- setTheme: (theme: Theme) => {
- try {
- localStorage.setItem(storageKey, theme)
- } catch (e) {
- console.warn('Storage unavailable')
- }
- setTheme(theme)
- },
- }
-
- return (
- <ThemeProviderContext.Provider {...props} value={value}>
- {children}
- </ThemeProviderContext.Provider>
- )
-}
-
-export const useTheme = () => {
- const context = useContext(ThemeProviderContext)
- if (context === undefined)
- throw new Error('useTheme must be used within a ThemeProvider')
- return context
-}
-```
-
-### Wrap Your App
-
-```typescript
-// src/main.tsx
-import { ThemeProvider } from '@/components/theme-provider'
-
-ReactDOM.createRoot(document.getElementById('root')!).render(
- <React.StrictMode>
- <ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
- <App />
- </ThemeProvider>
- </React.StrictMode>,
-)
-```
-
----
-
-## Theme Toggle Component
-
-### Using shadcn/ui Dropdown Menu
-
-```bash
-pnpm dlx shadcn@latest add dropdown-menu
-```
-
-```typescript
-// src/components/mode-toggle.tsx
-import { Moon, Sun } from "lucide-react"
-import { Button } from "@/components/ui/button"
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from "@/components/ui/dropdown-menu"
-import { useTheme } from "@/components/theme-provider"
-
-export function ModeToggle() {
- const { setTheme } = useTheme()
-
- return (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="outline" size="icon">
- <Sun className="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
- <Moon className="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
- <span className="sr-only">Toggle theme</span>
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuItem onClick={() => setTheme("light")}>
- Light
- </DropdownMenuItem>
- <DropdownMenuItem onClick={() => setTheme("dark")}>
- Dark
- </DropdownMenuItem>
- <DropdownMenuItem onClick={() => setTheme("system")}>
- System
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- )
-}
-```
-
----
-
-## How It Works
-
-### Theme Flow
-
-```
-User selects theme → setTheme() called
- ↓
-Save to localStorage
- ↓
-Update state
- ↓
-useEffect triggers
- ↓
-Remove existing classes (.light, .dark)
- ↓
-Add new class to <html>
- ↓
-CSS variables update (.dark overrides :root)
- ↓
-UI updates automatically
-```
-
-### System Theme Detection
-
-```typescript
-if (theme === 'system') {
- const systemTheme = window.matchMedia('(prefers-color-scheme: dark)')
- .matches ? 'dark' : 'light'
- root.classList.add(systemTheme)
-}
-```
-
-This respects the user's OS preference when "System" is selected.
-
----
-
-## Common Issues
-
-### Issue: Dark mode not switching
-
-**Cause:** Theme provider not wrapping app
-**Fix:** Ensure `<ThemeProvider>` wraps your app in `main.tsx`
-
-### Issue: Theme resets on page refresh
-
-**Cause:** localStorage not working
-**Fix:** Check browser privacy settings, add sessionStorage fallback
-
-### Issue: Flash of wrong theme on load
-
-**Cause:** Theme applied after initial render
-**Fix:** Add inline script to `index.html` (advanced)
-
-### Issue: Icons not changing
-
-**Cause:** CSS transitions not working
-**Fix:** Verify icon classes use `dark:` variants for animations
-
----
-
-## Testing Checklist
-
-- [ ] Light mode displays correctly
-- [ ] Dark mode displays correctly
-- [ ] System mode respects OS setting
-- [ ] Theme persists after page refresh
-- [ ] Toggle component shows current state
-- [ ] All text has proper contrast
-- [ ] No flash of wrong theme on load
-- [ ] Works in incognito mode (graceful fallback)
-
----
-
-## Official Documentation
-
-- shadcn/ui Dark Mode (Vite): https://ui.shadcn.com/docs/dark-mode/vite
-- Tailwind Dark Mode: https://tailwindcss.com/docs/dark-mode