sl-design-system/components/implement-design-lit
Claude Code and agent skill by sl-design-system/components
- community
Checking that the SKILL.md file is still in the repository.
Lit/LitElement implementation conventions for the /implement-design pipeline. Loaded on demand by component-implementer (and component-author) when the chosen framework is Lit.
Install
npx vskill@latest install sl-design-system/components/implement-design-litSKILL.md
Implementing an SLDS component in Lit
This is the framework skill for Lit in the /implement-design pipeline. The full, detailed Lit conventions live in `../implement-design/component-conventions.md` (relative to this skill's folder; the orchestrator also passes its absolute path) — read that file; it is the authoritative Lit reference. This skill is a checklist of the Lit-specific essentials it covers.
Scaffolding
- A published package (
packages/components/<name>/) haspackage.jsonin the root and everything else undersrc/:index.ts(re-export),register.ts(customElements.define),<name>.ts,<name>.css,<name>.stories.ts. There is no per-package `tsconfig.json`/ESLint/stylelint config — the shared ones inpackages/components/cover every component. An example (folder under the chosen app/example path) is lighter —.ts+.css+.stories.tsco-located, sharing the example package's existingindex.ts/tsconfig.json; nopackage.json/register.ts. Copy boilerplate from a neighbour; use.jsimport specifiers for.tsmodules. - No monorepo registration needed — the root
packages/components/*workspace glob and tsdown'sworkspace: '*'pick a new package up automatically. Runyarn installfrom the repo root after scaffolding. exports/publishConfig.exportsinpackage.jsonare generated by tsdown on build — copy them from the component you mirror (the@sl-design-system/sourcecondition inexports→./src/*.ts,default→./dist/*.js, andpublishConfig.exports→./dist/*.js) and don't hand-tune them. Local development tools enable the source condition; consumers usedefaultwithout relying on npm to applypublishConfig.exports. Entry points default tosrc/index.ts+src/register.ts; extra ones go in atsdown: { entry: [...] }field listing all of them.
The element
extends LitElement;@property({ reflect: true })for attributes that drive selectors; exported string-union types for enums; full JSDoc.- Scoped custom elements: a component that renders other custom elements in its shadow uses
ScopedElementsMixin(LitElement)+static scopedElements; child components used only inside a parent do notcustomElements.define— only the root/public component registers globally. - Accessibility:
formAssociated/FormControlMixinfor value-holding controls;ForwardAriaMixinto forwardaria-*. Never<main>/role="main".
Events
- Emit with the `@event` decorator + `EventEmitter` from
@sl-design-system/shared— never hand-rollnew CustomEvent(...)+this.dispatchEvent(...). Export aCustomEventtype alias (export type SlSaveEvent = CustomEvent<{ value: T }>;,CustomEvent<void>when no detail), add it toGlobalEventHandlersEventMapin the file'sdeclare global, declare the emitter (@event({ name: 'sl-save' }) saveEvent!: EventEmitter<SlSaveEvent>;), and fire it viathis.saveEvent.emit(detail)(or.emit()for void).emitalready defaults tobubbles: true, composed: true. Mirrorpackages/components/tabs,tree, orform.
Styles
- Plain `.css` (not
.scss), imported via an import attribute:import styles from './<name>.css' with { type: 'css' };→static override styles = styles;. No build step, no `.scss.ts` — the@sl-design-system/rolldown-plugin-css-sheetplugin transforms the{ type: 'css' }import into aCSSStyleSheet(typed byvite-env.d.ts) for Storybook/Vite, Vitest and thetsdownbuild alike, and.cssedits hot-reload in the running dev server (no restart). - Design tokens only — no `var()` fallbacks, light-mode semantic tokens even for dark designs, logical properties. Prefer styling a component's
::part()over wrapper<div>s. - A
--sl-text-new-*token is afont:shorthand that resetsfont-weighttonormal— add an explicitfont-weight: var(--sl-fontWeight-600|700)after it for any semibold/bold text (otherwise headings/badges render un-bold).
Icons
- Every
<sl-icon name="...">needsIcon.register(faX)(importfaXfrom@fortawesome/pro-*-svg-icons) at module load in the component that renders it.
Forms
- A single
<sl-form>wraps all controls and the action bar — and lives in the same component as the controls (don't wrap a child component in a parent-level form; that yields a separate/dummy form). Manage it with a `FormController<T>(this)` on that component — give each control aname, set the whole value from the component'svalueinput (this.#form.value = this.valueinupdated()), and readthis.#form.value/reportValidity()/reset()for the buttons. Never bind `.value` per field. The data-owner parent passes the initialvaluein and handles the form component's emitted save/cancel events.
i18n (when enabled)
- Reference: Lit's own localization guide — <https://lit.dev/docs/localization/overview/> (covers
@lit/localize,msg(),@localized(), runtime vs. transform mode, andlit-localizeextraction). Consult it when unsure about the API. import { localized, msg } from '@lit/localize';,@localized()on every component that shows text, every user-visible label asmsg('<English>', { id: '<sl.namespaced.id>' })in that component's own `render`.- Models carry data + stable keys, not translated strings. Localize in
renderkeyed off the model value via a `switch` returning a literal `msg()` per case —msg()requires a LITERAL source string and literalid(lit-localize extracts statically);msg(map[key].en, { id: map[key].id })silently fails to extract. Never accept a pre-translatedlabel/titlethrough a@propertymodel. Per-record free text (names, titles from the data) is rendered directly. A non-English design renders its English source at runtime until the translated locale is loaded — expected. - Structural config (column sets, fixed tabs, option lists) is a local constant in the component, not a model input.
Stories (authored during implementation)
- Write a basic Storybook story (
@storybook/web-components-vite) as part of implementing the component — before visual validation, which needs it to render. Page components setparameters: { layout: 'fullscreen' }. Stage 5 adds variant stories.
Tests / Docs / Changeset (Stage 5) — only for published packages
- For a
packages/components/*package: Vitest browser tests viafixture, website docs underwebsite/, and a changeset. For an example/app target, skip these — produce only the component + story (match the neighbouring examples).
Build / verify
- No style build step, and no build needed while developing — Storybook and the tests consume the TypeScript sources directly. Type-check against the tsconfig that covers your target:
npx tsc -p packages/components/tsconfig.json --noEmitfor an SLDS package,npx tsc -p examples/lit/tsconfig.json --noEmitfor a Lit example. Both cover every file in that tree, so only fix the errors in your files — pre-existing ones elsewhere aren't yours. - Tests run from the repo root:
yarn vitest --project=unit --run <path>(drop--runfor watch mode). - A full build is
yarn build(tsdown); components only isyarn tsdown --config packages/components/tsdown.config.mjs, with--filter <package-name>for a single package. - Run the dev server with
yarn start;.cssand template edits hot-reload — do not restart Storybook to pick up changes.
See component-conventions.md for the full detail of every point above (data ownership, single <sl-form>, tab lazy-load with sl-tab-group+sl-tab only, reproduce-the-design content fidelity, naming).
Security
- Security scanPassed, 91 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingtools/implement-design-plugin/skills/implement-design-lit/SKILL.md
Popularity
- Repository stars
- 67
- Repository forks
- 8
- 7-day trend score
- 21
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/sl-design-system/components/implement-design-lit)