Skip to content

forcedotcom/sf-skills / skills/design-systems-slds2-migrate

design-systems-slds2-migrate

Verified

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-deprecated-tokens-slds1, or ask about SLDS component migration — even if they don't explicitly say "uplift" or "migration".

references/common-patterns.md

View on GitHub
# Common Patterns

Frequently encountered patterns, class lists, and edge cases for SLDS 2 migration.

---

## Deprecated SLDS 2 Classes

These classes are removed in SLDS 2. Remove them from markup (`.html` for LWC, `.cmp` for Aura):

| Deprecated Class | Action |
|---|---|
| `slds-icon-utility-error` | Remove — icon component handles styling |
| `slds-icon-utility-*` (all variants) | Remove — use icon component variants instead |

```html
<!-- Before -->
<span class="slds-icon_container slds-icon-utility-error">

<!-- After -->
<span class="slds-icon_container">
```

---

## Color Palette Fallbacks

When using palette hooks for data visualization or decorative color, include RGB fallbacks:

| SLDS2 Hook | RGB Fallback | Common Use |
|---|---|---|
| `--slds-g-color-palette-red-40` | `rgb(181,54,45)` | Critical indicators, data viz |
| `--slds-g-color-palette-blue-50` | `rgb(0,112,210)` | Brand colors, primary actions |
| `--slds-g-color-palette-green-50` | `rgb(4,132,75)` | Positive indicators, data viz |

```css
color: var(--slds-g-color-palette-red-40, rgb(181,54,45));
background: var(--slds-g-color-palette-blue-50, rgb(0,112,210));
```

For transparency with palette hooks, use `color-mix()` — see Advanced Patterns in [SKILL.md](../SKILL.md).

---

## Tokens with No SLDS 2 Equivalent

Some legacy tokens have no direct SLDS 2 hook. Use `--lwc-*` or hardcoded values:

| Token | Action | Replacement |
|---|---|---|
| `lineHeightButton` | Use `--lwc-*` directly | `var(--lwc-lineHeightButton)` |
| `durationInstantly` | Use `--lwc-*` directly | `var(--lwc-durationInstantly)` |
| `durationPromptly` | Use `--lwc-*` directly | `var(--lwc-durationPromptly)` |
| `durationSlowly` | Use `--lwc-*` directly | `var(--lwc-durationSlowly)` |
| `zIndexSticky` | Use hardcoded value | `9000` |

**Do not invent `--slds-g-*` hooks** for these tokens. The linter will flag invented hooks with `slds/no-slds-namespace-for-custom-hooks`.

---

## Custom Hook Namespace

When no SLDS 2 hook exists for an internal/custom value, use `--lwc-*` directly. Do not use the `--slds-g-*` namespace for custom purposes.

```css
/* Bad — inventing SLDS namespace for internal values */
transition: var(--slds-g-duration-slowly, var(--lwc-durationSlowly));

/* Good — use --lwc-* when no official SLDS 2 equivalent */
transition: var(--lwc-durationSlowly);
```

---

## Font-Family Post-Linter Cleanup

After the linter runs, it may add verbose font-stack fallbacks to `font-family`. For **font-family only**, trim to just the hook tokens — remove the hardcoded font stack:

```css
/* Linter output — verbose */
font-family: var(--slds-g-font-family, var(--lwc-fontFamily, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif));

/* Cleaned up — tokens only */
font-family: var(--slds-g-font-family, var(--lwc-fontFamily));
```

For all other properties, **keep** the linter's rgb/rem/px fallbacks.
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall