styling-bem-component

Applies BEM-based SCSS styling conventions to Angular kit components using design tokens.

1|Updated Jan 14, 2024
One-click install
npx skills add https://github.com/Eyhenij/rt-tools --skill styling-bem-component-eyhenij
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: styling-bem-component
Source: https://github.com/Eyhenij/rt-tools/tree/main/.claude/skills/styling-bem-component
Command: npx skills add https://github.com/Eyhenij/rt-tools --skill styling-bem-component-eyhenij

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When editing the styles of a kit component or the public site, developers often break conventions by hardcoding colors, misplacing layout rules, or fighting kit defaults with !important. This Skill enforces the project's BEM styling pattern so component styles stay consistent, token-driven, and override-safe. ## Core Features & Use Cases - :host block structure: Defines how the host carries the block class, how elements nest inside it, and how modifiers are written with &--<name> or class bindings. - Token-only values: Enforces that all colors, shadows, radii, and fonts come from --<prefix>-* CSS custom properties, forbidding raw hex values and SCSS variables. - Kit default overrides: Explains how to override ViewEncapsulation.None kit styles using descendant selectors instead of !important. - Use Case: While restyling a badge component in @rt-tools/ui-kit-v2, load this Skill to write the :host block, apply --<prefix>-color-* tokens, and override a kit default without breaking specificity rules. ## Quick Start Load the styling-bem-component pattern and restyle this kit component's SCSS following the BEM and design-token conventions.

Frequently Asked Questions about styling-bem-component

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

FAQPage Schema
How do I style an Angular component with BEM and design tokens?

Put the block class on `:host`, nest elements inside it, and write modifiers as `&--<name>` or host class bindings. All values must reference CSS custom properties like `var(--<prefix>-color-surface)` rather than raw hex codes or SCSS variables.

How to override Angular component library styles without !important?

Write the override as a descendant of your block, such as `& &__item`, so it shares specificity with the kit default and wins by inclusion order. `!important` is forbidden and cannot beat inline styles anyway.

Can I use SCSS variables for colors in an Angular design system?

No, SCSS variables like `$primaryColor` are not used for styling values in this pattern. Composite values such as shadows must be taken as whole ready-made tokens, for example `var(--<prefix>-shadow-sm)`.

When should layout styles not go on a component :host?

Screen-level layout such as `display: flex` with `gap` and `padding` on `:host` belongs to the application's shared layer, not the component pattern. This Skill covers component styling only; screen layout is handled by the separate styling-bem-layout pattern.

Why is a stylelint disable comment a problem in component styles?

Selectors should be joined through nesting rather than by disabling the lint rule. Pre-existing linter remarks in a file are also fixed along with new ones, and new declarations are only added when the task is a feature.