agentleFS
ku5icku5ic/claude-kit/skills/tailwind-patterns/SKILL.md

tailwind-patterns

Skill2 starsChanged 7 days agoMITView on GitHub

Tailwind CSS v4 patterns for CSS-first config via the @theme directive, v3-vs-v4 deltas, variant rules, and anti-patterns. Use whenever the project contains a `tailwind.config.*`, `@import "tailwindcss"` in CSS, or a `tailwindcss` or `@tailwindcss/*` dependency, OR the user asks about Tailwind, utility classes, design tokens, or dark-mode strategy in a Tailwind project, even if Tailwind is not mentioned by name.

19 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use intelligent-routing, nextjs-react-expert and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SKB3002Skill

    intelligent-routing

    Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.

    Also in 5 projects that use this

  • SKB3002Skill

    nextjs-react-expert

    React and Next.js performance optimization from Vercel Engineering. Use when building React components, optimizing performance, eliminating waterfalls, reducing bundle size, reviewing code for performance issues, or implementing server/client-side optimizations.

    Also in 3 projects that use this

  • xfstudioSkill

    rust-pro

    Master Rust 1.75+ with modern async patterns, advanced type system

    Also in 5 projects that use this

  • xfstudioSkill

    code-refactoring-tech-debt

    You are a technical debt expert specializing in identifying, quantifying, and prioritizing technical debt in software projects. Analyze the codebase to uncover debt, assess its impact, and create acti

    Also in 3 projects that use this

  • jornalistainclusivoSkill

    design-spec

    How to author a DESIGN.md file — the machine-readable design-token + human-rationale format that must exist before any UI is built. YAML front-matter token schema (colors, typography, spacing, rounded, components), type system, token references, and canonical section order.

    Also in 3 projects that use this

  • weirdgmeSkill

    frontend-dev-guidelines

    Frontend development guidelines for React/TypeScript applications. Modern patterns including Suspense, lazy loading, useSuspenseQuery, file organization with features directory, MUI v7 styling, TanStack Router, performance optimization, and TypeScript best practices. Use when creating components, pages, features, fetching data, styling, routing, or working with frontend code.

    Also in 4 projects that use this

  • +2 more from xfstudio

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 18 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Default assumption: Tailwind v4 with CSS-first config.

    line 8
  2. Very specific:

    Use oklch() for new colors.

    line 34
  3. Very specific:

    If both tailwind.config.js and @import "tailwindcss" are present, the project is mid-migration.

    line 91

“Common” is measured: kept by at least 6 in 10 of the 18 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Tailwind patterns

Default assumption: Tailwind v4 with CSS-first config. If the project has a tailwind.config.js it is v3 and the v3 section applies; otherwise v4.

v4 vs v3 at a glance

  • v4 setup: a single @import "tailwindcss" in the main CSS file. No @tailwind base / components / utilities directives.
  • v4 config: lives in CSS via the @theme directive. No tailwind.config.js. Theme tokens become CSS custom properties automatically.
  • v4 content detection: automatic. The compiler scans the project for class names; you do not configure content paths.
  • v4 plugins: still work. Container queries are built in; typography and forms remain separate @tailwindcss/* plugins. Check before installing.
  • v4 build: full builds ~3.8x and incremental rebuilds 8.8x faster than v3.4; @import bundling and vendor prefixing are built in (Lightning CSS under the hood).

Setting up v4 correctly

/* app/globals.css or equivalent */
@import "tailwindcss";

@theme {
  --color-brand: oklch(0.7 0.15 250);
  --font-display: "Inter", sans-serif;
  --spacing-page: 4rem;
  --breakpoint-3xl: 1920px;
}
  • Theme keys follow the pattern --<namespace>-<name>. Namespaces: color, font, text, spacing, breakpoint, radius, shadow, animate, etc.
  • Defining a key generates the corresponding utility (text-brand, font-display, p-page, 3xl:).
  • Use oklch() for new colors; v4's default palette is OKLCH-based for better wide-gamut support.

v3 patterns to avoid in v4

  • tailwind.config.js: do not create one in a v4 project. Move config into @theme blocks. If the file exists in a v4 project, it is dead code.
  • @tailwind base; @tailwind components; @tailwind utilities;: v3 directive triple. v4 replaces these with a single @import "tailwindcss".
  • theme.extend: v3 JS shape. In v4, all CSS-defined --<namespace>-<name> tokens extend the default theme automatically.
  • content: [...]: v3 path config. v4 auto-detects.
  • @layer utilities { ... } for arbitrary utility classes: still works, but prefer defining custom utilities with the @utility directive in v4 for better tree-shaking.

Using theme values from CSS

  • var(--color-brand): read a theme value in plain CSS. Every @theme key is a CSS custom property; there is no separate read function in the v4 docs.
  • --alpha(var(--color-brand) / 50%): compute an alpha-modified color in v4. v3 used the theme() helper, kept in v4 only for compatibility.

Variants and modifiers

  • v4 variant order: hover:focus:bg-blue-500 applies hover AND focus, just like v3. No change.
  • New in v4:
    • not- variant prefix (not-hover:opacity-50)
    • nth-* variants (nth-3:, nth-[3n+1]:); the *: direct-children variant predates v4 (3.4)
    • starting-style variants (starting:opacity-0 for entry animations)
  • Container queries are built in: @container on the parent, @sm:flex etc. on children. No plugin install.

Anti-patterns to flag in review

warning: hardcoded hex colors when a theme token would work text-[#ff0000] bypasses the design system. Use the existing token; if missing, add it to @theme.

warning: @apply chains longer than three utilities They obscure the cascade and inhibit tree-shaking. Use a CSS class with raw properties instead, or compose at the markup level.

info: conditional @apply inside @media or selector blocks Works, but readability falls off fast. Inline utilities or extract a component.

warning: dark: everywhere instead of a [data-theme="dark"] strategy Inconsistent when the project already has a theme toggle. v4 supports both; pick one.

info: animate-[...] arbitrary values when a named animation exists Define --animate-<name> in @theme and reuse it instead of repeating the arbitrary value.

warning: missing text- size on body copy Relying on the browser default (16px) instead of setting the base size explicitly leaves typography undocumented and inconsistent across components.

Verifying which version is in use

# v4: postcss config has @tailwindcss/postcss, OR vite plugin @tailwindcss/vite
rg '@tailwindcss/(postcss|vite)' package.json

# v4 config in CSS
rg '@import "tailwindcss"' --type css

# v3 sentinel: a tailwind.config.js or .ts
fd -t f 'tailwind.config'

If both tailwind.config.js and @import "tailwindcss" are present, the project is mid-migration. Treat as v4 but expect leftover v3 patterns.

References

Version notes

Checked: 2026-09-26 against https://tailwindcss.com/blog, https://tailwindcss.com/blog/tailwindcss-v4, https://tailwindcss.com/blog/tailwindcss-v3-4 and https://tailwindcss.com/docs/theme

  • 4.3 (2026-05-08): no directive or function syntax change; no v5 exists.
  • 4.0: CSS-first config (@import "tailwindcss", @theme, @utility, --alpha()), automatic content detection, not-, nth-*, and starting: variants (*: is 3.4; build-speed figures and the *: example corrected 2026-09-26). Theme values are read with var(--*), not a --theme() function (corrected 2026-09-12).
  • 3.x: tailwind.config.js, @tailwind base/components/utilities, theme() helper. See "v3 patterns to avoid in v4".

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.