agentleFS
manish1803manish1803/nextjs-fullstack-skills/skills/01-frontend-engineering/design-system-tailwind/SKILL.md

design-system-tailwind

Skill2 starsChanged 4 months agoMITView on GitHub

Build and maintain a scalable Tailwind CSS design system and component library — design tokens, variant management with class-variance-authority, theming, and consistent spacing/color/typography scales. Use whenever the user is styling with Tailwind, building a component library, setting up design tokens, configuring a Tailwind theme, or asking how to keep UI consistent across a project. Trigger on "design system", "tailwind config", "component library", "design tokens", "consistent styling".

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

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

    Never branch className with long ternary chains.

    line 31
  2. Very specific:

    No arbitrary values (w-[123px], text-[#3a3a3a]) in feature code — if the scale doesn't have it, add the token, don't escape the system.

    line 53
  3. Distinctive:

    Every new primitive gets documented with its variant matrix (a short table: variant × size × state) before being reused across features.

    line 56

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Design System & Tailwind CSS Engineering Skill

Turns Tailwind usage from ad-hoc utility soup into a governed design system.

Foundation: tokens before components

Define tokens once in tailwind.config.ts (or CSS variables for runtime theming) — never hardcode hex codes or arbitrary pixel values in component files.

// tailwind.config.ts
theme: {
  extend: {
    colors: {
      brand: { 50: '...', 500: '...', 900: '...' },
      surface: 'hsl(var(--surface))',
      foreground: 'hsl(var(--foreground))',
    },
    fontFamily: { sans: ['var(--font-inter)'] },
    spacing: { '18': '4.5rem' }, // only add if a real gap exists in the default scale
    borderRadius: { xl: '1rem' },
  }
}

For dark mode / multi-theme, drive colors through CSS variables (hsl(var(--x))) so themes swap without a rebuild.

Component variants with class-variance-authority (cva)

Never branch className with long ternary chains. Use cva for variant + size + state matrices:

const button = cva('inline-flex items-center rounded-md font-medium transition-colors', {
  variants: {
    variant: { primary: 'bg-brand-600 text-white hover:bg-brand-700', ghost: 'bg-transparent hover:bg-surface-100' },
    size: { sm: 'h-8 px-3 text-sm', md: 'h-10 px-4', lg: 'h-12 px-6 text-lg' },
  },
  defaultVariants: { variant: 'primary', size: 'md' },
});

Merge with tailwind-merge (cn = (...cls) => twMerge(clsx(cls))) so consumer className overrides win predictably.

Structure a component library

components/ui/          # primitives: Button, Input, Card, Dialog (shadcn-style, headless-first)
components/patterns/    # composed patterns: FormField, DataTable, EmptyState
components/features/    # feature-specific, not reused elsewhere
lib/cn.ts

Base primitives on unstyled/headless behavior (Radix primitives are the standard pairing with Tailwind) and layer Tailwind classes on top — don't reinvent focus trapping, keyboard nav, or ARIA roles.

Governance rules

  • No arbitrary values (w-[123px], text-[#3a3a3a]) in feature code — if the scale doesn't have it, add the token, don't escape the system.
  • One typographic scale (text-xs → text-4xl mapped to real heading levels), documented in a Typography stories/reference, not redefined per page.
  • Spacing follows the 4px base scale everywhere; flag any component using raw margin/padding outside p-*/m-*/gap-* utilities.
  • Every new primitive gets documented with its variant matrix (a short table: variant × size × state) before being reused across features.

Example prompt this skill should trigger on

"Set up a Tailwind design system for this SaaS app with light/dark themes and a Button, Card, and Input component."

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.