Universal AI Lib
cd ../skills

Tailwind CSS Patterns

Write clean, maintainable Tailwind CSS with utility-first patterns, responsive design, and dark mode.

# Tailwind CSS Patterns

## When to Use
Apply when styling any component in a Tailwind CSS project.

## Rules
1. **Utility-first** — compose styles from utilities, extract components only when repeating >3 times.
2. **Mobile-first** — write base styles for mobile, use `sm:`, `md:`, `lg:` for larger breakpoints.
3. **Dark mode via `dark:` prefix** — always provide dark mode variants for colors.
4. **Use CSS variables** for theme tokens that change between modes.
5. **Group related utilities** — layout, spacing, typography, colors, then state variants.

## Code Examples

```tsx
<div className="flex flex-col gap-4 p-4 md:flex-row md:gap-6 md:p-6">
  <h2 className="text-lg font-semibold text-gray-900 dark:text-gray-100">
    Title
  </h2>
  <p className="text-sm text-gray-600 dark:text-gray-400">
    Description text
  </p>
</div>
```

## Anti-Patterns
- Using @apply for everything (defeats utility-first purpose)
- Hardcoding colors instead of using theme tokens
- Not providing dark mode variants
- Using arbitrary values `w-[347px]` when a standard size exists

## Checklist
- [ ] Responsive breakpoints used (mobile-first)
- [ ] Dark mode variants provided
- [ ] No @apply abuse
- [ ] Theme tokens used for colors

How to use this skill

  1. Click "Copy" to copy the skill content.
  2. Create a folder at .github/skills/tailwind-css-patterns/ in your repository.
  3. Paste the content into SKILL.md inside the folder.
  4. Reference the skill name in your AI agent's instructions or copilot config.