Skip to content

@tank/tailwind

2.1.0

Tailwind CSS patterns and component recipes. Covers responsive design, dark mode, theme configuration, plugins, animations, and CSS variables. Includes shadcn/ui patterns. Triggers: tailwind, CSS, utility class, responsive, dark mode, theme, plugin, animation, shadow, gradient, flex, grid, container query, breakpoint, hover, focus, arbitrary value, shadcn, component styling, design tokens.


name: @tank/tailwind description: "Production Tailwind CSS patterns and component recipes for responsive, accessible UI." triggers:

  • tailwind
  • tailwindcss
  • utility class
  • css utility
  • responsive
  • breakpoint
  • container query
  • dark mode
  • theme
  • design tokens
  • shadcn
  • component styling
  • layout
  • grid
  • flex
  • spacing scale
  • animation
  • gradient
  • shadow
  • hover
  • focus
  • aria
  • @apply

Tailwind CSS Skill

Core Philosophy

  • Utility-first, not utility-only: compose primitives into systems.
  • Design with constraints: pick a scale and stay on it.
  • Compose, don't @apply: prefer classes in markup for clarity.

Workflow

  1. Determine component intent and state matrix (default, hover, focus, active, disabled, error).
  2. Pick layout primitives (flex, grid, container, stack) before styling.
  3. Use scale-first tokens (spacing, radius, type) before arbitrary values.
  4. Add states with variant prefixes; keep base classes clean.
  5. Validate accessibility: focus ring, contrast, motion, reduced motion.

Responsive Design Quick Reference

ConceptSyntaxExample
Mobile-firstbase then breakpointstext-sm md:text-base lg:text-lg
smsm: (640px)sm:grid-cols-2
mdmd: (768px)md:px-8
lglg: (1024px)lg:max-w-5xl
xlxl: (1280px)xl:gap-8
2xl2xl: (1536px)2xl:py-24
Container query@container + @[size]:@container md:@[32rem]:grid-cols-2

Spacing Scale (p-1 to p-16)

Classrempx
p-10.25rem4px
p-20.5rem8px
p-30.75rem12px
p-41rem16px
p-51.25rem20px
p-61.5rem24px
p-71.75rem28px
p-82rem32px
p-92.25rem36px
p-102.5rem40px
p-112.75rem44px
p-123rem48px
p-133.25rem52px
p-143.5rem56px
p-153.75rem60px
p-164rem64px

Common Class Combinations

GoalClasses
Center blockmx-auto max-w-5xl px-6
Center contentflex items-center justify-center
Balanced stackflex flex-col gap-4
Truncationtruncate or line-clamp-2
Aspect videoaspect-video overflow-hidden
Floating actionfixed bottom-6 right-6 z-50
Focus ringfocus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-900/50
Soft cardrounded-xl border border-slate-200 bg-white shadow-sm
Overlayfixed inset-0 bg-slate-900/50 backdrop-blur-sm

State and Accessibility

StateClassesNote
Hoverhover:bg-slate-100Add only where interactive
Focusfocus-visible:ring-2 focus-visible:ring-slate-900/40Keyboard visibility
Activeactive:scale-[0.99]Subtle feedback
Disableddisabled:opacity-50 disabled:pointer-events-nonePrevent interaction
Ariaaria-[current=page]:text-slate-900Semantic states

Variant Ordering

  • Order: base → size → color → state → responsive.
  • Keep dark: variants next to base styles.
  • Group focus-visible utilities together.
  • Avoid mixing group-hover and hover without intent.
  • Prefer aria-* variants over JS toggles when possible.

Arbitrary Values Guardrails

  • Use only when the scale cannot express the value.
  • Document the reason in nearby code or README.
  • Keep to one or two per component.
  • Prefer theme() tokens in plugins over arbitrary values.

When to Use @apply Decision Tree

  • Do you need to style a third-party class you cannot edit?
    • Yes → Use @apply in a single-purpose component class.
    • No → Continue.
  • Is there a strict design system class used across many repos?
    • Yes → Use @apply to publish stable design tokens.
    • No → Continue.
  • Is this for complex pseudo-elements or media queries only in CSS?
    • Yes → Use @apply for base utilities, add CSS for the rest.
    • No → Do not use @apply; keep utilities in markup.

Dark Mode Strategy

StrategyTailwind SettingExample
Class toggledarkMode: "class"html class="dark"
Media querydarkMode: "media"dark:bg-slate-900
Data attributedarkMode: ["class", "[data-theme='dark']"]data-theme="dark"

Anti-Patterns (Avoid)

Anti-patternWhy it hurts
Overusing @applyHides intent, reduces discoverability
Inline style fallbacksBreaks design scale and theming
Mixing arbitrary values everywhereBlocks consistency and reuse
Ignoring focus stylesAccessibility regressions
One-off color hexesBreaks dark mode and tokenization
Deeply nested selectorsFights utility-first model
Hardcoded breakpointsDiverges from responsive system
Shipping unscoped * stylesGlobal side effects
Animations without reduced motionAccessibility issues

Output Expectations

  • Prefer small, composable class lists over mega strings.
  • Use semantic HTML, then Tailwind for appearance.
  • Provide full recipes with states and aria attributes.
  • Document any arbitrary value with rationale.

Reference Index

  • skills/tailwind/references/component-recipes.md
  • skills/tailwind/references/layout-and-responsive.md
  • skills/tailwind/references/customization.md

Communication Style

  • Provide exact Tailwind classes and real HTML.
  • Be explicit about responsive variants and states.
  • Avoid vague advice; show working patterns.

Quality Checklist

  • Uses Tailwind scale for spacing, radius, type
  • Includes hover, focus-visible, and disabled states
  • Responsive behavior is mobile-first
  • Dark mode strategy is consistent
  • No unnecessary @apply

Command Palette

Search skills, docs, and navigate Tank