tailwind
Tailwind CSS Expert
Expert Tailwind CSS patterns for building modern, responsive interfaces.
Core Principles
- Utility-first: Compose designs directly in markup using utility classes
- Responsive by default: Mobile-first with
sm:,md:,lg:,xl:,2xl:prefixes - Consistent spacing: Use the spacing scale (4, 8, 12, 16, 20, 24, 32, 40, 48, 64)
- Design tokens: Leverage the default theme or extend it consistently
Common Patterns
Layout
<!-- Flexbox centering -->
<div class="flex items-center justify-center">
<!-- Grid layout -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- Container with padding -->
<div class="container mx-auto px-4 sm:px-6 lg:px-8">
Typography
<!-- Headings -->
<h1 class="text-3xl font-bold tracking-tight text-gray-900">
<h2 class="text-2xl font-semibold text-gray-800">
<p class="text-base text-gray-600 leading-relaxed">
<!-- Truncation -->
<p class="truncate"> <!-- Single line -->
<p class="line-clamp-3"> <!-- Multi-line -->
Buttons
<!-- Primary -->
<button class="px-4 py-2 bg-blue-600 text-white font-medium rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors">
<!-- Secondary -->
<button class="px-4 py-2 bg-white text-gray-700 font-medium rounded-lg border border-gray-300 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors">
Cards
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
<h3 class="text-lg font-semibold text-gray-900">Title</h3>
<p class="mt-2 text-gray-600">Description</p>
</div>
Forms
<label class="block text-sm font-medium text-gray-700">Email</label>
<input type="email" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm">
Responsive Design
<!-- Stack on mobile, side-by-side on larger screens -->
<div class="flex flex-col sm:flex-row gap-4">
<!-- Hide on mobile, show on desktop -->
<div class="hidden lg:block">
<!-- Different padding at breakpoints -->
<div class="p-4 sm:p-6 lg:p-8">
Dark Mode
<div class="bg-white dark:bg-gray-900 text-gray-900 dark:text-white">
States
<!-- Hover, focus, active -->
<button class="hover:bg-blue-700 focus:ring-2 active:bg-blue-800">
<!-- Disabled -->
<button class="disabled:opacity-50 disabled:cursor-not-allowed">
<!-- Group hover -->
<div class="group">
<span class="group-hover:text-blue-600">
</div>
Animation
<!-- Transitions -->
<div class="transition-all duration-200 ease-in-out">
<!-- Built-in animations -->
<div class="animate-spin">
<div class="animate-pulse">
<div class="animate-bounce">
Best Practices
- Extract repeated patterns into components or partials
- Use
@applysparingly in CSS files for complex repeated patterns - Prefer semantic HTML with utility classes over
<div>soup - Use the official Tailwind CSS IntelliSense extension
- Customize theme in
tailwind.config.jsrather than arbitrary values
More from aviflombaum/claude-code-in-avinyc
ux-ui
UX/UI design principles for clean, intuitive interfaces. Use when designing layouts, improving usability, planning information architecture, or ensuring accessibility. Triggers on "user experience", "usability", "information architecture", "accessibility", "interaction design".
12interview
Interview about a plan file to refine it through in-depth questioning. Use when you have a plan that needs validation, refinement, or deeper exploration before implementation. Triggers on "interview me about", "refine this plan", "question this spec".
9write
Write technical blog posts, tutorials, and documentation in Flatiron School's engaging style. Use for explaining code patterns, debugging stories, or turning complex topics into clear narratives. Triggers on "write a blog post", "tutorial about", "explain how", "technical writing".
8hotwire
Hotwire, Turbo, and Stimulus patterns for Rails. Use when implementing JavaScript interactions, Turbo Frames/Streams, or Stimulus controllers. Triggers on "stimulus controller", "turbo frame", "turbo stream", "hotwire", "rails javascript".
8write-test
Writes comprehensive RSpec tests for Rails applications. Use when writing model specs, request specs, system specs, job specs, mailer specs, channel specs, or storage specs. Triggers on "write tests for", "add specs to", "test the User model", "create request specs", "write RSpec", "add test coverage".
8analyze
Analyze completed development work to identify automation and systematization opportunities. Use after finishing features, fixing bugs, or completing code reviews. Triggers on "analyze for automation", "what can we automate", "compound opportunities", "systematize".
8