Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
davila7 avatar

Tailwind Patterns

  • 554 installs
  • 29.9k repo stars
  • Updated July 27, 2026
  • davila7/claude-code-templates

tailwind-patterns is a frontend styling skill that teaches Tailwind CSS v4 CSS-first configuration, container queries, design tokens, and modern utility patterns without legacy tailwind.config.js habits.

About

tailwind-patterns is a Tailwind CSS v4 reference skill for developers migrating from v3 or starting fresh with CSS-native configuration. It documents the shift from tailwind.config.js to @theme directives, PostCSS plugin to the Oxide engine advertised as 10x faster, always-on JIT, and CSS-native features replacing the old plugin system. Developers reach for this skill when building responsive layouts with container queries, architecting design tokens, or avoiding discouraged @apply-heavy patterns. Allowed tools include Read, Write, Edit, Glob, and Grep for applying patterns directly in project CSS files.

  • Documents Tailwind v4 CSS-first @theme configuration replacing tailwind.config.js
  • Covers container queries with @container and @sm/@md/@lg container breakpoints
  • Includes v3 versus v4 architecture table (Oxide engine, native nesting, CSS variables)
  • Mobile-first breakpoint ladder plus touch-target guidance (e.g. min-h-11 min-w-11)
  • Lists 8 anti-patterns including @apply overuse, breakpoint-only responsiveness, and v3 config migration gaps

Tailwind Patterns by the numbers

  • 554 all-time installs (skills.sh)
  • Ranked #591 of 2,277 Frontend Development skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/davila7/claude-code-templates --skill tailwind-patterns

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs554
repo stars29.9k
Security audit3 / 3 scanners passed
Last updatedJuly 27, 2026
Repositorydavila7/claude-code-templates

How do you configure Tailwind CSS v4 with @theme?

Ship consistent Tailwind CSS v4 layouts and tokens without fighting legacy tailwind.config.js habits.

Who is it for?

Frontend developers adopting Tailwind v4 who need CSS-native tokens and container queries without carrying v3 config habits forward.

Skip if: Projects locked on Tailwind v3 with no migration plan or teams using CSS-in-JS frameworks without Tailwind in the stack.

When should I use this skill?

The user asks about Tailwind v4, @theme directives, container queries, design tokens, or migrating off tailwind.config.js.

What you get

CSS-first @theme configs, container-query layouts, and design-token architecture in project stylesheets

  • @theme configuration
  • container-query layouts

By the numbers

  • Documents Tailwind v4 Oxide engine as 10x faster than the legacy PostCSS plugin path

Files

SKILL.mdMarkdownGitHub ↗

Tailwind CSS Patterns (v4 - 2025)

Modern utility-first CSS with CSS-native configuration.

---

1. Tailwind v4 Architecture

What Changed from v3

v3 (Legacy)v4 (Current)
tailwind.config.jsCSS-based @theme directive
PostCSS pluginOxide engine (10x faster)
JIT modeNative, always-on
Plugin systemCSS-native features
@apply directiveStill works, discouraged

v4 Core Concepts

ConceptDescription
CSS-firstConfiguration in CSS, not JavaScript
Oxide EngineRust-based compiler, much faster
Native NestingCSS nesting without PostCSS
CSS VariablesAll tokens exposed as --* vars

---

2. CSS-Based Configuration

Theme Definition

@theme {
  /* Colors - use semantic names */
  --color-primary: oklch(0.7 0.15 250);
  --color-surface: oklch(0.98 0 0);
  --color-surface-dark: oklch(0.15 0 0);
  
  /* Spacing scale */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 2rem;
  
  /* Typography */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

When to Extend vs Override

ActionUse When
ExtendAdding new values alongside defaults
OverrideReplacing default scale entirely
Semantic tokensProject-specific naming (primary, surface)

---

3. Container Queries (v4 Native)

Breakpoint vs Container

TypeResponds To
Breakpoint (md:)Viewport width
Container (@container)Parent element width

Container Query Usage

PatternClasses
Define container@container on parent
Container breakpoint@sm:, @md:, @lg: on children
Named containers@container/card for specificity

When to Use

ScenarioUse
Page-level layoutsViewport breakpoints
Component-level responsiveContainer queries
Reusable componentsContainer queries (context-independent)

---

4. Responsive Design

Breakpoint System

PrefixMin WidthTarget
(none)0pxMobile-first base
sm:640pxLarge phone / small tablet
md:768pxTablet
lg:1024pxLaptop
xl:1280pxDesktop
2xl:1536pxLarge desktop

Mobile-First Principle

1. Write mobile styles first (no prefix) 2. Add larger screen overrides with prefixes 3. Example: w-full md:w-1/2 lg:w-1/3

---

5. Dark Mode

Configuration Strategies

MethodBehaviorUse When
class.dark class togglesManual theme switcher
mediaFollows system preferenceNo user control
selectorCustom selector (v4)Complex theming

Dark Mode Pattern

ElementLightDark
Backgroundbg-whitedark:bg-zinc-900
Texttext-zinc-900dark:text-zinc-100
Bordersborder-zinc-200dark:border-zinc-700

---

6. Modern Layout Patterns

Flexbox Patterns

PatternClasses
Center (both axes)flex items-center justify-center
Vertical stackflex flex-col gap-4
Horizontal rowflex gap-4
Space betweenflex justify-between items-center
Wrap gridflex flex-wrap gap-4

Grid Patterns

PatternClasses
Auto-fit responsivegrid grid-cols-[repeat(auto-fit,minmax(250px,1fr))]
Asymmetric (Bento)grid grid-cols-3 grid-rows-2 with spans
Sidebar layoutgrid grid-cols-[auto_1fr]
Note: Prefer asymmetric/Bento layouts over symmetric 3-column grids.

---

7. Modern Color System

OKLCH vs RGB/HSL

FormatAdvantage
OKLCHPerceptually uniform, better for design
HSLIntuitive hue/saturation
RGBLegacy compatibility

Color Token Architecture

LayerExamplePurpose
Primitive--blue-500Raw color values
Semantic--color-primaryPurpose-based naming
Component--button-bgComponent-specific

---

8. Typography System

Font Stack Pattern

TypeRecommended
Sans'Inter', 'SF Pro', system-ui, sans-serif
Mono'JetBrains Mono', 'Fira Code', monospace
Display'Outfit', 'Poppins', sans-serif

Type Scale

ClassSizeUse
text-xs0.75remLabels, captions
text-sm0.875remSecondary text
text-base1remBody text
text-lg1.125remLead text
text-xl+1.25rem+Headings

---

9. Animation & Transitions

Built-in Animations

ClassEffect
animate-spinContinuous rotation
animate-pingAttention pulse
animate-pulseSubtle opacity pulse
animate-bounceBouncing effect

Transition Patterns

PatternClasses
All propertiestransition-all duration-200
Specifictransition-colors duration-150
With easingease-out or ease-in-out
Hover effecthover:scale-105 transition-transform

---

10. Component Extraction

When to Extract

SignalAction
Same class combo 3+ timesExtract component
Complex state variantsExtract component
Design system elementExtract + document

Extraction Methods

MethodUse When
React/Vue componentDynamic, JS needed
@apply in CSSStatic, no JS needed
Design tokensReusable values

---

11. Anti-Patterns

Don'tDo
Arbitrary values everywhereUse design system scale
!importantFix specificity properly
Inline style=Use utilities
Duplicate long class listsExtract component
Mix v3 config with v4Migrate fully to CSS-first
Use @apply heavilyPrefer components

---

12. Performance Principles

PrincipleImplementation
Purge unusedAutomatic in v4
Avoid dynamismNo template string classes
Use OxideDefault in v4, 10x faster
Cache buildsCI/CD caching

---

Remember: Tailwind v4 is CSS-first. Embrace CSS variables, container queries, and native features. The config file is now optional.

Related skills

How it compares

Pick tailwind-patterns when adopting Tailwind v4 CSS-first config; use general CSS architecture skills when Tailwind is not in the stack.

FAQ

What replaces tailwind.config.js in Tailwind v4?

Tailwind CSS v4 replaces tailwind.config.js with CSS-based @theme directives for configuration. The skill documents this shift plus the move from a PostCSS plugin to the Oxide engine.

Does tailwind-patterns cover container queries?

tailwind-patterns covers container queries, design-token architecture, and modern v4 utility patterns. It targets developers building layouts without legacy v3 configuration habits.

Which tools can agents use with tailwind-patterns?

tailwind-patterns allows Read, Write, Edit, Glob, and Grep so agents can inspect and edit project CSS files while applying v4 @theme and container-query patterns.

Is Tailwind Patterns safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.