agentsclimarketplace

Css standards

Skill KhaledRaedRabee/Opt-Plugins/skills/css-standards

Writes, refactors, and formats modern CSS3 (and SCSS) following current layout patterns (Grid, Flexbox, container queries), design-token architecture (CSS custom properties), and low-specificity, modular selector rules (BEM / CSS Modules). Use this whenever the user asks to write, review, refactor, clean up, or organize CSS, SCSS, or styling rules — including standalone stylesheets, component styles, or CSS embedded in a larger frontend task. Also use when the user asks to fix specificity issues, reduce `!important` usage, convert float/absolute-position layouts to Grid/Flexbox, set up design tokens or a theming system, or make styles responsive. Applies even if CSS is just one part of a bigger request (e.g., building a landing page or component) — any time CSS is being authored or touched, this skill's conventions should be applied.From its SKILL.md

Install
npx -y skills add KhaledRaedRabee/Opt-Plugins --skill css-standards

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

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

11.2 KB, as published. Nobody here has run it

CSS Standards

A skill for writing and reviewing CSS that is consistently formatted, uses modern layout tools instead of legacy hacks, and stays maintainable through low specificity and design tokens.

Why this matters

CSS doesn't have a compiler stopping you from writing something that "works" but is fragile — three levels of nested selectors, a magic pixel value copy-pasted six times, a float-based layout that breaks the moment content changes. None of that throws an error; it just makes the next change harder than it needed to be. The standards below aren't about a single "correct" style — they're about writing CSS where specificity stays low, values are defined once and reused, and layout is expressed with the tools built for layout (Grid, Flexbox) instead of tools repurposed for it (floats, absolute positioning).

Treat every CSS-writing or CSS-reviewing task as a chance to apply these standards, not just when the user explicitly asks for a "CSS audit."

Workflow

  1. If reviewing/refactoring existing CSS: read the file first, then check specificity and !important usage before anything else — those are the ones that cause real pain later and are easy to skim past when you're focused on formatting.
  2. If writing new CSS: define tokens first (or reuse existing ones if the project has a token system), then write selectors against them, rather than hardcoding values and extracting them into variables afterward.
  3. When done, if you made non-trivial changes, briefly summarize what changed and why (e.g., "replaced 3 float-based layouts with Grid, pulled the repeated color/spacing values into custom properties, flattened a .card .header .title span selector down to a single BEM class"). Keep it short unless the user asked for a full audit.

1. Syntax & formatting

  • Soft tabs, 2-space indentation.
  • Lowercase hex values (#fff, not #FFF), and shorten to 3/4-digit hex when the value allows it.
  • Double quotes for url() and font-family strings: url("./icon.svg"), font-family: "Inter", sans-serif.
  • A space before {, a space after :, and each declaration on its own line — never multiple declarations packed onto one line.
  • Omit units on zero values: margin: 0; not margin: 0px;.
/* Good */
.card {
  margin: 0;
  padding-block: 1rem;
  background-color: #fff;
  font-family: "Inter", sans-serif;
}

/* Avoid */
.card{margin:0px;padding-block:1rem;background-color:#FFFFFF;font-family:'Inter',sans-serif}

2. Property order within a rule

Order declarations by what they affect, outside-in — this makes rules scannable, since anyone looking for "why is this element positioned there" or "why is this element that size" knows which part of the block to check without reading the whole thing:

  1. Layout — display, position, inset*, grid-*, flex-*, z-index
  2. Box model — width, height, margin-*, padding-*, border, box-sizing
  3. Visual — color, background*, box-shadow, opacity, border-radius
  4. Typography — font-*, line-height, text-*, letter-spacing
  5. Misc / interaction — cursor, transition, animation, will-change
.button {
  /* Layout */
  display: inline-flex;
  align-items: center;

  /* Box model */
  padding-inline: var(--spacing-md);
  padding-block: var(--spacing-sm);
  border: none;
  border-radius: var(--radius-sm);

  /* Visual */
  background-color: var(--color-primary);
  color: var(--color-on-primary);

  /* Typography */
  font-size: 1rem;
  font-weight: 600;

  /* Misc */
  cursor: pointer;
  transition: background-color 150ms ease;
}

3. Modern layout & responsive design

  • Grid and Flexbox over floats/absolute positioning. Floats were a text-wrapping feature repurposed for layout, and absolute positioning pulls an element out of flow entirely — both make surrounding content brittle to change. Reach for Grid when arranging in two dimensions (rows and columns together) and Flexbox when arranging in one dimension (a row or a column of items). Reserve position: absolute/fixed for things that are genuinely meant to break out of flow (tooltips, modals, badges pinned to a corner) — not as a general layout mechanism.
  • Mobile-first media queries. Write the base (unqualified) rules for the smallest viewport, then layer on complexity with min-width queries as the viewport grows: @media (min-width: 768px) { ... }. This means small-screen styles aren't fighting an override further down the cascade, and every device gets the styles meant for it rather than a desktop layout squeezed down.
  • Container queries for component-level responsiveness. When an element's layout should respond to the size of its own container rather than the viewport (e.g., a card that's full-width in a narrow sidebar but two-column in a wide main area), use @container instead of @media. This is what makes a component actually reusable in different layout contexts — a media query can't tell the difference between "narrow viewport" and "narrow column in a wide viewport," but a container query can.
    • Don't convert a @media rule to @container unless there's actual evidence the component lives in more than one container width — e.g. the project has a component library, the element is visibly reused across different layout contexts in the file/repo, or the user says as much. Adding container-type and switching to @container changes what the styles respond to (container size instead of viewport size), which is a behavior change, not a pure refactor — applying it on a guess can silently break the one context the component actually appears in. When you suspect a component would benefit from container queries but can't confirm it's reused elsewhere, say so as a suggestion in your summary ("this could be a container query if .gallery ever appears in a narrower parent — let me know if so") rather than applying it unprompted.
  • Logical properties over physical ones. Use margin-inline, padding-block, inset-inline-start, border-block-end, etc. instead of margin-left/padding-top/left/border-bottom. Logical properties follow the document's writing mode and text direction automatically, so styles don't silently break in right-to-left languages — physical properties assume left-to-right and have to be manually mirrored otherwise.
/* Mobile-first + container query + logical properties */
.card {
  padding-inline: var(--spacing-md);
  padding-block: var(--spacing-md);
}

@media (min-width: 768px) {
  .card {
    padding-inline: var(--spacing-lg);
  }
}

.card-grid {
  container-type: inline-size;
}

@container (min-width: 480px) {
  .card {
    display: grid;
    grid-template-columns: auto 1fr;
  }
}

4. Architecture & specificity

  • Design tokens as custom properties at :root. Colors, spacing, radii, font sizes — anything reused more than once — gets defined once as a custom property (--color-primary, --spacing-md) and referenced everywhere via var(). This is what makes a rebrand or a spacing-scale change a one-line edit instead of a find-and-replace across the whole codebase.
  • BEM or CSS Modules to prevent selector leaking. Pick one and stay consistent within a project. BEM (.card, .card__title, .card--featured) keeps selectors flat and self-documenting through naming instead of nesting. CSS Modules get the same isolation through build-time scoping instead of naming convention — either is fine, but don't mix a BEM-named class with three levels of descendant nesting on top of it.
  • Keep specificity flat — max selector depth of 2. A selector like .page .sidebar .widget .title is fragile: it only works as long as that exact DOM nesting holds, and overriding it later requires matching or exceeding its specificity. Prefer a single class (.widget-title) or at most a parent-child pair (.widget .title) over deep descendant chains.
  • !important is forbidden except in dedicated utility/override classes. A utility class like .u-hidden { display: none !important; } is meant to win unconditionally by design — that's a legitimate use. Reaching for !important inside a normal component rule to beat unexpected specificity elsewhere is a sign the specificity got away, and the fix is to flatten the selectors, not to escalate.
:root {
  --color-primary: #2563eb;
  --color-on-primary: #fff;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --radius-sm: 4px;
}

/* BEM, flat specificity, tokens */
.card {
  padding: var(--spacing-md);
  border-radius: var(--radius-sm);
}

.card__title {
  font-size: 1.125rem;
  color: var(--color-primary);
}

.card--featured {
  border: 2px solid var(--color-primary);
}

/* Utility override — the one place !important belongs */
.u-hidden {
  display: none !important;
}

Review checklist

When auditing existing CSS, walk through in this order — specificity and layout-tooling issues cause the most downstream pain, so check those before formatting:

  1. Any !important outside a clearly-named utility class? Flag and trace what it's overriding.
  2. Any selector deeper than 2 levels, or ID selectors used for styling? Flatten toward BEM/single classes.
  3. Repeated literal values (colors, spacing, radii) that should be design tokens?
  4. Layout built with floats or position: absolute where Grid/Flexbox would be more robust?
  5. Media queries written max-width-first (desktop-down) instead of min-width-first (mobile-up)?
  6. Physical direction properties (margin-left, padding-top, etc.) that should be logical properties?
  7. Formatting: 2-space indent, lowercase hex, double-quoted strings, one declaration per line, no unit on zero.

Severity: structural issues first, formatting last

Mirror the same triage used for any code review — lead with what actually causes bugs or maintenance pain, not with what's easiest to spot:

  • Structural risk — !important fights, deep/fragile selectors, hardcoded values duplicated across the file. These cause real bugs when someone touches the CSS later.
  • Modernization opportunities — float/absolute-position layouts that could be Grid/Flexbox, max-width media queries that could be mobile-first, physical properties that could be logical. The page works today but isn't following current best practice.
  • Formatting nits — indentation, quote style, zero-unit omission. Fix opportunistically; don't lead a summary with these.

Keep looking

Skills are one crate of 607,533. 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.