css

Guides authoring of maintainable, accessible CSS with specificity, units, and refactoring patterns.

3|Updated Nov 8, 2014
One-click install
npx skills add https://github.com/mintuz/.dotfiles --skill css-mintuz
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: css
Source: https://github.com/mintuz/.dotfiles/tree/main/agents/.agents/skills/css
Command: npx skills add https://github.com/mintuz/.dotfiles --skill css-mintuz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing CSS that stays maintainable as a codebase grows is hard: specificity wars, reactive !important, margin chaos, and dead selectors accumulate quickly. This Skill provides architectural principles, decision trees, and refactoring workflows so stylesheets remain predictable, accessible, and easy to change. ## Core Features & Use Cases - Specificity and Cascade Management: Rules for avoiding ID selectors, using self-chaining and attribute selectors, applying cascade layers correctly, and reserving !important for immutable utilities or documented external boundaries. - Units, Margins, and Layout Guidance: A rem vs px decision framework, single-direction margin patterns, margin collapse rules, and layout algorithm awareness across Flow, Flexbox, and Grid. - Refactoring and Dead Code Detection: The Three I's refactoring workflow (Identify, Isolate, Implement), beacon-based dead CSS detection, and code smell reference tables. - Use Case: When building a new component library, consult the patterns reference to structure classes with single responsibility, keep components margin-free, and define spacing scales with CSS custom properties. ## Quick Start Use the css skill to review my stylesheet and refactor it following specificity, units, and margin best practices.

Frequently Asked Questions about css

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage CSS specificity without using !important?▼

Increase specificity safely by self-chaining classes like .btn.btn, replacing ID selectors with attribute selectors like [id="x"], or reordering source and cascade layers. Reserve !important for immutable utility classes or documented external boundaries.

Should I use rem or px for CSS font sizes and spacing?▼

Use rem for anything that should scale with user font preferences: font-size, text spacing, padding around text, and media queries. Use px for fixed visual details like borders, border-radius, and box-shadows.

When should I use @extend vs mixins in Sass?▼

Use @extend only for thematically related selectors within the same component, since it disrupts source order and creates unexpected groupings. Use mixins for coincidentally similar styles, as compiled repetition is handled by gzip.

How do I find and remove dead CSS from a stylesheet?▼

Add a beacon background-image with a unique URL to suspect selectors, verify requests reach server logs, and monitor for 2-3 months. Treat zero-request selectors as deletion candidates and remove them in small, reversible increments.

Why should components not have margin in CSS?▼

Margin on components breaks encapsulation by adding invisible space outside their visual boundaries and reduces reusability across contexts. Move spacing to the parent layout using gap, single-direction margin flows, or utility classes instead.

Does this CSS guidance apply to Tailwind projects?▼

No, this Skill explicitly excludes Tailwind projects using tailwind.config.js, utility classes, CVA variants, or Tailwind theme tokens. It targets plain CSS and preprocessor-based stylesheets with custom-property design scales.