agentsclimarketplace

Modern css

Skill ccheney/robust-skills/skills/modern-css

Robust skills for Agents

Install
npx -y skills add ccheney/robust-skills --skill modern-css

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

Proactively apply when creating design systems, component libraries, or any frontend application. Triggers on CSS Grid, Subgrid, Flexbox, Container Queries, :has(), @layer, @scope, CSS nesting, @property, @function, if(), oklch, color-mix, light-dark, relative color, @starting-style, scroll-driven animations, view transitions, anchor positioning, popover, customizable select, content-visibility, logical properties, text-wrap, interpolate-size, clamp, field-sizing, modern CSS, CSS architecture, responsive design, dark mode, theming, design tokens, cascade layers. Use when writing CSS for any web project, choosing layout approaches, building responsive components, implementing dark mode or theming, creating animations or transitions, styling form elements, or modernizing legacy stylesheets. Modern CSS features and best practices for building interfaces with pure native CSS.

SKILL.md

11.1 KB, as published. Nobody here has run it

Modern CSS

Pure native CSS for building interfaces — no preprocessors, no frameworks.

When to Use (and When NOT to)

Support statuses below are as of mid-2026. "Newly Baseline (date)" means all three engines ship it, but users on older browsers won't have it — keep graceful degradation. Verify anything critical on MDN or webstatus.dev.

Use Freely (Baseline)Feature-Detect / Progressive Enhancement
CSS Grid, Subgrid, FlexboxScroll-driven animations (Firefox: behind flag)
Container queries — size; style (newly Baseline May 2026)Scroll-state queries (Chromium-only)
:has(), :is(), :where()::scroll-button(), ::scroll-marker (Chromium-only)
CSS Nesting, @layerCustomizable <select> (Chromium; Safari 27 announced)
@scope (newly Baseline Dec 2025)@function, if() (Chromium-only)
@property (typed custom props)sibling-index(), sibling-count() (no Firefox)
oklch(), color-mix(), light-dark(), relative colorTyped attr() beyond content (Chromium-only)
@starting-style, transition-behavior: allow-discreteCross-document view transitions (no Firefox)
View transitions — same-document (newly Baseline Oct 2025)interpolate-size, calc-size() (Chromium-only)
Anchor positioning (newly Baseline Jan 2026)popover="hint", interestfor (Chromium-only)
Popover API, <dialog>, invoker commands (newly Baseline Dec 2025)text-wrap: pretty, text-box (no Firefox)
field-sizing: content (newly Baseline Jun 2026)reading-flow (Chromium-only)
text-wrap: balance, linear() easingclosedby on <dialog> (no Safari)
Logical properties, ::details-contentGrid Lanes / masonry (Safari 26.4 only; flags elsewhere)
random() (Safari 26.2+ only), @mixin (no browser yet)

CRITICAL: The Modern Cascade

Understanding how styles resolve is the single most important concept in CSS. The additions of @layer and @scope fundamentally changed the cascade algorithm.

Style Resolution Order (highest priority wins):
┌─────────────────────────────────────────────────┐
│ 1. Transitions (active transition wins)         │
│ 2. !important (user-agent > user > author;      │
│    layer order INVERTS under !important)        │
│ 3. Unlayered author styles (beat ALL layers)    │
│ 4. @layer order (later layer > earlier layer)   │
│ 5. Specificity (ID > class > element)           │
│ 6. @scope proximity (closer root wins)          │
│ 7. Source order (later > earlier)               │
└─────────────────────────────────────────────────┘

Unlayered > Last layer > ... > First layer
           (utilities)        (reset)

Cascade layers (@layer) and scope proximity (@scope) are now more powerful than selector specificity. Define your layer order once (@layer reset, base, components, utilities;) and specificity wars disappear. Unlayered styles always beat layered styles — use this for overrides.

Quick Decision Trees

"How do I lay this out?"

Layout approach?
├─ 2D grid (rows + columns)         → CSS Grid
│  ├─ Children must align across    → Grid + Subgrid
│  └─ Waterfall / masonry           → display: grid-lanes (not yet cross-browser)
├─ 1D row OR column                 → Flexbox
├─ Component adapts to container    → Container Query + Grid/Flex
├─ Viewport-based responsiveness    → @media range syntax
└─ Element sized to content         → fit-content / min-content / stretch

"How do I style this state?"

Style based on what?
├─ Child/descendant presence        → :has()
├─ Container size                   → @container (inline-size)
├─ Container custom property        → @container style()
├─ Scroll position (stuck/snapped)  → scroll-state() query
├─ Element's own custom property    → if(style(...))
├─ Browser feature support          → @supports
├─ User preference (motion/color)   → @media (prefers-*)
└─ Multiple selectors efficiently   → :is() / :where()

"How do I animate this?"

Animation type?
├─ Enter/appear on DOM              → @starting-style + transition
├─ Exit/disappear (display:none)    → transition-behavior: allow-discrete
├─ Animate to/from auto height      → interpolate-size: allow-keywords
├─ Scroll-linked (parallax/reveal)  → animation-timeline: scroll()/view()
├─ Page/view navigation             → View Transitions API
├─ Custom easing (bounce/spring)    → linear() function
└─ Always: respect user preference  → @media (prefers-reduced-motion)

What CSS Replaced JavaScript For

JavaScript PatternCSS Replacement
Scroll position listenersScroll-driven animations
IntersectionObserver for revealanimation-timeline: view()
Sticky header shadow togglescroll-state(stuck: top)
Floating UI / Popper.jsAnchor positioning
Carousel prev/next/dots::scroll-button(), ::scroll-marker
Auto-expanding textareafield-sizing: content
Staggered animation delayssibling-index()
max-height: 9999px hackinterpolate-size: allow-keywords
Parent element selection:has()
Theme toggle logiclight-dark() + color-scheme
Tooltip/popover show/hidePopover API + invoker commands
Color manipulation functionscolor-mix(), relative color syntax

For non-Baseline features, always feature-detect with @supports or use progressive enhancement. Check MDN or Baseline for current browser support.

Anti-Patterns (CRITICAL)

Anti-PatternProblemFix
Overusing !importantSpecificity arms raceUse @layer for cascade control
Deep nesting (.a .b .c .d)Fragile, DOM-coupledFlat selectors, @scope
IDs for styling (#header)Too specific to overrideClasses (.header)
@media for component layoutViewport-coupled, not reusableContainer queries
JS scroll listeners for effectsJanky, expensiveScroll-driven animations
JS for tooltip positioningFloating UI dependencyAnchor positioning
JS for carousel controlsFragile, a11y issues::scroll-button, ::scroll-marker
JS for auto-expanding textareaUnnecessary complexityfield-sizing: content
max-height: 9999px for animationWrong duration, jankyinterpolate-size: allow-keywords
margin-left / padding-rightBreaks in RTL/verticalLogical properties (margin-inline-start)
rgba() with commasLegacy syntaxrgb(r g b / a) space-separated
appearance: none on selectsRemoves ALL functionalityappearance: base-select
Preprocessor-only variablesCan't change at runtimeCSS custom properties
Preprocessor-only nestingExtra build step dependencyNative CSS nesting
Preprocessor color functionsCan't respond to contextcolor-mix(), relative colors
text-wrap: balance on paragraphsPerformance-heavyOnly headings/short text
content-visibility above foldDelays LCP renderingOnly off-screen sections
Overusing will-changeWastes GPU memoryApply only to animating elements

Reference Documentation

Open the reference file BEFORE writing code in its area — each contains the sharp edges and support caveats that are easy to get wrong.

Read thisBefore doing
references/CASCADE.mdSetting up stylesheet architecture, @layer ordering, @scope, nesting, resolving specificity conflicts
references/LAYOUT.mdAny Grid/Subgrid/Flexbox layout, container queries, masonry, intrinsic sizing
references/SELECTORS.mdUsing :has(), :is()/:where(), :focus-visible, or modern pseudo-elements
references/COLOR.mdDefining palettes, dark mode with light-dark(), color-mix(), relative color, OKLCH
references/TOKENS.mdBuilding design tokens, animating custom properties (@property), @function, if(), math functions
references/ANIMATION.mdEntry/exit animations, @starting-style, animating to auto, view transitions, custom easing
references/SCROLL.mdScroll-linked effects, sticky-header states, carousels — anything replacing scroll listeners
references/COMPONENTS.mdTooltips, dropdowns, dialogs, popovers, anchor positioning, styled <select>, form field sizing
references/PERFORMANCE.mdcontent-visibility, typography tuning, logical properties, accessibility media queries, viewport units
references/CHEATSHEET.mdQuick lookups: legacy→modern upgrades, @supports tests, units, syntax tables

Sources

Official Specifications

Browser Vendor Blogs

Support Status (check these — support claims go stale fast)

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.