Design and implement production-grade CSS architecture: design token systems, CSS Layers (@layer), @scope, container queries, Tailwind v4 config, dark mode strategy, component scoping. Use when user asks to "design CSS architecture", "set up design tokens", "organize styles", or "configure Tailwind".
The canonical home for this skill is css-architecture in JaviMontano/mao-sovereign-architect
Design scalable, maintainable CSS systems using modern cascade control, design tokens, and component-scoped styles.
"CSS architecture is not about preventing specificity wars — it's about designing a cascade that makes the right style always win without fighting."
grep -r "@import\|@use\|require.*css\|import.*\.css" src/ to map all CSS entry points.grep -r "!important" src/ --include="*.css" -l.:root blocks.grep -r "@media" src/ --include="*.css" | grep -oP '\d+px' | sort -u.[HECHO] for code evidence, [INFERENCIA] for patterns inferred from structure.--color-blue-500: #3b82f6, --space-4: 1rem.--color-brand-primary: var(--color-blue-500).--button-bg: var(--color-brand-primary).tokens/README.md.Decision: Token Format
| Approach | When to Use | Trade-off |
|---|---|---|
| Pure CSS custom props | Web-only, no native apps | No build step, live in browser |
| Style Dictionary + CSS output | Multi-platform (web + iOS + Android) | Build step required |
| Tailwind v4 @theme | Tailwind projects | Colocation with utility classes |
| CSS-in-JS (Vanilla Extract) | TypeScript-heavy, SSR projects | Type-safe, zero-runtime |
@layer statement to establish order.@layer reset, base, tokens, components, patterns, utilities, overrides;reset or base layer to neutralize specificity.@layer components.@scope (.component-root).sm, md, lg, xl, 2xl).clamp() to reduce breakpoint-specific overrides.@container on key components before committing to approach.[data-theme="dark"] or @media (prefers-color-scheme: dark).color-scheme: light dark to :root for native form element theming.prefers-color-scheme), visual regression, manual QA.@theme directive to define design tokens inside CSS (replaces tailwind.config.js).--color-*, --spacing-* conventions.@utility for one-off custom utilities not worth tokenizing.@layer components for multi-property component classes.content paths in CSS with @source directive.(0,2,0) outside overrides layer.!important outside utilities layer.| Signal | Recommended Architecture |
|---|---|
| New React/Next.js project | Tailwind v4 + CSS Modules for complex components |
| Existing BEM codebase | Add CSS Layers, wrap BEM in @layer components |
| Design system / component library | CSS custom properties + @scope + Style Dictionary |
| Web components | Shadow DOM + CSS custom properties for theming |
| Large legacy app (no build step) | CSS Layers only — zero migration cost |
| Multi-platform (web + native) | Style Dictionary → platform-specific output |
| Token Count | Maintenance Cost | Flexibility |
|---|---|---|
| < 50 tokens | Low | Limited |
| 50–200 tokens (recommended) | Moderate | High |
| > 500 tokens | High | Very High |
!important as specificity band-aid — Signals broken cascade. Fix the layer strategy instead.--color-cta: var(--color-brand) creates fragile chains. Point to primitives.body {} or html {} inside a component's CSS file causes side effects. Scope everything..button and .button.dark doubles maintenance. Use token overrides.@apply in component files — Reintroduces CSS specificity problems. Prefer utility classes in markup or @layer components.color: var(--color-text) fails silently in unsupported contexts. Always provide fallback.tokens/primitives.css — Raw design tokenstokens/semantic.css — Semantic token mappingsstyles/layers.css — Layer declaration and importsstyles/base.css — Reset + base element stylestailwind.config.css — Tailwind v4 @theme block (if applicable)ADR-CSS-001.md — Architecture Decision Record for CSS strategyb56591e
Canonical home
since Aug 28, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.