<< All versions

Skill v1.0.0

currentLLM-judged scan90/100
dev-toolbelt/dev-team-agents/css-quality
──Details
PublishedOctober 24, 2026 at 03:30 PM
Content Hashsha256:f661691b11ff3668...
Git SHA4dc27c1974bc
──Files
Files (1 file, 4.0 KB)
SKILL.md4.0 KBactive
SKILL.md · 112 lines · 4.0 KB

version: "1.0.0" name: css-quality description: CSS quality — specificity, magic numbers, responsive. Agnostic.


CSS Quality

Detect the Project's Styling Strategy First

Before writing any CSS, identify what the project already uses:

SignalStrategy
tailwind.config.*, @apply, utility classes in markupUtility-first (Tailwind or equivalent)
*.module.css imports, styles.module.*CSS Modules
styled-components, @emotion/styled, css template literalsCSS-in-JS
.scss / .sass files, @mixin, @includeSass/SCSS
Global styles.css / main.css, BEM class namesGlobal CSS + BEM

Never mix strategies in the same codebase unless the project explicitly documents it.


Universal Rules (apply to every strategy)

No magic numbers

Every numeric value that carries design meaning must be a token or variable.

css
/* bad */
margin-top: 13px;
color: #3b82f6;
/* good */
margin-top: var(--spacing-3);
color: var(--color-primary);

Define tokens in a single source of truth (:root variables, a theme file, or Tailwind config). Duplication of raw values across files is a DRY violation.

No !important

!important signals a specificity conflict that should be solved at the source. The only accepted exceptions: third-party override utilities and print stylesheets.

No deeply nested selectors

Cap nesting at 3 levels. Deeper nesting creates high specificity that is hard to override and signals the component should be split.

css
/* bad — depth 4 */
.card .header .title span { }
/* good */
.card-title { }

Responsive: mobile-first by default

Use min-width breakpoints unless the project documents a desktop-first baseline. Mobile-first produces less CSS and is easier to override progressively.

css
/* good */
.container { width: 100%; }
@media (min-width: 768px) { .container { width: 720px; } }

Motion: respect user preferences

Any animation or transition must be wrapped in a prefers-reduced-motion guard.

css
@media (prefers-reduced-motion: no-preference) {
.card { transition: transform 200ms ease; }
}

will-change sparingly

Declare will-change only immediately before an animation triggers, not as a permanent style. Overuse forces GPU layers and increases memory consumption.


Strategy-Specific Rules

Utility-first (Tailwind)

  • Extract repeated utility combinations into a component or a @layer components class — not inline repetition across 10 files
  • Never write custom CSS to replicate what a Tailwind utility already does
  • Purge config must cover all template paths — unused utilities in production are a build quality issue

CSS Modules

  • One module per component file — no shared styles.module.css across components
  • Use camelCase class names in the module so they work naturally as JS properties
  • Avoid composing across module files (composes: foo from '../other.module.css') — creates implicit coupling

CSS-in-JS

  • Never inline complex style objects directly in JSX — extract to a named const or a separate styles file
  • Avoid dynamic styles that change on every render (new object reference each time) — memoize with useMemo or extract static styles outside the component

Global CSS + BEM

  • Block, Element, Modifier: block__element--modifier
  • One block per file
  • No element targeting a block from another file: .card .button is coupling, not composition

Anti-Patterns

Anti-PatternProblem
color: red / margin: 5px hardcodedBreaks design token consistency
Overriding with !importantMasks a specificity bug
Mixing responsive strategies (some mobile-first, some desktop-first)Unpredictable cascade
Animating width, height, top, leftTriggers layout — animate transform and opacity instead
CSS reset inside a componentBleeds into global scope; use scoped styles
Selector like div > ul > li > aFragile — breaks with any markup change
All versions