agentleFS
LeahyCCLeahyCC/claude-skills/skills/tailwind-design-system/SKILL.md

tailwind-design-system

Skill3 starsChanged 8 months agoMITView on GitHub

Builds and maintains design systems on Tailwind CSS v4 for large codebases and dedicated design system repos. Token tiers mapped onto :root, @theme and @theme inline, closed scales, OKLCH palettes with measured WCAG contrast, dark mode, brands and density, component APIs with cva or tailwind-variants and a configured cn, monorepo packages where the system owns its @source, npm versus shadcn registries, lint rules and CI budgets that stop drift, Storybook visual and a11y tests, semver, token and component deprecation, docs, and migrating many apps from v3 and raw classes to tokens. Ships a contrast-checked starter theme and scripts that inspect a repo, measure contrast and count off-system classes. Use when creating or changing a design system, theme, tokens, a shared UI package, or the rules apps follow to use one. Not for styling one page or one-off visual design, a full WCAG audit (wcag-accessibility), or React rendering speed (react-performance).

33 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use bfl-api, flux-best-practices 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.
  • LinHao-citySkill

    bfl-api

    BFL FLUX API integration guide covering endpoints, async polling patterns, rate limiting, error handling, webhooks, and regional endpoints with Python and TypeScript code examples.

    Also in 3 projects that use this

  • LinHao-citySkill

    flux-best-practices

    Comprehensive guide for BFL FLUX image generation models. Covers prompting, T2I, I2I, structured JSON, hex colors, typography, multi-reference editing, and model-specific best practices for FLUX.2 and FLUX.1 families.

    Also in 3 projects that use this

  • dAAAbSkill

    heygen

    Also in 3 projects that use this

  • MoizIbnYousafSkill

    visual-style

    Build a persistent visual brand identity for image generation. Defines how the brand looks visually — aesthetic, lighting, composition, mood — and writes it to brand/creative-kit.md so /image-gen and other creative skills produce consistent on-brand visuals. Three modes: Extract (from website/URL), Build (interview), Reference (mood board/examples). Use when starting any project that needs images, when the user says "visual style", "brand aesthetic", "image style", "visual identity", "how should our images look", "build visual brand", "define our look", or when /image-gen outputs feel generic because no visual style exists yet.

    Also in 3 projects that use this

  • +8 more from LinHao-city

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

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

    Run node scripts/inspect.mjs from the repo root.

    line 29
  2. Distinctive:

    Verify, and report each result:

    line 33

“Common” is measured: kept by at least 6 in 10 of the 10 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 design system

How to build a design system on Tailwind CSS v4 that many teams and many apps can use for years: one place to change a value, themes that swap at runtime, components that carry their own accessibility, and machines that stop drift. Checked against Tailwind 4.3.3. If inspect.mjs shows a newer version, check its changelog before relying on version-specific notes here.

The system is the tokens and the rules, not the components. Components are the easy part to copy. What makes a system hold at scale is a closed set of semantic tokens, and lint and CI that make going around them harder than using them.

Measure, never assume. Contrast is computed, classes are compiled, versions are read from the repo. Sources and check dates: SOURCES.md.

Procedure

  1. Run node scripts/inspect.mjs from the repo root. It prints the installed Tailwind and related versions, every CSS entry with its @source lines, @theme blocks, dark variant and token counts, surfaces without a foreground token, and v3 leftovers. Work from that, not from memory.
  2. Find the task in the table below and read that resource.
  3. New system: copy templates/theme.css, then change values, not structure.
  4. Make the change.
  5. Verify, and report each result:
    • The app or Storybook builds.
    • node scripts/check-contrast.mjs <theme files> passes, after any token change.
    • The Tailwind lint config passes, or node scripts/audit-classes.mjs <dirs> shows counts did not rise.
tokens (DTCG JSON, optional)
   │ generate
   ▼
theme.css ── primitives    :root            --palette-*       never classes
          ── semantic      :root, dark,     --primary         swapped per theme
                           brand blocks
          ── utility map   @theme inline    --color-primary   the public classes
          ── scales        @theme           --text-sm         closed with --*: initial
          ── @source "./components"         the package says where its classes live
   │ @import "@acme/ui/theme.css"
   ▼
app.css  @import "tailwindcss";  one Tailwind build per app
   │
   ▼
lint + audit budgets + contrast + visual and a11y tests in CI

Where to read

TaskResource
Token tiers, where each lives, @theme vs @theme inline vs @theme static, closing scales, naming, property-scoped colours, DTCG, Terrazzo, Figmatokens.md
OKLCH palettes, surface and text pairs, measuring contrast, derived states, dark mode switch, brands, nested themes, high contrast, forced colours, chart colourscolor-and-themes.md
Type scale and text styles, spacing and density, control heights, radius, elevation, motion, z-index layers, breakpoints and container queriesscales.md
@utility, @custom-variant, @variant, @apply policy, @source inline, @reference, plugins on v4extending-tailwind.md
Component anatomy, variants with cva or tailwind-variants, configuring cn, the className contract, styling from ARIA and data attributes, Base UI, Radix and React Aria, accessibility each component ownscomponents.md
Repo layout, package boundaries, the package owning its @source, three shipping models, exports, cascade layers, monorepo tools, editor and Prettier setuparchitecture.md
npm package vs shadcn registry, registry:base and registry:theme, private and GitHub registries, versioning a registrydistribution.md
Closed scales, the lint config, budgets that only go down, contrast in CI, visual regression, axe in Storybook, the CI pipelineenforcement.md
Semver and Changesets, what counts as breaking, deprecating tokens, components and props, lifecycle stages, contribution, ADRs, adoption metricsgovernance.md
Diataxis for systems, the component page, token docs, generated reference, docs for coding agentsdocumentation.md
v3 to v4 with the upgrade tool, silent renames, JS config to CSS, moving apps from raw classes to tokens, many apps in sequencemigration.md

Defaults, unless the repo has already decided

DecisionDefaultWhy
Token tiersPrimitives in :root, semantic in :root and mode blocks, utility map in @theme inlinePrimitives cannot become classes. Nested themes flip.
Colour namesshadcn's contract (primary, primary-foreground, muted-foreground, border, input, ring) plus your rolesRegistry components drop in themed
Default paletteClosed: --color-*: initialRaw palette classes stop compiling
Dark mode@custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));Zero specificity, room for data-brand and data-density
ShippingSource in a package, each app compiles, the package's theme declares its own @sourceOne Tailwind build per app, apps never hard-code the system's folders
Variantsclass-variance-authority 0.7.1, or tailwind-variants for multi-part componentsEcosystem default, and slots where they pay off
Mergingtailwind-merge 3 or cn 0.5, configured once in the system with every custom keyUnregistered keys merge wrong in silence
Primitive libraryWhatever the system already uses. New: Base UI (shadcn's default) or React Aria.Never hand-build menu, dialog or combobox behaviour
Linteslint-plugin-better-tailwindcss with entryPoint, unknown, conflicting and restricted classesTurns closed scales into errors with autofix
VersioningChangesets, core packages fixed to one versionOne number per bug report
Contrast barWCAG 2.2 AA, 4.5:1 text, 3:1 control boundaries and focusWCAG 3 has no contrast algorithm yet. APCA is not a conformance target.

Traps

SymptomCauseFix
Classes used only inside the shared UI package are missing in productionTailwind skips node_modules, so the app never scans the package@source "./components"; in the package's theme file (architecture.md)
A dark band or brand panel does not change colourSemantic colours mapped in plain @theme, resolved once at :root@theme inline (tokens.md)
cn() drops a colour next to a custom text sizetailwind-merge and cn do not read @theme, and treat text-heading as a colourRegister custom keys, or name text styles type-* (components.md)
bg-blue-500 renders nothingThe palette is closed, as intendedUse the semantic token. Lint's unknown-class rule makes this an error.
A class built with a template string never appearsTailwind reads files as text and never sees bg-${tone}A map of complete class strings (extending-tailwind.md)
A custom utility changed after a Tailwind upgradeCore added the same name (tab-* in 4.3)Prefix system utilities
@apply fails in a CSS module or a Vue or Svelte style blockThat file is compiled without the theme@reference the theme, or plain var()
Every system token is "unknown" in lintNo entryPoint, or a shared config's cwd pointing at the shared packagePass entryPoint and cwd: import.meta.dirname from each app (enforcement.md)
Prettier sorts classes oddly or ignores tokensNo tailwindStylesheet, or one root config for several appsOne config per package, pointed at a file that imports Tailwind
Utilities cannot override a system component's CSSSystem CSS is unlayered@layer components and :where() (architecture.md)
A density mode changes nothing--spacing defined in @theme inline, so the value is baked inPlain @theme (scales.md)
Borders turned dark after upgrading to v4v4's default border colour is currentColorA base rule setting border-color: var(--color-border)
The focus ring fails 3:1outline-ring/50, a faded ringFull-strength ring with an offset
The page flashes light before darkThe theme attribute is set after first paintAn inline script in <head> (color-and-themes.md)
Contrast passes on the page but fails in a cardmuted-foreground measured only on backgroundMeasure every surface it sits on

Review checklist

  • inspect.mjs output is in the PR or the report, with the Tailwind version
  • Primitives are not in @theme. Semantic colours go through @theme inline.
  • --color-* is closed, and other scales the system owns are closed
  • Every surface token has a -foreground partner, and check-contrast.mjs passes in every mode and brand
  • No raw palette classes, arbitrary values, dark: colour overrides or !important in app code, enforced by lint
  • Components use semantic classes only, take variants as typed props, and merge className last through the system's cn
  • Custom theme keys are registered with the merge config
  • The UI package's theme declares its @source, and exports serves theme.css with the style condition
  • System CSS is in a layer, with :where() selectors
  • Focus is visible at 3:1, targets are at least 24px, reduced motion is respected, in the components themselves
  • Breaking changes ship with a major, a changeset, and a codemod or autofix rule
  • Deprecated tokens are aliases with a removal version and a lint warning

Related skills

Accessibility criteria in full: wcag-accessibility. Types for component props and variant maps: typescript-safety. Writing the docs pages: plain-docs. Button and error text: ux-copy.

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.