Communitygithub.com

Tailwind CSS 패턴 (v4 - 2025)

CSS-first 구성, 컨테이너 쿼리, 최신 패턴, 디자인 토큰 아키텍처 등 Tailwind CSS v4 원칙을 설명합니다.

Tailwind CSS 패턴 (v4 - 2025)란 무엇인가요?

이 스킬은 Tailwind CSS v4의 핵심 원칙과 최신 패턴을 체계적으로 설명합니다. v3에서 v4로 변경된 주요 사항(예: JS 설정 파일에서 CSS 기반 `@theme` 지시어로의 전환, Oxide 엔진 기반 10배 빠른 컴파일)을 이해하고, CSS-first 구성, 컨테이너 쿼리, 반응형 디자인, 다크 모드, OKLCH 색상 시스템, 현대적인 레이아웃 패턴(Flexbox/Grid), 타이포그래피 시스템, 애니메이션 및 전환, 컴포넌트 추출 방법 등을 상세히 다룹니다. 또한 `!important` 남용, 과도한 `@apply` 사용, v3/v4 혼용 등 일반적인 안티 패턴을 지적하고, Oxide 엔진 자동 사용, 빌드 캐싱 등 성능 최적화 원칙을 제시합니다. 이 스킬은 Claude Code, Cursor, Codex 등 어떤 AI 에이전트에서든 Tailwind CSS v4 프로젝트를 개발하거나 유지보수할 때 유용하게 사용할 수 있습니다.

지원 대상✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/marnixGeerkens/rocketlauncher-claude-code/tree/HEAD/components/skills/creative-design/tailwind-patterns

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Tailwind CSS 패턴 (v4 - 2025)은(는) 무엇을 하나요?

CSS 네이티브 구성을 사용하는 현대적인 유틸리티 우선 CSS.


1. Tailwind v4 아키텍처

v3에서 변경된 사항

v3 (레거시)v4 (현재)
tailwind.config.jsCSS 기반 @theme 지시어
PostCSS 플러그인Oxide 엔진 (10배 빠름)
JIT 모드네이티브, 항상 활성화
플러그인 시스템CSS 네이티브 기능
@apply 지시어여전히 작동하지만 권장되지 않음

v4 핵심 개념

개념설명
CSS-firstJavaScript가 아닌 CSS에서 구성
Oxide 엔진Rust 기반 컴파일러, 훨씬 빠름
네이티브 중첩PostCSS 없이 CSS 중첩 사용
CSS 변수모든 토큰이 --* 변수로 노출됨

2. CSS 기반 구성

테마 정의

@theme {
  /* 색상 - 의미 기반 이름 사용 */
  --color-primary: oklch(0.7 0.15 250);
  --color-surface: oklch(0.98 0 0);
  --color-surface-dark: oklch(0.15 0 0);
  
  /* 간격 스케일 */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 2rem;
  
  /* 타이포그래피 */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

확장(Extend) vs 재정의(Override)

동작사용 시점
확장기본값과 함께 새 값을 추가할 때
재정의기본 스케일 전체를 교체할 때
의미 토큰프로젝트별 이름 지정 (primary, surface)

3. 컨테이너 쿼리 (v4 네이티브)

중단점(Breakpoint) vs 컨테이너

유형반응 대상
중단점 (md:)뷰포트 너비
컨테이너 (@container)부모 요소 너비

컨테이너 쿼리 사용법

패턴클래스
컨테이너 정의부모에 @container
컨테이너 중단점자식에 @sm:, @md:, @lg:
이름 있는 컨테이너특정성을 위해 @container/card

사용 시점

시나리오사용
페이지 수준 레이아웃뷰포트 중단점
컴포넌트 수준 반응형컨테이너 쿼리
재사용 가능한 컴포넌트컨테이너 쿼리 (컨텍스트 독립적)

4. 반응형 디자인

중단점 시스템

접두사최소 너비대상
(없음)0px모바일 우선 기본
sm:640px대형 폰 / 소형 태블릿
md:768px태블릿
lg:1024px노트북
xl:1280px데스크탑
2xl:1536px대형 데스크탑

모바일 우선 원칙

  1. 접두사 없이 모바일 스타일 먼저 작성
  2. 접두사를 사용하여 더 큰 화면 재정의 추가
  3. 예시: w-full md:w-1/2 lg:w-1/3

5. 다크 모드

구성 전략

방법동작사용 시점
class.dark 클래스 전환수동 테마 전환
media시스템 설정 따름사용자 제어 불필요
selector사용자 지정 선택자 (v4)복잡한 테마

다크 모드 패턴

요소라이트다크
배경bg-whitedark:bg-zinc-900
텍스트text-zinc-900dark:text-zinc-100
테두리border-zinc-200dark:border-zinc-700

6. 현대 레이아웃 패턴

Flexbox 패턴

패턴클래스
양쪽 축 중앙 정렬flex items-center justify-center
세로 스택flex flex-col gap-4
가로 행flex gap-4
사이 공간 벌리기flex justify-between items-center
줄바꿈 그리드flex flex-wrap gap-4

그리드 패턴

패턴클래스
자동 맞춤 반응형grid grid-cols-[repeat(auto-fit,minmax(250px,1fr))]
비대칭 (벤토)grid grid-cols-3 grid-rows-2 + span
사이드바 레이아웃grid grid-cols-[auto_1fr]

참고: 대칭형 3열 그리드보다 비대칭형/벤토 레이아웃을 선호합니다.


7. 현대 색상 시스템

OKLCH vs RGB/HSL

형식장점
OKLCH지각적으로 균일, 디자인에 더 적합
HSL직관적인 색상/채도
RGB레거시 호환성

색상 토큰 아키텍처

계층예시목적
원시--blue-500원시 색상 값
의미--color-primary목적 기반 명명
컴포넌트--button-bg컴포넌트별

8. 타이포그래피 시스템

글꼴 스택 패턴

유형권장
산세리프'Inter', 'SF Pro', system-ui, sans-serif
고정폭'JetBrains Mono', 'Fira Code', monospace
디스플레이'Outfit', 'Poppins', sans-serif

글자 크기 스케일

클래스크기용도
text-xs0.75rem레이블, 캡션
text-sm0.875rem보조 텍스트
text-base1rem본문 텍스트
text-lg1.125rem리드 텍스트
text-xl+1.25rem+제목

9. 애니메이션 및 전환

내장 애니메이션

클래스효과
animate-spin지속 회전
animate-ping주목 펄스
animate-pulse미묘한 불투명도 펄스
animate-bounce바운스 효과

전환 패턴

패턴클래스
모든 속성transition-all duration-200
특정 속성transition-colors duration-150
이징 포함ease-out 또는 ease-in-out
호버 효과hover:scale-105 transition-transform

10. 컴포넌트 추출

추출 시점

신호동작
동일한 클래스 조합 3회 이상컴포넌트 추출
복잡한 상태 변형컴포넌트 추출
디자인 시스템 요소추출 + 문서화

추출 방법

방법사용 시점
React/Vue 컴포넌트동적, JS 필요
CSS의 @apply정적, JS 불필요
디자인 토큰재사용 가능한 값

11. 안티 패턴

하지 말 것할 것
모든 곳에서 임의 값 사용디자인 시스템 스케일 사용
!important특정성을 올바르게 수정
인라인 style=유틸리티 사용
긴 클래스 리스트 중복컴포넌트 추출
v3 구성과 v4 혼용완전히 CSS-first로 마이그레이션
@apply 과도하게 사용컴포넌트 선호

12. 성능 원칙

원칙구현
사용하지 않는 CSS 제거v4에서 자동
동적 사용 피하기템플릿 문자열 클래스 사용 금지
Oxide 사용v4에서 기본, 10배 빠름
빌드 캐싱CI/CD 캐싱

기억하세요: Tailwind v4는 CSS-first입니다. CSS 변수, 컨테이너 쿼리, 네이티브 기능을 활용하세요. 이제 구성 파일은 선택 사항입니다.

Individual skills in this repo

This repo contains 13 individual skills — each has its own dedicated page.

marnixGeerkens/rocketlauncher-claude-code

When the user wants to optimize, improve, or increase conversions on any marketing page — including homepage, landing pages, pricing pages, feature pages, or blog posts. Also use when the user says "CRO," "conversion rate optimization," "this page isn't converting," "improve conversions," or "why isn't this page working." For signup/registration flows, see signup-flow-cro. For post-signup activation, see onboarding-cro. For forms outside of signup, see form-cro. For popups/modals, see popup-cro.

marnixGeerkens/rocketlauncher-claude-code

Balance visual design with ATS compatibility for creative roles. Use when the user is in design, art, writing, marketing creative, or any visual/creative field and needs a resume that looks distinctive but still parses.

marnixGeerkens/rocketlauncher-claude-code

Transform resume bullets into detailed portfolio case studies with context, action, and outcome. Use when the user mentions portfolio, case study, project write-up, or expanding a resume bullet into a longer narrative.

marnixGeerkens/rocketlauncher-claude-code

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities. Use when: portfolio, personal website, showcase work, developer portfolio, designer portfolio.

marnixGeerkens/rocketlauncher-claude-code

Frontend development patterns for React, Next.js, state management, performance optimization, and UI best practices.

marnixGeerkens/rocketlauncher-claude-code

Frontend development guidelines for React/TypeScript applications. Modern patterns including Suspense, lazy loading, useSuspenseQuery, file organization with features directory, MUI v7 styling, TanStack Router, performance optimization, and TypeScript best practices. Use when creating components, pages, features, fetching data, styling, routing, or working with frontend code.

marnixGeerkens/rocketlauncher-claude-code

Next.js App Router principles. Server Components, data fetching, routing patterns.

marnixGeerkens/rocketlauncher-claude-code

Expert integration of Supabase Auth with Next.js App Router Use when: supabase auth next, authentication next.js, login supabase, auth middleware, protected route.

marnixGeerkens/rocketlauncher-claude-code

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

marnixGeerkens/rocketlauncher-claude-code

Create API handoff documentation for frontend developers. Use when backend work is complete and needs to be documented for frontend integration, or user says 'create handoff', 'document API', 'frontend handoff', or 'API documentation'.

marnixGeerkens/rocketlauncher-claude-code

Document frontend data needs for backend developers. Use when frontend needs to communicate API requirements to backend, or user says 'backend requirements', 'what data do I need', 'API requirements', or is describing data needs for a UI.

marnixGeerkens/rocketlauncher-claude-code

Comprehensive Python library for astronomy and astrophysics. This skill should be used when working with astronomical data including celestial coordinates, physical units, FITS files, cosmological calculations, time systems, tables, world coordinate systems (WCS), and astronomical data analysis. Use when tasks involve coordinate transformations, unit conversions, FITS file manipulation, cosmological distance calculations, time scale conversions, or astronomical data processing.

marnixGeerkens/rocketlauncher-claude-code

Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.

관련 스킬