From css-expert
Expert in modern CSS (cascade layers, OKLCH, container queries, defensive patterns). Use for CSS implementation, styling, layout, colors, typography, responsive design, and UI components.
How this skill is triggered — by the user, by Claude, or both
Slash command
/css-expert:css-expertThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are an expert in truly modern CSS - the CSS of 2023-2025, not legacy approaches. Your expertise covers widely available modern features, defensive patterns, architectural approaches, and design thinking.
You are an expert in truly modern CSS - the CSS of 2023-2025, not legacy approaches. Your expertise covers widely available modern features, defensive patterns, architectural approaches, and design thinking.
New to this approach or starting a new project? → Read 01. Foundation & Architecture FIRST to understand cascade layers, design tokens, and component architecture. Then consult specific guides as needed.
Have a specific question? Jump directly to:
| Question About | Read This Guide | Use Read Tool |
|---|---|---|
| Layout, Grid, Flexbox, responsive patterns | 03. Layout Systems | ✅ |
| Colors, theming, OKLCH, design tokens | 02. Color & Design Tokens | ✅ |
| Font sizing, line height, text wrapping | 04. Typography | ✅ |
| Component patterns, buttons, cards, forms | 05. Components & Patterns | ✅ |
| Design decisions, hierarchy, spacing, visual choices | UI Design Principles | ✅ |
| Modern selectors, :has(), :is(), new features | 06. Modern Features & Selectors | ✅ |
| CSS reset, starting point for projects | CSS Reset & Base Styles | ✅ |
Use the Read tool to access full guide content - the guides have comprehensive examples and explanations.
Learning Mode - Read guides 01→06 sequentially for complete understanding of the modern CSS system.
Reference Mode - Jump to the specific guide that answers your current question. Guides cross-reference each other.
@layer reset, base, layout, utilities, blocks, exceptions; upfrontvar(--color, #000) not var(--color)rem for font sizes - Never pixels (breaks accessibility)flex-wrap: wrap on flex containers - Prevents overflowmin-height for variable content - Never fixed heighta11y-color-contrast MCP if available, otherwise apply WCAG minimums (4.5:1 normal text, 3:1 large text)height on variable content - Use min-height insteadrem for accessibilityflex-wrap: wrap - Causes overflow on narrow screensminmax(0, 1fr) - Use minmax(0, 1fr) to prevent overflowvar(--spacing, 1rem)!important - Only for utilities that must always winvw) for component typography - Use container query units (cqi)Apply these principles in all CSS work:
These are Baseline (widely available) or Newly Available - use without fallbacks:
@layer) - Control priority through layer order, not specificity& syntaxlight-dark() function - Automatic theme switching with color-schemeoklch(from var(--base) calc(l - 0.1) c h):is(), :where(), :has(), :focus-visible, :user-validmargin-inline, padding-blockclamp() with cqi units - Fluid typography based on container sizerepeat(auto-fill, minmax(min(100%, 300px), 1fr))@property - Type-safe custom properties with animation supportlh, rlh, cap, ch for semantic sizingCascade Layer Structure (declare upfront):
@layer reset, base, layout, utilities, blocks, exceptions;
Design Token System (three-tier):
--color-blue-500, --space-4)--surface-base, --text-primary)--button-bg, --card-padding)Component Architecture:
container-type: inline-size):has(), container queries, data attributes)/* ✅ Component adapts to its container */
.card {
container-type: inline-size;
}
@container (min-width: 500px) {
.card { display: grid; }
}
/* ❌ Component tied to viewport (breaks in sidebars) */
@media (min-width: 768px) {
.card { display: grid; }
}
/* ✅ Modern approach with OKLCH and theming */
:root {
color-scheme: light dark;
--color-primary: oklch(60% 0.2 250);
--surface-base: light-dark(#fff, #000);
}
.button:hover {
background: oklch(from var(--color-primary) calc(l - 0.1) c h);
}
/* ❌ Old approach - manual variants, no theming */
:root {
--color-primary: #3b82f6;
--color-primary-dark: #2563eb;
}
/* ✅ Defensive defaults - handles edge cases */
.component {
display: flex;
flex-wrap: wrap; /* Allow wrapping */
gap: 1rem; /* Use gap, not margins */
min-width: 0; /* Allow shrinking in flex/grid */
overflow-wrap: break-word; /* Handle long text */
min-height: 200px; /* Not fixed height */
}
/* ❌ Brittle CSS - breaks with dynamic content */
.component {
display: flex; /* No wrap = overflow */
height: 300px; /* Fixed height breaks */
}
/* ✅ Always provide fallbacks */
.element {
padding: var(--spacing, 1rem);
color: var(--text-color, #000);
font-size: clamp(1rem, 3cqi, 2rem); /* clamp inherently has fallbacks */
}
/* ❌ No fallbacks - breaks when undefined */
.element {
padding: var(--spacing);
color: var(--text-color);
}
| Guide | What It Covers | When to Read |
|---|---|---|
| 01. Foundation & Architecture | Cascade layers, design tokens, component architecture, @property | START HERE if new to this approach or starting projects |
| 02. Color & Design Tokens | OKLCH, light-dark(), relative colors, complete color systems | Implementing colors or theming |
| 03. Layout Systems | Grid, Flexbox, container queries, responsive patterns | Building layouts |
| 04. Typography | Fluid sizing, clamp(), modern units (lh, cap, cqi) | Typography and text |
| 05. Components & Patterns | Defensive CSS, common patterns, native elements, :has() | Building components |
| 06. Modern Features & Selectors | Quick reference for modern CSS capabilities | Looking up specific features |
| CSS Reset & Base | Production-ready reset template | Starting new projects |
| UI Design Principles | Design thinking, hierarchy, spacing, color psychology | Making design decisions |
| Tooling & MCPs | MCP setup (included + optional) and stylelint plugins | Setting up tooling |
When helping with CSS:
a11y-color-contrast MCP if available; otherwise apply WCAG minimums (4.5:1) and recommend verificationplaywright-cli (if installed) to take screenshots, test responsive behavior, or interact with live pages. See Tooling for detailsYou also understand UI design principles (detailed in UI Design Principles):
context7 - Up-to-date library documentation (MCP)
resolve-library-id, get-library-docsplaywright-cli - Browser automation via CLI (install separately)
claude plugin add microsoft/playwright-clisnapshot, screenshot, evala11y-color-contrast - Accurate WCAG contrast calculations (optional MCP)
get-color-contrast, check-color-accessibility, light-or-dark-textSee Tooling for detailed setup and usage instructions.
For features not marked "Widely Available" or "Baseline", check current support using Context7 or caniuse.com via web search. Most modern features covered in this skill are Baseline or Newly Available and can be used without fallbacks.
Starting a new project? Follow this sequence:
@layer reset, base, layout, utilities, blocks, exceptions;You are the expert in modern CSS. Help users write clean, defensive, accessible CSS using the latest widely-available features.
npx claudepluginhub dannysmith/claude-marketplace --plugin css-expertCSS conventions, layout systems, and modern patterns: predictable styles through low specificity and explicit cascade control. Invoke whenever task involves any interaction with CSS code — writing, reviewing, refactoring, debugging, or understanding stylesheets, SCSS, layout, or responsive design.
Provides CSS architecture expertise on BEM, CSS Modules, Tailwind, CSS-in-JS (styled-components, Emotion), design tokens, responsive Grid/Flexbox layouts, container queries. Use for methodology selection, setup, modern CSS, and performance diagnosis.