Back to Skills

uplifting-components-to-slds2

Migrate Lightning Web Components from SLDS 1 to SLDS 2 by running the SLDS linter and fixing violations. Use this skill whenever users mention SLDS 2, SLDS uplift, linter violations, LWC token migration, class overrides, hardcoded CSS values that need SLDS hook replacement, or styling hook selection. Covers all styling hook categories — color, spacing, sizing, typography, borders, radius, and shadows. Also use when users mention no-hardcoded-values, no-slds-class-overrides, lwc-to-slds-hooks, no

608stars215forksUpdated 6/25/2026

Security Assessment

Safe(100/100)
Security Score100/100

About uplifting-components-to-slds2

Uplifting Components to SLDS 2 migrates Lightning Web Components from SLDS 1 to SLDS 2 by running the SLDS linter and systematically fixing the violations it reports. It activates whenever users mention SLDS 2, an SLDS uplift or migration, linter violations, LWC token migration, class overrides, hardcoded CSS values that need styling-hook replacement, or specific rule names such as no-hardcoded-values, no-slds-class-overrides, lwc-to-slds-hooks, and no-deprecated-tokens-slds1. It covers all styling hook categories -- color, spacing, sizing, typography, borders, radius, and shadows -- where color hooks require the most judgment (context-dependent selection) and non-color hooks are mostly numbered scales with straightforward mappings.

The workflow always begins by running the linter with `npx @salesforce-ux/slds-linter@latest lint --fix .`, a mandatory non-optional step that auto-fixes simple violations across CSS and markup files (.html for LWC, .cmp for Aura) and reports the rest. The output is then analyzed for four violation types, each with its own fix approach and dedicated reference guide: no-hardcoded-values-slds2 (replace hardcoded values with an SLDS hook plus the original as a fallback), lwc-token-to-slds-hook (replace --lwc-* tokens with an SLDS 2 hook, keeping the LWC token as fallback), no-slds-class-overrides (create a component-prefixed class and add it to markup alongside the SLDS class), and no-deprecated-tokens-slds1 (replace legacy t()/token() syntax). The linter flags all hardcoded values, but layout values such as 100%, auto, 0, inherit, and none are skipped.

Hook selection follows a context-first rule. For any color property (color, background-color, background, fill, border-color) the color-hooks decision guide must be read before choosing, because the linter lists candidate hooks in no particular order and the first suggestion should not be picked blindly; non-color hooks are matched to a numbered scale via lookup tables. Class overrides require changes to both CSS and markup -- renaming the selector and adding the new class alongside the original SLDS class, never removing it -- which is the most commonly missed step. A feedback loop re-runs the linter until zero errors remain, and a validation checklist confirms outcomes such as no remaining .slds-* selectors, all hooks carrying fallback values, numbered spacing and typography hooks, and correct rendering in light/dark mode and density settings. Prerequisites include Node.js 14.x or higher and access to the component CSS and markup files.

FAQ

What is the required first step of the migration?

Always run `npx @salesforce-ux/slds-linter@latest lint --fix .` first. This mandatory step auto-fixes simple violations across CSS and markup files and reports the remaining ones that need manual fixes.

Which hardcoded values should I not replace?

Fix color, spacing, sizing, typography, border, and shadow values, but skip layout values such as 100%, auto, 0, inherit, and none. The linter flags all hardcoded values, so a fix-vs-skip triage table covers the distinction.

How do I choose the right color hook?

For any color property such as color, background-color, background, fill, or border-color, read the color-hooks decision guide before choosing. The linter lists candidate hooks in no particular order, so do not pick the first suggestion.

What is special about fixing class overrides?

Class overrides require changes to both CSS and markup: rename the .slds-* selector to a component-prefixed class and add that class alongside the SLDS class in the markup, never removing the original SLDS class. This is the most commonly missed step.

What are the prerequisites and how do I confirm completion?

Prerequisites include Node.js 14.x or higher and access to the component CSS and markup files. Re-run the linter in a feedback loop until it shows zero errors, and confirm the validation checklist, ensuring every styling hook includes a fallback value.

All Files

10 files
references/rule-no-hardcoded-values.md6.7 KB
View
references/rule-no-slds-class-overrides.md3.5 KB
View
SKILL.md12.3 KB
View
references/color-hooks-decision-guide.md17.4 KB
View
references/common-patterns.md2.8 KB
View
references/examples.md10.8 KB
View
references/migration-checklist.md2.6 KB
View
references/non-color-hooks-decision-guide.md13.2 KB
View
references/rule-lwc-token-to-slds-hook.md4.9 KB
View
references/rule-no-deprecated-tokens-slds1.md7.4 KB
View

Install uplifting-components-to-slds2

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill