AGENT SKILL

tailwind-patterns

Tailwind CSS v4 principles. CSS-first configuration, container queries, modern patterns, design token architecture.

使用场景视觉设计
License 许可
MIT
最近更新
2026-11-15
Stars
★ 3.4w
Forks
4.0k

01 前言 Front Matter

name
tailwind-patterns
description
Tailwind CSS v4 principles. CSS-first configuration, container queries, modern patterns, design token architecture.
allowed-tools
Read, Write, Edit, Glob, Grep

03 SKILL.md 正文

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.js CSS-based @theme directive
PostCSS plugin Oxide engine (10x faster)
JIT mode Native, always-on
Plugin system CSS-native features
@apply directive Still works, discouraged

v4 Core Concepts

Concept Description
CSS-first Configuration in CSS, not JavaScript
Oxide Engine Rust-based compiler, much faster
Native Nesting CSS nesting without PostCSS
CSS Variables All 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

Action Use When
Extend Adding new values alongside defaults
Override Replacing default scale entirely
Semantic tokens Project-specific naming (primary, surface)

3. Container Queries (v4 Native)

Breakpoint vs Container

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

Container Query Usage

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

When to Use

Scenario Use
Page-level layouts Viewport breakpoints
Component-level responsive Container queries
Reusable components Container queries (context-independent)

4. Responsive Design

Breakpoint System

Prefix Min Width Target
(none) 0px Mobile-first base
sm: 640px Large phone / small tablet
md: 768px Tablet
lg: 1024px Laptop
xl: 1280px Desktop
2xl: 1536px Large 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

Method Behavior Use When
class .dark class toggles Manual theme switcher
media Follows system preference No user control
selector Custom selector (v4) Complex theming

Dark Mode Pattern

Element Light Dark
Background bg-white dark:bg-zinc-900
Text text-zinc-900 dark:text-zinc-100
Borders border-zinc-200 dark:border-zinc-700

6. Modern Layout Patterns

Flexbox Patterns

Pattern Classes
Center (both axes) flex items-center justify-center
Vertical stack flex flex-col gap-4
Horizontal row flex gap-4
Space between flex justify-between items-center
Wrap grid flex flex-wrap gap-4

Grid Patterns

Pattern Classes
Auto-fit responsive grid grid-cols-[repeat(auto-fit,minmax(250px,1fr))]
Asymmetric (Bento) grid grid-cols-3 grid-rows-2 with spans
Sidebar layout grid grid-cols-[auto_1fr]

Note: Prefer asymmetric/Bento layouts over symmetric 3-column grids.


7. Modern Color System

OKLCH vs RGB/HSL

Format Advantage
OKLCH Perceptually uniform, better for design
HSL Intuitive hue/saturation
RGB Legacy compatibility

Color Token Architecture

Layer Example Purpose
Primitive --blue-500 Raw color values
Semantic --color-primary Purpose-based naming
Component --button-bg Component-specific

8. Typography System

Font Stack Pattern

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

Type Scale

Class Size Use
text-xs 0.75rem Labels, captions
text-sm 0.875rem Secondary text
text-base 1rem Body text
text-lg 1.125rem Lead text
text-xl+ 1.25rem+ Headings

9. Animation & Transitions

Built-in Animations

Class Effect
animate-spin Continuous rotation
animate-ping Attention pulse
animate-pulse Subtle opacity pulse
animate-bounce Bouncing effect

Transition Patterns

Pattern Classes
All properties transition-all duration-200
Specific transition-colors duration-150
With easing ease-out or ease-in-out
Hover effect hover:scale-105 transition-transform

10. Component Extraction

When to Extract

Signal Action
Same class combo 3+ times Extract component
Complex state variants Extract component
Design system element Extract + document

Extraction Methods

Method Use When
React/Vue component Dynamic, JS needed
@apply in CSS Static, no JS needed
Design tokens Reusable values

11. Anti-Patterns

Don't Do
Arbitrary values everywhere Use design system scale
!important Fix specificity properly
Inline style= Use utilities
Duplicate long class lists Extract component
Mix v3 config with v4 Migrate fully to CSS-first
Use @apply heavily Prefer components

12. Performance Principles

Principle Implementation
Purge unused Automatic in v4
Avoid dynamism No template string classes
Use Oxide Default in v4, 10x faster
Cache builds CI/CD caching

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

04 同仓库更多 Skills

davila7
davila7/claude-code-templates

wealthville-pool-scoring

Score DeFi liquidity pools before providing liquidity. Returns a 0-100 pool score and an Enter/Hold/Exit/Reduce/Avoid verdict with calibrated confidence for ~68,800 Solana pools and 575 EVM pools, plus a public miss-inclusive track record. Use when asked whether a pool is worth LPing into, which pools look best right now, or how accurate the scores have actually been.

Skill与智能体开发
★ 3.4w
davila7
davila7/claude-code-templates

technical-debt-auditor

Scans a codebase and produces a quantified technical debt report with a prioritized remediation plan. Analyzes dead code, TODO/FIXME/HACK markers, dependency staleness, complexity hotspots, code duplication signals, test coverage gaps, unused exports, and outdated patterns. Use this skill when the user asks to audit their codebase for tech debt, wants a health check of their code quality, says things like "where should I focus refactoring", "find code smells", "audit my codebase", "what technical debt do we have", "prioritize cleanup work", or asks about code quality metrics. Also trigger when the user mentions "code rot", "legacy cleanup", "refactoring priorities", or wants to understand the overall health of a project before a major effort. Trigger even if the user doesn't say "technical debt" explicitly — any request to systematically assess code quality and identify improvement priorities belongs here.

Skill与智能体开发
★ 3.4w
davila7
davila7/claude-code-templates

readonly-sql-guard

Make an agent's database access provably read-only. Use when an agent runs caller-supplied SQL against a production/ERP/analytics database (a "query" MCP tool, text-to-SQL, an admin console), or when reviewing DB-access code for write/DDL/side-effect/transaction-escape risks. Checks what a statement CALLS, not just its shape.

数据分析师后端与接口Skill与智能体开发
★ 3.4w
davila7
davila7/claude-code-templates

web-artifacts-builder

Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.

前端开发
★ 3.4w
davila7
davila7/claude-code-templates

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

测试与质量前端开发
★ 3.4w
davila7
davila7/claude-code-templates

discernment-nudge

After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals, or emails, estimates or projections, analysis or interpretation of data, factual claims they may rely on, or a multi-step argument — invoke this skill BEFORE finalizing your reply and then, if it applies, append 2-3 short follow-up questions, each tied to something specific in what you just produced, that help the user check key facts, probe the reasoning or assumptions, and notice missing context. Do this at most once per conversation. Skip it when the user asked a trivial how-to or simple lookup, wants a purely educational explanation, asked you only to format, convert, or assemble a file from content they provided, is writing code they will run, is doing creative writing or casual chat, or already asked you to double-check, cite, or review — the skill file explains these boundaries and the exact output format.

内容创作者写作与文案Skill与智能体开发
★ 3.4w