| name | css-modern-features |
| description | Use this skill whenever writing, reviewing, or refactoring any CSS, whether in plain .css files, styled-components, CSS Modules, Tailwind arbitrary values, inline styles in React/Vue/Svelte, or any other frontend context. This skill ensures modern CSS features are used wherever browser support allows — things like clamp(), :has(), container queries, OKLCH colors, scroll-driven animations, anchor positioning, @starting-style, light-dark(), text-wrap: balance, and more. Trigger this skill any time CSS is being written or touched, even indirectly (e.g. a component that needs responsive sizing, a theme system, an animation, a layout). Do NOT default to legacy patterns like px-based media queries, JS-driven animations, or CSS-in-JS workarounds when a native modern CSS feature exists and is supported by the project's browser targets.
|
Modern CSS Skill
Write CSS that uses the most capable, expressive features available for the project's browser targets.
Never reach for a legacy workaround when a modern native feature is supported.
Step 1 — Detect Browser Targets
Before writing any CSS, resolve the project's browser target. Check in this order:
1a. package.json
"browserslist": ["> 1%", "last 2 versions", "not dead"]
or a "browserslist" key pointing to a config.
1b. .browserslistrc file
> 1%
last 2 versions
not dead
1c. Framework-specific configs
- Vite:
build.target in vite.config.*
- Next.js: check
next.config.* for browserslist or transpilePackages
- Astro:
build.target in astro.config.*
1d. No config found → assume Tier 2 (conservative-modern)
Step 2 — Map Targets to Feature Tiers
Once you know the targets, map them to a tier:
| Tier | Typical Target | Description |
|---|
| Tier 0 | Latest Chrome/Edge only, or explicit opt-in | Experimental — @supports required, JS fallback recommended |
| Tier 1 | Last 1–2 Chrome/Edge/Firefox/Safari | Bleeding edge — use everything stable |
| Tier 2 | Last 2 versions / > 0.5% | Modern baseline — most features safe |
| Tier 3 | > 1% / IE excluded but Safari 15- included | Be selective — use @supports guards |
| Tier 4 | IE 11 or legacy Android included | Stick to fundamentals + polyfills |
Quick heuristic: if the browserslist resolves to Chrome 125+, Safari 17.5+, Firefox 128+ → Tier 1.
If it resolves to Chrome 111+, Safari 16.4+, Firefox 113+ → Tier 2.
If it resolves to Chrome 105+, Safari 15+, Firefox 110+ → Tier 3.
Use npx browserslist in the project root to get the exact resolved list when uncertain.
Step 3 — Apply the Modern CSS Checklist
Before finalizing any CSS, run through this checklist. Each item has a minimum tier.
🎨 Color & Theming
📐 Layout & Sizing
🎯 Selectors & Logic
✨ Animation & Transitions
🔤 Typography
📍 Positioning
🎨 Visual Effects
🧱 Component Patterns
🔧 Architecture
🧪 Experimental (Tier 0 — @supports required)
Step 4 — @supports Guards for Tier 3
When writing for Tier 3, wrap cutting-edge features with @supports and provide a functional fallback:
.card {
color: hsl(220 80% 50%);
}
@supports (color: oklch(0 0 0)) {
.card {
color: oklch(0.55 0.2 260);
}
}
For layout:
.grid {
display: flex;
flex-wrap: wrap;
}
@supports (grid-template-rows: subgrid) {
.grid {
display: grid;
grid-template-rows: subgrid;
}
}
Step 5 — Tailwind Arbitrary Values
When using Tailwind, modern CSS features belong in arbitrary values rather than custom CSS files when they're one-off utilities:
<h1 class="text-[clamp(1.5rem,4vw,3rem)]">
<div class="bg-[oklch(0.7_0.15_200)]">
<div class="h-[100dvh]">
<p class="[@container(min-width:400px)]:text-lg">
<div class="gap-[var(--space-md)]">
<div class="text-[light-dark(#111,#eee)]">
<div class="[position-anchor:--my-anchor]">
<nav class="backdrop-blur-md bg-white/70">
<section class="scroll-mt-16">
<input type="checkbox" class="accent-[oklch(0.6_0.2_260)]">
For reusable patterns, extend tailwind.config.* with the feature value rather than repeating arbitrary syntax.
Feature Reference
For full browser support tables, syntax examples, and implementation patterns, load the relevant section from:
references/color.md — OKLCH, color-mix, relative color, light-dark
references/layout.md — clamp, container queries, subgrid, field-sizing, dvh units, math functions
references/selectors.md — :has(), @layer, @scope, nesting
references/animation.md — scroll-driven, @starting-style, view transitions, offset-path
references/typography.md — text-wrap, cap unit, font-size-adjust, ::marker, counter()
references/positioning.md — anchor positioning, logical properties, scroll-margin
references/misc.md — @property, content-visibility, popover, backdrop-filter, blend modes, clip-path
references/components.md — accent-color, env(), media features, scrollbar, margin-trim, scroll-snap
references/experimental.md — interpolate-size, masonry, if(), @function, reading-flow (watch list)
references/houdini.md — Paint Worklet, CSS.registerProperty() (load only when building design systems or custom paint effects)
Load a reference file when you need exact syntax, browser version floors, or @supports patterns for a specific feature. Do not load all reference files at once.
Non-Claude Agent Usage
This skill is framework- and model-agnostic. Any agent writing CSS should:
- Read
package.json / .browserslistrc for targets
- Map to a tier using the table in Step 2
- Run the checklist in Step 3 before finalizing output
- Wrap Tier-3-only features in
@supports
- Apply modern features in Tailwind arbitrary values where applicable
The reference files in references/ are plain markdown — load them as context as needed.