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/migration-checklist.md

View on GitHub
# SLDS 2 Uplift Checklist

Validation checklist for each CSS file after applying SLDS 2 uplift fixes.

---

## Per-Rule Checks

### `slds/no-slds-class-overrides`

**CSS:**
- [ ] All `.slds-*` overrides reported by the linter are renamed to `{componentName}-{sldsElementPart}`
- [ ] Component name is camelCase
- [ ] SLDS element names preserved after prefix (e.g., `.slds-button` → `myComponent-button`)
- [ ] Each SLDS class in a compound selector gets its own component class

**HTML:**
- [ ] Original SLDS classes preserved (never removed)
- [ ] Component classes added alongside SLDS classes
- [ ] Every element in CSS selector chain updated in HTML

### `slds/lwc-token-to-slds-hook`

- [ ] All `var(--lwc-*)` tokens replaced with SLDS 2 hooks
- [ ] Hooks chosen from linter's numbered suggestion list (not invented)
- [ ] Surface vs container choice matches DOM context
- [ ] Fallback includes original token: `var(--slds-g-[hook], var(--lwc-[token]))`

### `slds/no-hardcoded-values-slds2`

- [ ] Color values replaced with context-appropriate hooks (surface, accent, feedback, etc.)
- [ ] Non-color values (spacing, sizing, typography, border, radius, shadow) replaced where exact match exists
- [ ] Hardcoded numerical values left unchanged — do not replace or remove values like `100%`, `50%`, `200px`, `1.5`, `auto`, `0`, `inherit`, `none`, `flex: 1`
- [ ] All replacements include original value as fallback: `var(--slds-g-[hook], originalValue)`
- [ ] Only numbered hooks used (no `spacing-medium`, `font-weight-bold`, etc.)

---

## Cross-Cutting Checks

### Hook Selection
- [ ] Background-foreground hooks paired from same family (e.g., `surface-container-*` with `on-surface-*`)
- [ ] Spacing hooks for margin/padding/gap; sizing hooks for width/height
- [ ] Density-aware variants (`--slds-g-spacing-var-*`) used where component adapts to comfy/compact

### Linter Validation
- [ ] `npx @salesforce-ux/slds-linter@latest lint .` — zero errors
- [ ] Warnings reviewed — remaining warnings are for values with no available hook

---

## Troubleshooting

### Visual appearance changed
1. Check fallback values match original hardcoded values exactly
2. Verify correct hook family (surface vs container)
3. Ensure background-foreground hooks properly paired

### Linter still shows violations
1. Verify hook names exactly match linter suggestions
2. Check for missed CSS files in subdirectories
3. Ensure all elements in selector chains updated in HTML

### Functionality broken
1. Check original SLDS classes preserved in HTML
2. Verify JavaScript selectors updated if CSS classes changed (class overrides rule)
3. Update tests that use class-based query selectors
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