agentleFS
GstMirabalGstMirabal/Token-Optimized-Agent-Pipeline/skills/tailwind-css-patterns/SKILL.md

tailwind-css-patterns

Skill1 starsChanged 9 days agoMITView on GitHub

Provides comprehensive Tailwind CSS utility-first styling patterns including responsive design, layout utilities, flexbox, grid, spacing, typography, colors, and modern CSS best practices. Use when styling React/Vue/Svelte components, building responsive layouts, implementing design systems, or optimizing CSS workflow.

14 other projects use a version of this, 6 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use tailwind-v4-shadcn, two-factor-authentication-best-practices and 9 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.
  • nicepkgSkill

    tailwind-v4-shadcn

    Production-tested setup for Tailwind CSS v4 with shadcn/ui, Vite, and React.

    Also in 5 projects that use this

  • lukevellaSkill

    two-factor-authentication-best-practices

    This skill provides guidance and enforcement rules for implementing secure two-factor authentication (2FA) using Better Auth's twoFactor plugin.

    Also in 3 projects that use this

  • lukevellaSkill

    email-and-password-best-practices

    This skill provides guidance and enforcement rules for implementing secure email and password authentication using Better Auth.

    Also in 3 projects that use this

  • currents-devSkill

    playwright-best-practices

    Use when writing Playwright tests, fixing flaky tests, debugging failures, implementing Page Object Model, configuring CI/CD, optimizing performance, mocking APIs, handling authentication or OAuth, testing accessibility (axe-core), file uploads/downloads, date/time mocking, WebSockets, geolocation, permissions, multi-tab/popup flows, mobile/responsive layouts, touch gestures, GraphQL, error handling, offline mode, multi-user collaboration, third-party services (payments, email verification), console error monitoring, global setup/teardown, test annotations (skip, fixme, slow), test tags (@smoke, @fast, @critical, filtering with --grep), project dependencies, security testing (XSS, CSRF, auth), performance budgets (Web Vitals, Lighthouse), iframes, component testing, canvas/WebGL, service workers/PWA, test coverage, i18n/localization, Electron apps, or browser extension testing. Covers E2E, component, API, visual, accessibility, security, Electron, and extension testing.

    Also in 3 projects that use this

  • JetBrainsSkill

    vitest

    Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures.

    Also in 4 projects that use this

  • DatabricksSkill

    deploy-to-vercel

    Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

    Also in 4 projects that use this

  • +1 more from lukevella

The file

Show its rules and text

We split this skill into the rules it gives an agent

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

  • 9

    Common

    Most of the 6 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 9

    Very specific

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

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

    Start Mobile-First: Write base styles for mobile, add responsive prefixes (sm:, md:, lg:) for larger screens

    line 57
  2. Common:

    Extract Components: Create reusable component classes for repeated patterns

    line 60
  3. Common:

    Verify Changes: Test at each breakpoint using DevTools responsive mode.

    line 62
  4. Common:

    Consistent Spacing: Use Tailwind's spacing scale (4, 8, 12, 16, etc.)

    line 103
  5. Very specific:

    Utility Composition: Prefer utility classes over @apply for maintainability

    line 106
  6. Common:

    Semantic HTML: Use proper HTML elements with Tailwind classes

    line 107
  7. Common:

    Performance: Ensure content paths include all template files for optimal purging

    line 108
  8. Very specific:

    Check content paths: Ensure all template files are included in content: [] in config

    line 114
  9. Very specific:

    Verify build: Run npm run build to regenerate purged CSS

    line 115
  10. Very specific:

    Dev mode: Use npx tailwindcss -o with --watch flag for live updates

    line 116
  11. Common:

    Check breakpoint values: Verify breakpoints match your design requirements

    line 120
  12. Common:

    DevTools: Use browser DevTools responsive mode to test at each breakpoint

    line 121
  13. Very specific:

    Verify config: Ensure darkMode: 'class' or 'media' is set correctly

    line 124
  14. Very specific:

    Toggle implementation: Use document.documentElement.classList.toggle('dark') for class strategy

    line 125
  15. Very specific:

    Initial flash: Add dark class to <html> before body renders

    line 126
  16. Common:

    Arbitrary Values: Use sparingly; prefer design tokens for consistency

    line 132
  17. Very specific:

    Specificity Issues: Avoid @apply with complex selectors

    line 133
  18. Common:

    Browser Support: Check Tailwind docs for compatibility notes

    line 135

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

Expert guide for building modern, responsive user interfaces with Tailwind CSS utility-first framework. Covers v4.1+ features including CSS-first configuration, custom utilities, and enhanced developer experience.

Overview

Provides actionable patterns for responsive, accessible UIs with Tailwind CSS v4.1+. Covers utility composition, dark mode, component patterns, and performance optimization.

When to Use

  • Styling React/Vue/Svelte components
  • Building responsive layouts and grids
  • Implementing design systems
  • Adding dark mode support
  • Optimizing CSS workflow

Quick Reference

Responsive Breakpoints

PrefixMin WidthDescription
sm:640pxSmall screens
md:768pxTablets
lg:1024pxDesktops
xl:1280pxLarge screens
2xl:1536pxExtra large

Common Patterns

<!-- Center content -->
<div class="flex items-center justify-center min-h-screen">
  Content
</div>

<!-- Responsive grid -->
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
  <!-- Items -->
</div>

<!-- Card component -->
<div class="bg-white rounded-lg shadow-lg p-6">
  <h3 class="text-xl font-bold">Title</h3>
  <p class="text-gray-600">Description</p>
</div>

Instructions

  1. Start Mobile-First: Write base styles for mobile, add responsive prefixes (sm:, md:, lg:) for larger screens
  2. Use Design Tokens: Leverage Tailwind's spacing, color, and typography scales
  3. Compose Utilities: Combine multiple utilities for complex styles
  4. Extract Components: Create reusable component classes for repeated patterns
  5. Configure Theme: Customize design tokens in tailwind.config.js or using @theme
  6. Verify Changes: Test at each breakpoint using DevTools responsive mode. Check for visual regressions and accessibility issues before committing.

Examples

Responsive Card Component

function ProductCard({ product }: { product: Product }) {
  return (
    <div className="bg-white rounded-lg shadow-lg overflow-hidden sm:flex">
      <img className="h-48 w-full object-cover sm:h-auto sm:w-48" src={product.image} />
      <div className="p-6">
        <h3 className="text-lg font-semibold">{product.name}</h3>
        <button className="mt-4 px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700">
          Add to Cart
        </button>
      </div>
    </div>
  );
}

Dark Mode Toggle

<div class="bg-white dark:bg-gray-900 text-gray-900 dark:text-white">
  <h1 class="dark:text-white">Title</h1>
</div>

Form Input

<input
  class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
  placeholder="you@example.com"
/>

Best Practices

  1. Consistent Spacing: Use Tailwind's spacing scale (4, 8, 12, 16, etc.)
  2. Color Palette: Stick to Tailwind's color system for consistency
  3. Component Extraction: Extract repeated patterns into reusable components
  4. Utility Composition: Prefer utility classes over @apply for maintainability
  5. Semantic HTML: Use proper HTML elements with Tailwind classes
  6. Performance: Ensure content paths include all template files for optimal purging
  7. Accessibility: Include focus styles, ARIA labels, and respect user preferences (reduced-motion)

Troubleshooting

Classes Not Applying

  • Check content paths: Ensure all template files are included in content: [] in config
  • Verify build: Run npm run build to regenerate purged CSS
  • Dev mode: Use npx tailwindcss -o with --watch flag for live updates

Responsive Styles Not Working

  • Order matters: Responsive prefixes must come before non-responsive (e.g., md:flex not flex md:flex)
  • Check breakpoint values: Verify breakpoints match your design requirements
  • DevTools: Use browser DevTools responsive mode to test at each breakpoint

Dark Mode Issues

  • Verify config: Ensure darkMode: 'class' or 'media' is set correctly
  • Toggle implementation: Use document.documentElement.classList.toggle('dark') for class strategy
  • Initial flash: Add dark class to <html> before body renders

Constraints and Warnings

  • Class Proliferation: Long class strings reduce readability; extract into components
  • Content Paths: Misconfigured paths cause classes to be purged in production
  • Arbitrary Values: Use sparingly; prefer design tokens for consistency
  • Specificity Issues: Avoid @apply with complex selectors
  • Dark Mode: Requires correct configuration (class or media strategy)
  • Browser Support: Check Tailwind docs for compatibility notes

References

  • references/layout-patterns.md — Flexbox, grid, spacing, typography, colors
  • references/component-patterns.md — Cards, navigation, forms, modals, React patterns
  • references/responsive-design.md — Responsive patterns, dark mode, container queries
  • references/animations.md — Transitions, transforms, built-in animations, motion preferences
  • references/performance.md — Bundle optimization, CSS optimization, production builds
  • references/accessibility.md — Focus management, screen readers, color contrast, ARIA
  • references/configuration.md — CSS-first config, JavaScript config, plugins, presets
  • references/reference.md — Additional reference materials

External Resources

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.