Skill library

Agent skill Frontend

Scss Best Practices

Build or refine reusable components for a web interface.

  • UI components
  • Design systems

Install the skill

Installation method

Run the command from your project root with Node.js and npm.

npx skills@latest add https://github.com/mindrally/skills/tree/main/scss-best-practices --skill scss-best-practices --agent claude-code --yes

Check this file in your project.claude/skills/scss-best-practices/SKILL.md

Other ways to install
  • Choose an assistant interactively

    npx skills@latest add https://github.com/mindrally/skills/tree/main/scss-best-practices --skill scss-best-practices

    Select your assistant and choose the project installation scope.

    Official instructions

The tested Skills CLI 1.10.0 requires Node.js 22.20 or later. Bring a Dart Sass project and its existing SCSS entry. Dart Sass 1.108.2 compiled the fixture. Tailwind CSS v4 uses a separate CSS pipeline.

View operation manual

What this skill helps with

  • Build or refine reusable components for a web interface.

Good for

  • Component implementation
Skill name
scss-best-practices
Scenario
Refactor one SCSS status card
Deliverable
A scoped SCSS patch with compiled selector, breakpoint, spacing and focus evidence.
Skill name
scss-best-practices

Define a styling task with a visible result

A request with an unclear outcome

Move all styles into a new 7–1 folder tree and convert every import.

Changing the entry chain and cascade order makes a card refactor harder to verify.

A workflow with observable results

  1. Locate the card and its Sass entry chain
  2. Move shared values behind Sass namespaces
  3. Compare emitted selectors and rendered states

SCSS Best Practices operation manual

Clarify a card's Sass modules, BEM classes and spacing rules while retaining its rendered states.

Replace the bracketed details with your own project and target.

  1. Locate the card and its Sass entry chain

    Record compiled states and shared dependencies.

    Prompt · Step 1
    Use scss-best-practices on [status card partial] in [Sass project]. Identify the actual Dart Sass version, style build command, entry file and consumers of the card classes. Capture the base, compact, focus and responsive rules as currently compiled. Propose a scoped module conversion preserving the existing cascade and class contract.
  2. Move shared values behind Sass namespaces

    Use a token map and breakpoint mixin with shallow selectors.

    Prompt · Step 2
    Use scss-best-practices to update [approved card scope]. Use namespaced @use for the existing token and breakpoint modules and sass:map as needed. Keep the block, title and compact modifier shallow. Preserve focus-visible or focus-within behavior from the design. Show where the component partial enters the compiled stylesheet.
  3. Compare emitted selectors and rendered states

    Run the same build, then check computed values and keyboard focus.

    • Existing BEM selectors still match their intended markup.
    • The local build and focused, compact and wider card states were checked.
    Prompt · Step 3
    Use scss-best-practices to run [existing Sass build] for [status card]. Compare emitted base, element and modifier selectors, breakpoint values and rule order. In the local preview, verify compact padding, title spacing on both sides of the breakpoint, and the focus indicator via keyboard. Report the stylesheet and computed values.

Find the relevant rule

Point the assistant to the installed Skill and a specific issue.

Shared variables are unclear after moving a partialReference
Command or reference
SKILL.md · Modern SCSS Features
Examples
Load the token module with @use and reference its named map.
A nested selector becomes too specificReference
Command or reference
SKILL.md · Nesting Rules
Examples
Flatten the component element or modifier, then check generated specificity.

SCSS Best Practices troubleshooting

Do I copy the older @import examples?

Dart Sass deprecated Sass @import in 1.80.0. Use @use for new module edits and compare the emitted cascade before migrating a wider entry chain.