Tailwind CSS Patterns

VerifiedCaution

Utility-first Tailwind CSS patterns for responsive layouts, components, and design systems. Covers v4.1+ features and best practices.

Sby Skills Guide Bot
DevelopmentIntermediate
7/26/2026
Claude Code
#tailwind-css#responsive-design#frontend-styling#utility-first#dark-mode

Recommended for

Automated summary

Provides Tailwind CSS utility-class patterns for building responsive interfaces, components, and themes, including dark mode.

Strengths

  • Concrete copy-paste examples for cards, grids, and forms.
  • Covers mobile-first best practices and Tailwind breakpoints.
  • Includes guidance on accessibility, dark mode, and theme configuration.
  • Highlights visual regression checks and troubleshooting for classes that don't apply.

Limitations

  • Assumes familiarity with Tailwind and an already configured project.
  • Stays general and does not cover complex plugins or animations.
  • The troubleshooting section is truncated and lacks depth.
When to use it

Use when styling React, Vue, or Svelte components with Tailwind and you need responsive layout or dark mode patterns.

When not to use it

Avoid if you need a complete CSS approach without Tailwind or advanced framework-specific patterns.

Security analysis

Caution
Quality score74/100

The skill is pure documentation: Tailwind utility patterns, breakpoints, component snippets, and troubleshooting tips. The only execution surface is the declared Bash tool, and the commands it suggests are ordinary package-manager/build invocations (npm run build, npx tailwindcss with --watch). There is no rm -rf, no curl|sh, no credential or token handling, and no attempt to alter agent safety behavior, so risk is limited to the generic capability of a shell tool.

Findings
  • •Declares Bash among allowed-tools, though only benign commands (npm run build, npx tailwindcss --watch, document.documentElement.classList.toggle) are referenced
  • •No destructive, exfiltration, obfuscation, or safety-disabling instructions present
How this analysis is made

Examples

Responsive product card
Style this React product card with Tailwind CSS: make it stack on mobile and switch to a horizontal layout on larger screens, with hover states and dark mode.
Mobile-first grid
Convert my existing CSS layout to a mobile-first Tailwind grid with 1 column on mobile, 2 on tablets, and 4 on desktop, using consistent spacing.
Accessible form and dark mode
Add Tailwind styling to this form with focus rings, accessible labels, and a dark mode toggle that respects the user's system preference.

name: tailwind-css-patterns description: 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. allowed-tools: Read, Write, Edit, Glob, Grep, Bash

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

| Prefix | Min Width | Description | |--------|-----------|-------------| | sm: | 640px | Small screens | | md: | 768px | Tablets | | lg: | 1024px | Desktops | | xl: | 1280px | Large screens | | 2xl: | 1536px | Extra 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

External Resources

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/tailwind-css-patterns-ms1aw5jl/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/tailwind-css-patterns-ms1aw5jl' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/tailwind-css-patterns-ms1aw5jl/download' --output '.skill-downloads/tailwind-css-patterns-ms1aw5jl/SKILL.md.part' && mv '.skill-downloads/tailwind-css-patterns-ms1aw5jl/SKILL.md.part' '.skill-downloads/tailwind-css-patterns-ms1aw5jl/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Read, Write, Edit, Glob, Grep, Bash

Original excerpt: 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>

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/tailwind-css-patterns-ms1aw5jl/SKILL.md' && test -s '.skill-downloads/tailwind-css-patterns-ms1aw5jl/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/tailwind-css-patterns' && cp -R '.skill-downloads/tailwind-css-patterns-ms1aw5jl' '.claude/skills/tailwind-css-patterns'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/tailwind-css-patterns-ms1aw5jl'

openskills read 'tailwind-css-patterns-ms1aw5jl'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/tailwind-css-patterns-ms1aw5jl/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills