agentleFS
kumaran-iskumaran-is/claude-code-onboarding/.claude/skills/tailwind-patterns/SKILL.md

tailwind-patterns

Skill36 starsChanged 6 months agoMITView on GitHub

Tailwind CSS v4 principles for Angular 21.x — CSS-first @theme configuration, container queries, OKLCH color system, Bento layout patterns, dark mode strategies, and v3→v4 migration reference. Load alongside angular-spa for full Tailwind v4 coverage.

13 other projects use a version of this, 11 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use intelligent-routing, 2d-games and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • tiendatworkSkill

    intelligent-routing

    Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.

    Also in 3 projects that use this

  • tiendatworkSkill

    2d-games

    2D game development principles. Sprites, tilemaps, physics, camera.

    Also in 3 projects that use this

  • LangChainSkill

    docker-patterns

    Best practices for Docker containerization and multi-stage builds

    Also in 3 projects that use this

  • VercelSkill

    shadcn

    Pre-built shadcn/ui components for json-render. Use when working with @json-render/shadcn, adding standard UI components to a catalog, or building web UIs with Radix UI + Tailwind CSS components.

    Also in 3 projects that use this

  • +6 more from tiendatwork

The file

We split this skill into the rules it gives an agent

5 rules. 2 are common, 2 are distinctive, and 1 is very specific to this project.

  • 2

    Common

    Most of the 12 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when configuring Tailwind v4, using CSS-first theme and design tokens, implementing container queries, or applying modern …

    line 35
  2. Common:

    Write mobile styles first (no prefix)

    line 149
  3. Common:

    Add larger screen overrides with prefixes

    line 150
  4. Distinctive:

    Before delivering any Tailwind changes:

    line 367
  5. Very specific:

    Run ng build to confirm the Oxide compiler picks up all classes (no purged classes)

    line 372

“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Triggers

Load this skill when: configuring Tailwind v4, writing Angular templates with utility classes, migrating from Tailwind v3, implementing dark mode with daisyUI, or designing container-query-based layouts.


Iron Law

NO TAILWIND STYLING WITHOUT CHECKING THE PROJECT'S @theme CONFIGURATION FIRST — read the global CSS theme file before applying utility classes

Load the project's CSS @theme configuration and verify daisyUI semantic tokens before writing any template classes.

Tailwind CSS Patterns (v4 - 2025)

Modern utility-first CSS with CSS-native configuration.

When to Use

Use this skill when configuring Tailwind v4, using CSS-first theme and design tokens, implementing container queries, or applying modern Tailwind patterns in Angular 21.x templates.


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

Angular Example

<!-- Angular component template -->
<div class="@container">
  <div class="card @sm:card-side @lg:grid @lg:grid-cols-2">
    <!-- Responds to parent width, not viewport -->
    <!-- Use when same component appears in sidebar AND full-width page -->
  </div>
</div>

When to Use

ScenarioUse
Page-level layoutsViewport breakpoints
Component-level responsiveContainer queries
Reusable Angular 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
daisyUI data-themeSemantic token swapAngular workspace standard

daisyUI Dark Mode (Angular Workspace Standard)

// theme.service.ts — daisyUI approach (workspace standard)
@Injectable({ providedIn: 'root' })
export class ThemeService {
  setTheme(theme: 'light' | 'dark'): void {
    document.documentElement.setAttribute('data-theme', theme);
    localStorage.setItem('theme', theme);
  }
}
<!-- All daisyUI semantic classes switch automatically — no per-component CSS needed -->
<div class="bg-base-100 text-base-content">
  <!-- bg-base-100 is white in light, dark in dark theme automatically -->
</div>

Raw Tailwind Dark Mode Pattern (non-daisyUI)

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 gradients and hover states
HSLIntuitive hue/saturation
RGBLegacy compatibility

OKLCH for daisyUI Custom Themes

/* Custom daisyUI theme using OKLCH — produces better hover gradients */
@plugin "daisyui" {
  themes: [{
    mytheme: {
      "primary": "oklch(0.65 0.20 280)",   /* Brand purple */
      "secondary": "oklch(0.70 0.15 200)", /* Teal */
      "accent": "oklch(0.75 0.18 160)",
      "base-100": "oklch(0.98 0 0)",
      "base-content": "oklch(0.20 0 0)",
    }
  }]
}

Color Token Architecture

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

In Angular: use daisyUI semantic classes (bg-primary, text-base-content) — never primitives directly.


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
Angular component / daisyUI component variantDynamic, needs Angular bindings or daisyUI variant classes
@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
Use tailwind.config.js in v4Use @theme {} in CSS
Copy v3 Stack Overflow examplesVerify against v4 docs

12. Performance Principles

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

Related Skills

  • angular-spa — Angular 21.x implementation with full daisyUI v5.5.5 and Tailwind v4 reference files
  • angular-best-practices — OnPush, Signals, bundle optimization, @defer
  • design-system — token enforcement (Angular + Flutter)
  • web-performance-optimization — bundle size, CSS purging, LCP

Additional Resources


Verify Step

Before delivering any Tailwind changes:

  1. Confirm no tailwind.config.js was created — v4 uses @theme {} in CSS only
  2. Grep changed templates: grep -n "bg-blue-\|text-blue-\|bg-red-" <file> — zero raw primitive colors in Angular templates
  3. Grep for arbitrary values: grep -c "\[" <file> — minimize; each must be justified
  4. Confirm dark mode uses data-theme attribute swap (daisyUI), not dark: prefixes, unless project explicitly uses raw Tailwind dark mode
  5. Run ng build to confirm the Oxide compiler picks up all classes (no purged classes)

Remember: Tailwind v4 is CSS-first. Use @theme {} not tailwind.config.js. Use daisyUI semantic tokens in Angular templates — never raw Tailwind primitives like bg-blue-500.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.