css-conventions
CSS conventions for authoring and reviewing CSS, SCSS, CSS Modules, design tokens, and responsive layouts. Use whenever a task changes or reviews styling, regardless of framework.
Works with
---
name: css-conventions
description: CSS conventions for authoring and reviewing CSS, SCSS, CSS Modules, design tokens, and responsive layouts. Use whenever a task changes or reviews styling, regardless of framework.
license: Unlicense
---
# CSS conventions
Follow the target repository's browser baseline, styling system, resets, tokens, and nearby patterns first.
## Browser support
- Inspect `.browserslistrc`, the `browserslist` field in `package.json`, and relevant build configuration before choosing CSS features, prefixes, polyfills, or fallbacks.
- Treat the repository's declared browser targets as the compatibility boundary. Do not add workarounds for older browsers outside that boundary, and do not use unsupported features without the fallback required by browsers inside it.
## Existing styles and tokens
- Do not choose semantic elements for their default display; use `<p>` for paragraphs, `<span>` for inline text, and `<div>` for generic block containers.
- Inspect global reset and base styles before adding local resets. Do not repeat `margin`, `padding`, or `list-style` resets already applied to the target element.
- Reuse existing semantic design tokens and verify each referenced custom property is declared. Do not invent a token or a new size for every literal value.
## Intrinsic sizing
- Add `min-inline-size: 0` or `min-block-size: 0` only for demonstrated intrinsic overflow, Grid/Flex shrinking, native-control overflow, or `0fr` disclosure collapse.
- Explain non-obvious intrinsic sizing constraints with a short CSS comment at the declaration.
## CSS Modules and selector ownership
- Keep the element's structural class local to the module. Express transient state with a state class or attribute instead of stacking module-local state classes.
- Prefer local class selectors over broad nested element selectors.
- Nest ancestor-state selectors under the class they style: `.title { .card:hover & { ... } }`, not `.card:hover .title`.
## Scoped custom properties
- Create a semantic custom property only when multiple related selectors share a non-trivial value that must change together.
- Define it at the narrowest shared scope and derive its raw value from existing tokens when available.
- Do not create a custom property for a one-off value or coincidental repetition.
```css
.menu {
--entry-padding: 0 var(--spacing-16);
}
.item {
padding: var(--entry-padding);
}
.emptyState {
padding: var(--entry-padding);
}
```More Design Systems skills
stitch-design-taste
leonxlnx/taste-skill
Semantic Design System Skill for Google Stitch. Generates agent-friendly DESIGN.md files that enforce premium, anti-generic UI standards — strict typography, calibrated color, asymmetric layouts, perpetual micro-motion, and hardware-accelerated performance.
figma
heygen-com/hyperframes
Import Figma content into a HyperFrames composition — rendered assets, brand tokens, components, storyboard sections → reconstructed motion (frames read as states, not slides) (REST/CLI), connector-assisted motion when available, and shaders from a connector or native export. Use when the user pastes a figma.com link or asks to bring a Figma design, frame, logo, brand, or animation into a video/composition.
image
coreyhaines31/marketingskills
When the user wants to create, generate, edit, or optimize images for marketing — blog heroes, social graphics, product mockups, profile banners, listing visuals, or brand assets. Also use when the user mentions 'AI image generation,' 'generate an image,' 'create a graphic,' 'product mockup,' 'hero image,' 'social media graphic,' 'banner image,' 'cover photo,' 'profile banner,' 'listing screenshot,' 'Flux,' 'Flux Kontext,' 'Midjourney,' 'DALL-E,' 'GPT Image,' 'ChatGPT Images,' 'Ideogram,' 'Gemini image,' 'Nano Banana,' 'Recraft,' 'Stable Diffusion,' 'Canva,' 'Figma,' 'image optimization,' 'compress images,' 'WebP,' or 'OG image.' Use this for general-purpose marketing image creation and optimization. For paid ad image creative and platform-specific ad specs, see ad-creative. For video production, see video.

