tailwind-css

Use when styling UI components or layouts with Tailwind CSS - mobile-first design, responsive utilities, custom themes, or component styling. NOT when plain CSS, CSS-in-JS (styled-components), or non-Tailwind frameworks are involved. Triggers: "style component", "responsive design", "mobile-first", "dark theme", "tailwind classes", "dashboard grid".

242 stars

Best use case

tailwind-css is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Use when styling UI components or layouts with Tailwind CSS - mobile-first design, responsive utilities, custom themes, or component styling. NOT when plain CSS, CSS-in-JS (styled-components), or non-Tailwind frameworks are involved. Triggers: "style component", "responsive design", "mobile-first", "dark theme", "tailwind classes", "dashboard grid".

Use when styling UI components or layouts with Tailwind CSS - mobile-first design, responsive utilities, custom themes, or component styling. NOT when plain CSS, CSS-in-JS (styled-components), or non-Tailwind frameworks are involved. Triggers: "style component", "responsive design", "mobile-first", "dark theme", "tailwind classes", "dashboard grid".

Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.

Practical example

Example input

Use the "tailwind-css" skill to help with this workflow task. Context: Use when styling UI components or layouts with Tailwind CSS - mobile-first design, responsive utilities, custom themes, or component styling.
NOT when plain CSS, CSS-in-JS (styled-components), or non-Tailwind frameworks are involved.
Triggers: "style component", "responsive design", "mobile-first", "dark theme", "tailwind classes", "dashboard grid".

Example output

A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.

When to use this skill

  • Use this skill when you want a reusable workflow rather than writing the same prompt again and again.

When not to use this skill

  • Do not use this when you only need a one-off answer and do not need a reusable workflow.
  • Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/tailwind-css/SKILL.md --create-dirs "https://raw.githubusercontent.com/aiskillstore/marketplace/main/skills/awais68/tailwind-css/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/tailwind-css/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How tailwind-css Compares

Feature / Agenttailwind-cssStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use when styling UI components or layouts with Tailwind CSS - mobile-first design, responsive utilities, custom themes, or component styling. NOT when plain CSS, CSS-in-JS (styled-components), or non-Tailwind frameworks are involved. Triggers: "style component", "responsive design", "mobile-first", "dark theme", "tailwind classes", "dashboard grid".

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Tailwind CSS Skill

## Overview

Expert guidance for Tailwind CSS styling with mobile-first responsive design, custom themes, and utility-first approach. Focuses on accessibility, dark mode, and performance optimization.

## When This Skill Applies

This skill triggers when users request:
- **Styling**: "Style this KPI card", "Button component style", "Design a form"
- **Responsive**: "Mobile-first layout", "Responsive dashboard", "Grid with breakpoints"
- **Themes**: "Custom dark theme", "Extend tailwind theme", "Color scheme"
- **Layouts**: "Dashboard grid", "Card layout", "Flexible container"

## Core Rules

### 1. Mobile-First Design

```jsx
// ✅ GOOD: Mobile-first progressive enhancement
<div className="w-full px-4 py-2 sm:w-1/2 sm:px-6 md:w-1/3 md:px-8 lg:w-1/4">
  <KPICard />
</div>

// Breakpoints:
// sm: 640px   - Small tablets/phones
// md: 768px   - Tablets
// lg: 1024px  - Desktops
// xl: 1280px  - Large screens
// 2xl: 1536px - Extra large screens
```

**Requirements:**
- Base styles for mobile (no prefix)
- Progressive enhancement with `sm:`, `md:`, `lg:` prefixes
- Start with mobile layout, enhance for larger screens
- Use responsive breakpoints: `sm:640px`, `md:768px`, `lg:1024px`

### 2. Responsive Utilities

```jsx
// ✅ GOOD: Fluid responsive layouts
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
  {items.map(item => <Item key={item.id} item={item} />)}
</div>

// ✅ GOOD: Responsive spacing
<div className="p-4 sm:p-6 md:p-8 lg:p-12">
  Content
</div>

// ✅ GOOD: Container queries (if needed)
<div className="@container">
  <div className="@lg:grid-cols-2">
    Nested responsive content
  </div>
</div>
```

**Requirements:**
- Use fluid utilities (`w-full`, `flex-1`) for mobile
- Add breakpoints (`sm:`, `md:`, `lg:`) for larger screens
- Consider container queries for nested responsive components
- Test layouts at multiple breakpoints (375px, 768px, 1024px, 1440px)

### 3. Custom Themes

```typescript
// tailwind.config.ts
export default {
  darkMode: 'class', // or 'media'
  content: ['./src/**/*.{ts,tsx}'],
  theme: {
    extend: {
      colors: {
        primary: {
          50: '#eff6ff',
          100: '#dbeafe',
          500: '#3b82f6',
          900: '#1e3a8a',
        },
        erp: {
          'card': '#ffffff',
          'card-dark': '#1f2937',
        },
      },
      spacing: {
        '18': '4.5rem',
        '88': '22rem',
      },
      fontFamily: {
        sans: ['Inter', 'sans-serif'],
      },
    },
  },
  plugins: [],
};
```

**Requirements:**
- Extend theme in `tailwind.config.ts`, don't override
- Use semantic names (`primary`, `secondary`, `accent`)
- Define custom colors, fonts, spacing in theme
- Support CSS variables for dynamic theming
- Use `darkMode: 'class'` for manual dark mode toggle

### 4. Component Styling

```jsx
// ✅ GOOD: Utility-first approach
export const Button = ({ variant, size, children }) => (
  <button className={`
    font-semibold rounded-lg
    ${variant === 'primary' ? 'bg-blue-500 text-white hover:bg-blue-600' : 'bg-gray-200 text-gray-800 hover:bg-gray-300'}
    ${size === 'sm' ? 'px-3 py-1 text-sm' : 'px-4 py-2'}
    transition-colors duration-200
    focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
  `}>
    {children}
  </button>
);

// ✅ GOOD: CVA or class-variance-authority for variants
import { cva } from 'class-variance-authority';

const buttonVariants = cva(
  'font-semibold rounded-lg transition-colors',
  {
    variants: {
      variant: {
        primary: 'bg-blue-500 text-white hover:bg-blue-600',
        secondary: 'bg-gray-200 text-gray-800 hover:bg-gray-300',
      },
      size: {
        sm: 'px-3 py-1 text-sm',
        md: 'px-4 py-2',
      },
    },
  }
);
```

**Requirements:**
- Prefer inline utility classes over custom CSS
- Use `@apply` sparingly (only for repeated patterns)
- Extract complex variants with CVA or similar libraries
- Follow shadcn/ui patterns for consistent styling
- Use template literals for conditional classes

## Output Requirements

### Code Files

1. **Component Styling**:
   - Inline utility classes in JSX/TSX
   - Conditional classes for variants (dark/light, sizes)
   - Focus states and transitions

2. **Configuration**:
   - `tailwind.config.ts` updates for custom themes
   - `globals.css` for global styles and directives

3. **Dark Mode Support**:
   ```jsx
   <div className="bg-white dark:bg-gray-900 text-gray-900 dark:text-white">
     Content with dark mode
   </div>
   ```

### Integration Requirements

- **shadcn/ui**: Follow shadcn design tokens and patterns
- **Accessibility**: WCAG 2.1 AA compliant colors, focus-visible states
- **Performance**: Enable JIT mode, purge unused classes
- **i18n**: Support RTL layouts when needed

### Documentation

- **PHR**: Create Prompt History Record for styling decisions
- **ADR**: Document theme decisions (color schemes, breakpoints)
- **Comments**: Document non-obvious utility combinations

## Workflow

1. **Analyze Layout Requirements**
   - Identify mobile breakpoints
   - Determine responsive needs
   - Check dark mode requirements

2. **Apply Mobile-First Styles**
   - Base styles without breakpoints
   - Progressive enhancement for larger screens
   - Test on mobile viewport (375px)

3. **Add Responsive Breakpoints**
   - `sm:` for tablets (640px)
   - `md:` for tablets (768px)
   - `lg:` for desktops (1024px)
   - Test at each breakpoint

4. **Apply Dark Mode**
   - Add `dark:` variants for colors/backgrounds
   - Test in both light and dark modes
   - Ensure contrast ratios in both modes

5. **Validate Accessibility**
   - Check color contrast ratios (4.5:1 minimum)
   - Add focus-visible states for interactive elements
   - Ensure touch targets are 44px+ on mobile

## Quality Checklist

Before completing any styling:

- [ ] **No Horizontal Scroll Mobile**: Layout fits 375px without horizontal scroll
- [ ] **Touch Targets**: All interactive elements 44px+ on mobile
- [ ] **Dark/Light Variants**: Dark mode support with `dark:` classes
- [ ] **Utility-First**: Minimal custom CSS, use Tailwind utilities
- [ ] **Purge Unused**: No unused utility classes in production
- [ ] **Focus States**: `focus-visible` or `focus:ring` on all interactive elements
- [ ] **Contrast Ratios**: WCAG 2.1 AA compliant colors (4.5:1 for text)
- [ ] **Responsive Breakpoints**: Tested at sm/md/lg breakpoints
- [ ] **Consistent Spacing**: Use Tailwind's spacing scale (0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32, 40, 48, 56, 64)
- [ ] **Transitions**: Add `transition-*` classes for smooth state changes

## Common Patterns

### KPI Card (Mobile-First)

```jsx
export const KPICard = ({ title, value, trend, loading }) => (
  <div className="
    w-full p-4 bg-white dark:bg-gray-800
    rounded-lg shadow-sm border border-gray-200 dark:border-gray-700
    sm:p-6 md:p-8
  ">
    {loading ? (
      <Skeleton className="h-20" />
    ) : (
      <>
        <h3 className="text-sm font-medium text-gray-600 dark:text-gray-400">
          {title}
        </h3>
        <p className="text-2xl font-bold text-gray-900 dark:text-white mt-2">
          {value}
        </p>
        {trend && (
          <span className={`
            inline-flex items-center mt-2 text-sm
            ${trend > 0 ? 'text-green-600 dark:text-green-400' : 'text-red-600 dark:text-red-400'}
          `}>
            {trend > 0 ? '↑' : '↓'} {Math.abs(trend)}%
          </span>
        )}
      </>
    )}
  </div>
);
```

### Responsive Dashboard Grid

```jsx
export const DashboardGrid = ({ children }) => (
  <div className="
    w-full grid gap-4
    grid-cols-1
    sm:grid-cols-2
    md:grid-cols-3
    lg:grid-cols-4
    xl:grid-cols-5
    p-4
  ">
    {children}
  </div>
);
```

### Form with Responsive Layout

```jsx
export const ResponsiveForm = () => (
  <form className="
    w-full max-w-lg mx-auto
    p-4 sm:p-6 md:p-8
    bg-white dark:bg-gray-800
    rounded-lg shadow-md
  ">
    <div className="space-y-4 sm:space-y-6">
      <div>
        <label className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
          Name
        </label>
        <input className="
          w-full px-4 py-2 text-base
          border border-gray-300 dark:border-gray-600
          rounded-lg
          bg-white dark:bg-gray-700
          text-gray-900 dark:text-white
          focus:ring-2 focus:ring-blue-500 focus:border-blue-500
        " />
      </div>
      <button className="
        w-full sm:w-auto
        px-6 py-3 text-base font-semibold
        bg-blue-500 hover:bg-blue-600
        text-white rounded-lg
        transition-colors duration-200
        focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
      ">
        Submit
      </button>
    </div>
  </form>
);
```

### Dark Mode Toggle Button

```jsx
export const DarkModeToggle = ({ isDark, onToggle }) => (
  <button
    onClick={onToggle}
    className="
      p-2 rounded-lg
      bg-gray-200 dark:bg-gray-700
      hover:bg-gray-300 dark:hover:bg-gray-600
      text-gray-800 dark:text-gray-200
      transition-colors duration-200
      focus:outline-none focus:ring-2 focus:ring-blue-500
    "
    aria-label={isDark ? 'Switch to light mode' : 'Switch to dark mode'}
  >
    {isDark ? '☀️' : '🌙'}
  </button>
);
```

## Tailwind Configuration Best Practices

### Breakpoint Strategy

```typescript
// Recommended breakpoint configuration
screens: {
  'xs': '475px',  // Extra small phones
  'sm': '640px',  // Small tablets/phones
  'md': '768px',  // Tablets
  'lg': '1024px', // Desktops
  'xl': '1280px', // Large screens
  '2xl': '1536px', // Extra large screens
}
```

### Color System

```typescript
// Semantic color naming
colors: {
  primary: { 50: '...', 500: '...', 900: '...' },
  success: { 50: '...', 500: '...', 900: '...' },
  warning: { 50: '...', 500: '...', 900: '...' },
  error:   { 50: '...', 500: '...', 900: '...' },
}
```

### Spacing Scale

```typescript
// Use Tailwind's scale: 0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32, 40, 48, 56, 64, 72, 80, 96
// 1 = 0.25rem (4px), 4 = 1rem (16px), 8 = 2rem (32px)
spacing: {
  '128': '32rem',
  '144': '36rem',
}
```

## Accessibility Guidelines

- **Color Contrast**: Minimum 4.5:1 for text, 3:1 for large text
- **Focus States**: Always include `focus:ring-2` or `focus-visible`
- **Touch Targets**: Minimum 44x44px for mobile interactive elements
- **Skip Links**: Add `sr-only` skip links for keyboard users
- **ARIA Labels**: Use `aria-label` for icon-only buttons

## Performance Optimization

1. **JIT Mode**: Enabled by default in Tailwind CSS 3+
2. **Purge Unused**: Only used classes in production
3. **CSS Minification**: Tailwind CLI or PostCSS optimization
4. **Inline Critical CSS**: Extract critical CSS for above-fold content
5. **Lazy Load Components**: Code split heavy components

## References

- Tailwind CSS Documentation: https://tailwindcss.com/docs
- Tailwind UI Patterns: https://tailwindui.com
- shadcn/ui Components: https://ui.shadcn.com
- Web Content Accessibility Guidelines (WCAG 2.1): https://www.w3.org/WAI/WCAG21/quickref/

Related Skills

tailwind-design-system

242
from aiskillstore/marketplace

Build scalable design systems with Tailwind CSS, design tokens, component libraries, and responsive patterns. Use when creating component libraries, implementing design systems, or standardizing UI patterns.

tailwind-v4-shadcn

242
from aiskillstore/marketplace

Set up Tailwind v4 with shadcn/ui using @theme inline pattern and CSS variable architecture. Four-step pattern: CSS variables, Tailwind mapping, base styles, automatic dark mode. Prevents 8 documented errors. Use when initializing React projects with Tailwind v4, or fixing colors not working, tw-animate-css errors, @theme inline dark mode conflicts, @apply breaking, v3 migration issues.

expo-tailwind-setup

242
from aiskillstore/marketplace

Set up Tailwind CSS v4 in Expo with react-native-css and NativeWind v5 for universal styling

figma-to-tailwind

242
from aiskillstore/marketplace

Figma MCPで取得したデザイン変数をTailwind CSS標準クラスに変換する。Figma MCPのコード生成後やデザイン実装時に自動起動。

tailwind-css-v4-mastery

242
from aiskillstore/marketplace

Expert guidance for leveraging Tailwind CSS V4's new Oxide engine, CSS-first configuration, and modern styling paradigms. This skill transforms Claude into a Tailwind V4 architecture specialist, capable of designing component systems, optimizing performance, and executing complex styling challenges with precision.

tailwind-patterns

242
from aiskillstore/marketplace

Quick reference for Tailwind CSS utility patterns, responsive design, and configuration. Triggers on: tailwind, utility classes, responsive design, tailwind config, dark mode css, tw classes.

azure-quotas

242
from aiskillstore/marketplace

Check/manage Azure quotas and usage across providers. For deployment planning, capacity validation, region selection. WHEN: "check quotas", "service limits", "current usage", "request quota increase", "quota exceeded", "validate capacity", "regional availability", "provisioning limits", "vCPU limit", "how many vCPUs available in my subscription".

DevOps & Infrastructure

raindrop-io

242
from aiskillstore/marketplace

Manage Raindrop.io bookmarks with AI assistance. Save and organize bookmarks, search your collection, manage reading lists, and organize research materials. Use when working with bookmarks, web research, reading lists, or when user mentions Raindrop.io.

Data & Research

zlibrary-to-notebooklm

242
from aiskillstore/marketplace

自动从 Z-Library 下载书籍并上传到 Google NotebookLM。支持 PDF/EPUB 格式,自动转换,一键创建知识库。

discover-skills

242
from aiskillstore/marketplace

当你发现当前可用的技能都不够合适(或用户明确要求你寻找技能)时使用。本技能会基于任务目标和约束,给出一份精简的候选技能清单,帮助你选出最适配当前任务的技能。

web-performance-seo

242
from aiskillstore/marketplace

Fix PageSpeed Insights/Lighthouse accessibility "!" errors caused by contrast audit failures (CSS filters, OKLCH/OKLAB, low opacity, gradient text, image backgrounds). Use for accessibility-driven SEO/performance debugging and remediation.

project-to-obsidian

242
from aiskillstore/marketplace

将代码项目转换为 Obsidian 知识库。当用户提到 obsidian、项目文档、知识库、分析项目、转换项目 时激活。 【激活后必须执行】: 1. 先完整阅读本 SKILL.md 文件 2. 理解 AI 写入规则(默认到 00_Inbox/AI/、追加式、统一 Schema) 3. 执行 STEP 0: 使用 AskUserQuestion 询问用户确认 4. 用户确认后才开始 STEP 1 项目扫描 5. 严格按 STEP 0 → 1 → 2 → 3 → 4 顺序执行 【禁止行为】: - 禁止不读 SKILL.md 就开始分析项目 - 禁止跳过 STEP 0 用户确认 - 禁止直接在 30_Resources 创建(先到 00_Inbox/AI/) - 禁止自作主张决定输出位置