{"id":"5f03aa31-24b2-4593-9db9-9212bc0cc0e0","shortId":"TjV6YC","kind":"skill","title":"tailwind-css","tagline":">-","description":"# Tailwind CSS v4\n\n**Verify before implementing**: For v4-specific syntax (`@theme`, `@variant`, CSS-first config), search current docs via `search_docs` before writing code. Tailwind v4 changed significantly from v3 and training data may be stale.\n\n## CSS-First Configuration\n\nv4 eliminates `tailwind.config.ts`. All configuration lives in CSS.\n\n| Directive | Purpose |\n|-----------|---------|\n| `@import \"tailwindcss\"` | Entry point (replaces `@tailwind base/components/utilities`) |\n| `@theme { }` | Define/extend design tokens -- auto-generates utility classes |\n| `@theme inline { }` | Map CSS variables to Tailwind utilities without generating new vars |\n| `@theme static { }` | Define tokens that don't generate utilities |\n| `@utility name { }` | Create custom utilities (replaces `@layer components` + `@apply`) |\n| `@custom-variant name (selector)` | Define custom variants |\n\n```css\n@import \"tailwindcss\";\n\n@theme {\n  --color-brand: oklch(0.72 0.11 178);\n  --font-display: \"Inter\", sans-serif;\n  --animate-fade-in: fade-in 0.2s ease-out;\n  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }\n}\n\n@custom-variant dark (&:where(.dark, .dark *));\n```\n\nTokens defined with `@theme` become utilities automatically: `--color-brand` produces `bg-brand`, `text-brand`, `border-brand`. Define z-index as tokens (`--z-modal: 50`) and reference via `z-(--z-modal)` instead of arbitrary `z-50`.\n\n**CSS Modules**: when using `.module.css` with Tailwind v4, add `@reference \"#tailwind\";` at the top of the module file to enable theme token access inside the module.\n\n**Animations (tw-animate-css)**: use `animate-in`/`animate-out` base classes combined with effect classes (`fade-in`, `slide-in-from-top`). Decimal spacing gotcha: use bracket notation `[0.625rem]` instead of fractional values like `2.5`.\n\n## v3 to v4 Migration\n\nFor projects upgrading from v3 to v4, see [v3-to-v4-migration.md](./references/v3-to-v4-migration.md) for the full breaking-change table and codemod guidance. For greenfield v4 work, current patterns are above.\n\n## Coding Rules\n\n- **`gap` over `space-x`/`space-y`** -- gap handles wrapping; space-* breaks on wrap\n- **`size-*` over `w-* h-*`** -- for equal dimensions\n- **`min-h-dvh` over `min-h-screen`** -- dvh accounts for mobile browser chrome\n- **Opacity modifier** (`bg-black/50`) -- `*-opacity-*` utilities are removed in v4\n- **Design tokens over arbitrary values** -- check `@theme` before using `[#hex]`\n- **Never construct classes dynamically** -- `text-${color}-500` won't be detected; use complete class names\n- **`@utility` over `@apply` with `@layer`** -- `@apply` on `@layer` classes fails in v4\n- **Parent padding over last-child margin** -- use padding on containers instead of bottom margins on the last child\n\n## ESLint Integration\n\nUse `eslint-plugin-better-tailwindcss` for automated class validation:\n- `no-conflicting-classes` -- catches `text-red-500 text-blue-500`\n- `no-unknown-classes` -- flags typos\n- `enforce-canonical-classes` -- normalizes shorthand\n- `no-duplicate-classes` -- removes redundant entries\n- `no-deprecated-classes` -- catches v3 classes removed in v4\n- `useSortedClasses` -- enforces canonical class order; configure `attributes: [\"classList\"]` and `functions: [\"clsx\", \"cva\", \"cn\", \"tv\", \"tw\"]` to cover JSX utility functions\n\n## Class Merging\n\nUse `cn()` combining `clsx` + `tailwind-merge` for conditional/dynamic classes. Use plain strings for static `className` attributes.\n\n```typescript\nimport { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\nexport function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); }\n```\n\n```typescript\n// Static: plain string\n<button className=\"rounded-lg px-4 py-2 font-medium bg-blue-600\">\n\n// Conditional: use cn()\n<button className={cn(\"rounded-lg px-4 py-2\", isActive ? \"bg-blue-600\" : \"bg-gray-700\")} />\n```\n\n## Component Variants\n\nUse `tailwind-variants` (`tv()`) for type-safe variant components. Alternative: `class-variance-authority` (`cva()`).\n\n```typescript\nimport { tv } from \"tailwind-variants\";\nconst button = tv({\n  base: \"rounded-lg px-4 py-2 font-medium transition-colors\",\n  variants: {\n    color: { primary: \"bg-blue-600 text-white\", secondary: \"bg-gray-200 text-gray-800\" },\n    size: { sm: \"text-sm px-3 py-1\", md: \"text-base\", lg: \"text-lg px-6 py-3\" },\n  },\n  defaultVariants: { color: \"primary\", size: \"md\" },\n});\n```\n\nSee [tailwind-variants patterns](./references/component-patterns.md) for slots, composition, and responsive variants.\n\n## Common Errors\n\n| Symptom | Fix |\n|---------|-----|\n| `bg-primary` doesn't work | Add `@theme inline { --color-primary: var(--primary); }` |\n| Colors all black/white | Double `hsl()` wrapping -- use `var(--color)` not `hsl(var(--color))` |\n| `@apply` fails on custom class | Use `@utility` instead of `@layer components` |\n| Build fails after migration | Delete `tailwind.config.ts` |\n| Animations broken | Replace `tailwindcss-animate` with `tw-animate-css` |\n| `.dark { @theme { } }` fails | v4 does not support nested `@theme` -- use `:root`/`.dark` CSS vars mapped via `@theme inline` |\n\n## Dark Mode (v4 Pattern)\n\n```css\n:root { --background: hsl(0 0% 100%); --foreground: hsl(222 84% 4.9%); }\n.dark { --background: hsl(222 84% 4.9%); --foreground: hsl(210 40% 98%); }\n@theme inline { --color-background: var(--background); --color-foreground: var(--foreground); }\n```\n\nSemantic classes (`bg-background`, `text-foreground`) auto-switch -- no `dark:` variants needed for themed colors.\n\n## Verify\n\n- Build passes with zero errors (`npm run build` or equivalent)\n- No v3 class names remain in changed files (check with `@tailwindcss/upgrade --dry-run` if available)\n- No conflicting classes on the same element\n\n## References\n\n- [Component patterns](./references/component-patterns.md) -- tailwind-variants slots, CVA, compound components\n- [Layout patterns](./references/layout-patterns.md) -- grid areas, container queries, z-index management, fluid typography","tags":["tailwind","css","skills","iliaal","agent-skills","ai-coding-assistant","ai-tools","claude-code"],"capabilities":["skill","source-iliaal","skill-tailwind-css","topic-agent-skills","topic-ai-coding-assistant","topic-ai-tools","topic-claude-code","topic-skills"],"categories":["ai-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/iliaal/ai-skills/tailwind-css","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add iliaal/ai-skills","source_repo":"https://github.com/iliaal/ai-skills","install_from":"skills.sh"}},"qualityScore":"0.456","qualityRationale":"deterministic score 0.46 from registry signals: · indexed on github topic:agent-skills · 13 github stars · SKILL.md body (5,993 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:07:04.001Z","embedding":null,"createdAt":"2026-05-09T01:05:37.040Z","updatedAt":"2026-05-18T19:07:04.001Z","lastSeenAt":"2026-05-18T19:07:04.001Z","tsv":"'-1':615 '-2':535,581 '-3':613,627 '-4':533,579 '-50':198 '-500':364 '-6':625 '/50':341 '/references/component-patterns.md':638,816 '/references/layout-patterns.md':826 '/references/v3-to-v4-migration.md':278 '0':146,730,731 '0.11':119 '0.2':135 '0.625':257 '0.72':118 '1':149 '100':732 '178':120 '2.5':264 '200':602 '210':746 '222':735,741 '4.9':737,743 '40':747 '50':186 '500':424,428 '600':540,594 '700':544 '800':606 '84':736,742 '98':748 'access':221 'account':331 'add':207,655 'altern':558 'anim':129,225,228,232,235,693,698,702 'animate-fade-in':128 'animate-in':231 'animate-out':234 'appli':101,375,378,676 'arbitrari':196,351 'area':828 'attribut':464,496 'author':562 'auto':68,770 'auto-gener':67 'auto-switch':769 'autom':413 'automat':163 'avail':805 'background':728,739,753,755,765 'base':237,574,619 'base/components/utilities':62 'becom':161 'better':410 'bg':169,339,538,542,592,600,650,764 'bg-background':763 'bg-black':338 'bg-blue':537,591 'bg-brand':168 'bg-gray':541,599 'bg-primari':649 'black':340 'black/white':665 'blue':427,539,593 'border':175 'border-brand':174 'bottom':398 'bracket':255 'brand':116,166,170,173,176 'break':283,311 'breaking-chang':282 'broken':694 'browser':334 'build':687,780,787 'button':526,572 'canon':437,460 'catch':420,452 'chang':32,284,796 'check':353,798 'child':390,403 'chrome':335 'class':71,238,242,360,371,381,414,419,432,438,444,451,454,461,478,489,560,680,762,792,808 'class-variance-author':559 'classlist':465 'classnam':495,527 'classvalu':500,514 'clsx':468,483,501,503,517 'cn':470,481,512,525,528 'code':29,297 'codemod':287 'color':115,165,363,587,589,629,659,663,671,675,752,757,778 'color-background':751 'color-brand':114,164 'color-foreground':756 'color-primari':658 'combin':239,482 'common':645 'complet':370 'compon':100,545,557,686,814,823 'composit':641 'compound':822 'condit':523 'conditional/dynamic':488 'config':20 'configur':45,50,463 'conflict':418,807 'const':571 'construct':359 'contain':395,829 'cover':474 'creat':95 'css':3,5,18,43,53,75,110,199,229,703,716,726 'css-first':17,42 'current':22,293 'custom':96,103,108,151,679 'custom-vari':102,150 'cva':469,563,821 'dark':153,155,156,704,715,722,738,773 'data':38 'decim':251 'defaultvari':628 'defin':86,107,158,177 'define/extend':64 'delet':691 'deprec':450 'design':65,348 'detect':368 'dimens':320 'direct':54 'display':123 'doc':23,26 'doesn':652 'doubl':666 'dri':802 'dry-run':801 'duplic':443 'dvh':324,330 'dynam':361 'eas':138 'ease-out':137 'effect':241 'element':812 'elimin':47 'enabl':218 'enforc':436,459 'enforce-canonical-class':435 'entri':58,447 'equal':319 'equival':789 'error':646,784 'eslint':404,408 'eslint-plugin-better-tailwindcss':407 'export':510 'fade':130,133,142,244 'fade-in':132,141,243 'fail':382,677,688,706 'file':216,797 'first':19,44 'fix':648 'flag':433 'fluid':835 'font':122,583 'font-display':121 'font-medium':582 'foreground':733,744,758,760,768 'fraction':261 'full':281 'function':467,477,511 'gap':299,307 'generat':69,81,91 'gotcha':253 'gray':543,601,605 'greenfield':290 'grid':827 'guidanc':288 'h':317,323,328 'handl':308 'hex':357 'hsl':667,673,729,734,740,745 'implement':9 'import':56,111,498,504,565 'index':180,833 'inlin':73,657,721,750 'input':513,518 'insid':222 'instead':194,259,396,683 'integr':405 'inter':124 'isact':536 'jsx':475 'keyfram':140 'last':389,402 'last-child':388 'layer':99,377,380,685 'layout':824 'lg':531,577,620,623 'like':263 'live':51 'manag':834 'map':74,718 'margin':391,399 'may':39 'md':616,632 'medium':584 'merg':479,486,509 'migrat':268,690 'min':322,327 'min-h-dvh':321 'min-h-screen':326 'mobil':333 'modal':185,193 'mode':723 'modifi':337 'modul':200,215,224 'module.css':203 'name':94,105,372,793 'need':775 'nest':711 'never':358 'new':82 'no-conflicting-class':416 'no-deprecated-class':448 'no-duplicate-class':441 'no-unknown-class':429 'normal':439 'notat':256 'npm':785 'oklch':117 'opac':145,148,336,342 'order':462 'pad':386,393 'parent':385 'pass':781 'pattern':294,637,725,815,825 'plain':491,521 'plugin':409 'point':59 'primari':590,630,651,660,662 'produc':167 'project':270 'purpos':55 'px':532,578,612,624 'py':534,580,614,626 'queri':830 'red':423 'redund':446 'refer':188,208,813 'rem':258 'remain':794 'remov':345,445,455 'replac':60,98,695 'respons':643 'return':515 'root':714,727 'round':530,576 'rounded-lg':529,575 'rule':298 'run':786,803 'safe':555 'san':126 'sans-serif':125 'screen':329 'search':21,25 'secondari':598 'see':276,633 'selector':106 'semant':761 'serif':127 'shorthand':440 'signific':33 'size':314,607,631 'skill' 'skill-tailwind-css' 'slide':247 'slide-in-from-top':246 'slot':640,820 'sm':608,611 'source-iliaal' 'space':252,302,305,310 'space-i':304 'space-x':301 'specif':13 'stale':41 'static':85,494,520 'string':492,522 'support':710 'switch':771 'symptom':647 'syntax':14 'tabl':285 'tailwind':2,4,30,61,78,205,209,485,508,549,569,635,818 'tailwind-css':1 'tailwind-merg':484,507 'tailwind-vari':548,568,634,817 'tailwind.config.ts':48,692 'tailwindcss':57,112,411,697 'tailwindcss-anim':696 'tailwindcss/upgrade':800 'text':172,362,422,426,596,604,610,618,622,767 'text-bas':617 'text-blu':425 'text-brand':171 'text-foreground':766 'text-gray':603 'text-lg':621 'text-r':421 'text-sm':609 'text-whit':595 'theme':15,63,72,84,113,160,219,354,656,705,712,720,749,777 'token':66,87,157,182,220,349 'top':212,250 'topic-agent-skills' 'topic-ai-coding-assistant' 'topic-ai-tools' 'topic-claude-code' 'topic-skills' 'train':37 'transit':586 'transition-color':585 'tv':471,551,566,573 'tw':227,472,701 'tw-animate-css':226,700 'twmerg':505,516 'type':499,554 'type-saf':553 'typescript':497,519,564 'typo':434 'typographi':836 'unknown':431 'upgrad':271 'use':202,230,254,356,369,392,406,480,490,524,547,669,681,713 'usesortedclass':458 'util':70,79,92,93,97,162,343,373,476,682 'v3':35,265,273,453,791 'v3-to-v4-migration.md':277 'v4':6,12,31,46,206,267,275,291,347,384,457,707,724 'v4-specific':11 'valid':415 'valu':262,352 'var':83,661,670,674,717,754,759 'variabl':76 'varianc':561 'variant':16,104,109,152,546,550,556,570,588,636,644,774,819 'verifi':7,779 'via':24,189,719 'w':316 'white':597 'without':80 'won':365 'work':292,654 'wrap':309,313,668 'write':28 'x':303 'y':306 'z':179,184,190,192,197,832 'z-index':178,831 'z-modal':183,191 'zero':783","prices":[{"id":"c2d7f648-bed9-4d4b-8890-84b525b4d55e","listingId":"5f03aa31-24b2-4593-9db9-9212bc0cc0e0","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"iliaal","category":"ai-skills","install_from":"skills.sh"},"createdAt":"2026-05-09T01:05:37.040Z"}],"sources":[{"listingId":"5f03aa31-24b2-4593-9db9-9212bc0cc0e0","source":"github","sourceId":"iliaal/ai-skills/tailwind-css","sourceUrl":"https://github.com/iliaal/ai-skills/tree/master/skills/tailwind-css","isPrimary":false,"firstSeenAt":"2026-05-09T01:05:37.040Z","lastSeenAt":"2026-05-18T19:07:04.001Z"}],"details":{"listingId":"5f03aa31-24b2-4593-9db9-9212bc0cc0e0","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"iliaal","slug":"tailwind-css","github":{"repo":"iliaal/ai-skills","stars":13,"topics":["agent-skills","ai-coding-assistant","ai-tools","claude-code","skills"],"license":"mit","html_url":"https://github.com/iliaal/ai-skills","pushed_at":"2026-05-16T13:15:17Z","description":"Curated collection of agent skills for AI coding assistants.","skill_md_sha":"ea936df88ef2a2f07384d20c92bf6561ebbb7cda","skill_md_path":"skills/tailwind-css/SKILL.md","default_branch":"master","skill_tree_url":"https://github.com/iliaal/ai-skills/tree/master/skills/tailwind-css"},"layout":"multi","source":"github","category":"ai-skills","frontmatter":{"name":"tailwind-css","description":">-"},"skills_sh_url":"https://skills.sh/iliaal/ai-skills/tailwind-css"},"updatedAt":"2026-05-18T19:07:04.001Z"}}