/experience-lwc:experience-lwc-typescript-migratefrom Salesforce LWC
Converts existing JavaScript LWC bundles to TypeScript with full @api type annotations and a .d.ts file exposing only the public surface. Triggered when migrating LWC to TS or adding types.
Ships in Salesforce LWC. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Convert a Lightning Web Component bundle from JavaScript to TypeScript. The
deliverable is a fully-typed .ts implementation plus a .d.ts file
that only exposes @api members (the public surface other LWCs consume).
.js to .ts..d.ts for an existing LWC so other components (or an
external TypeScript host) can import it safely..ts LWC that
hasn't been properly typed yet.git is available (the rename must preserve history via git mv).tsc step).Open every file in the bundle:
componentName/
├── componentName.js
├── componentName.html
├── componentName.css
└── (possibly) __tests__/, __utam__/, existing .d.ts
Understand:
LightningElement? What is the class name?@api decorator?.js → .ts using git mvgit mv componentName/componentName.js componentName/componentName.ts
Repeat for any helper .js files in the bundle (unless they're already
.ts). Never plain mv — that loses the history link TypeScript
reviewers rely on.
.tsApply types in this priority order so you stop as soon as the public contract is solid:
@api properties and methods first. Generate JSDoc if it's
missing, then translate JSDoc types to TS syntax (string, number,
boolean, Promise<T>). Validate each JSDoc claim against the code
before trusting it.interface or type aliases — not inline
shapes repeated everywhere.? only when the value is genuinely allowed
to be undefined. Do not sprinkle ? defensively.private for members that must never be touched by
consumers.MouseEvent for onclick (and other click-like handlers). click
is dispatched as a MouseEvent — including keyboard-activated
clicks — so typing it as PointerEvent would let handlers rely on
pointer-only fields (pointerType, pressure, etc.) that are
undefined in those cases.PointerEvent for onpointerdown / onpointerup / onpointermove
and other pointer* handlers where pointer-specific fields are
actually meaningful.CustomEvent<{ detail: ... }> for LWC custom events.Event is the last resort; document why when using it.Promise<T> — never bare T.any. If you genuinely can't type something, use unknown
and narrow with a type guard.Load [[assets/type-patterns.ts|assets/type-patterns.ts]] as an inline example covering property types, method types, and event handler types.
.d.tsCreate componentName.d.ts next to the .ts. It must:
@api members — no private state, no internal
methods, no lifecycle hooks unless they are themselves @api.@api JSDoc verbatim (including @type, @required,
@default, @param, @returns tags) directly above each declaration.c/componentName (or the org's
namespace if different).Template: load [[assets/dts-template.ts|assets/dts-template.ts]] as the
starting .d.ts shape.
If the component has no @api members, still produce the module
declaration with a comment explaining there's no public surface — don't
skip the file.
tsc --noEmit or the build's equivalent).
Resolve every error before calling it done; no @ts-ignore patches.sfdx-project.json's packageDirectories (or falls back
to <project-root>), rejects any entry that escapes the project root,
and performs the LWC-import search internally so the invocation is
fully deterministic:"<skill_dir>/scripts/find-consumers.sh" "<project-root>" "<componentName>"
For each match, confirm the consumer's expected types still align with
the new .d.ts public surface.
componentName/
├── componentName.ts # Main TypeScript implementation
├── componentName.html # Template (unchanged)
├── componentName.css # Styles (unchanged)
└── componentName.d.ts # Type definitions (new)
Before conversion:
@api member and its intended type.After conversion:
git mv was used so history is preserved..ts has a concrete type
(no implicit any).interface / type aliases, not
inline repeats.? is only on genuinely optional fields..d.ts exists, declares c/componentName, extends
LightningElement, includes only @api members.@api JSDoc is preserved verbatim in the .d.ts.tsc passes with zero errors; no @ts-ignore or any used as a
workaround.any to silence errors. Solve the actual type instead.
If the value is truly unknown, use unknown + a type guard..d.ts. The .d.ts is the
public contract. Internal lifecycle and helpers must not leak.@api members must appear in both the .ts and .d.ts.git mv. Makes review miserable and confuses blame.foo() with an async keyword
always returns a Promise. Declare it.onclick as PointerEvent. click is a MouseEvent
(keyboard-triggered clicks included), so PointerEvent fields like
pointerType are undefined for those events. Type onclick as
MouseEvent; reserve PointerEvent for onpointer* handlers. Use
MouseEvent | TouchEvent only when the code branches on TouchEvent
distinctly.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub forcedotcom/sf-skills --plugin experience-lwc14 skills in this plugin
/experience-accessibility-validateUse this skill to determine whether a Lightning Web Component (LWC) is accessible and meets WCAG accessibility guidelines. TRIGGER when the user asks "is my component accessible?", "does my LWC meet accessibility guidelines?", "is this component WCAG compliant?", "find accessibility problems in this LWC", "is this LWC keyboard accessible?", "does this component work with a screen reader?", "does this component have sufficient color contrast?", "check ARIA usage in this LWC", or "WCAG 2.2 accessibility check". Also TRIGGER when the user wants to fix or improve accessibility (a11y, WCAG, ARIA) in an LWC's HTML, JS, or CSS — semantic markup, focus, keyboard nav, contrast, screen-reader labels, WCAG 2.2 SC. Produces `a11y-review.md` with WCAG-cited findings. DO NOT TRIGGER for general LWC generation (use `experience-lwc-generate`) or SLDS visual/design review not focused on accessibility (use `design-systems-slds-validate`)./experience-aura-lwc-migrateUse this skill to analyze a Salesforce Aura component bundle (.cmp, .app, .evt, .intf, Controller.js, Helper.js, Renderer.js) and produce a framework-agnostic migration blueprint (PRD.yaml / PRD.md / PRD.json) capturing public API, data requirements, slots, events, states, accessibility, styling, localization, and security posture. This is Phase 1 (analysis + PRD) only — it does NOT author or edit component code, wire adapters, or Jest tests, and does not write .html/.js/.css/.js-meta.xml. TRIGGER when the user says "analyze this Aura component", "migrate Aura", "convert .cmp", "produce a migration blueprint", "generate a PRD for this Aura component", or mentions aura:attribute, aura:handler, force:recordData, $Label, $Resource, component.get, cmp.find, or an input directory containing .cmp files. DO NOT TRIGGER when there is no Aura source (delegate downstream LWC authoring to experience-lwc-generate), for post-migration scoring, or for refactoring an existing modern component./experience-lds-best-practices-applyUse when reviewing or implementing Lightning Data Service best practices in an LWC (.js, .html, .js-meta.xml) — UIAPI vs Apex, refreshApex / notifyRecordUpdateAvailable, @salesforce/schema imports, LDS record-form data patterns. TRIGGER on "apply LDS best practices to this LWC", "review this LWC for LDS best-practice issues", "review this component for Lightning Data Service issues", "UIAPI or Apex for this data?", "fix stale data after record save", "sync LDS cache", "use @salesforce/schema for field names", "choose between getRecord and Apex". DO NOT TRIGGER when building a new LWC (use experience-lwc-generate), applying SLDS design tokens (use design-systems-slds-apply), picking or wiring a `lightning-*` base component's props/events/slots generically (use experience-lwc-base-components-integrate — this skill covers only the LDS data-layer rationale, even when the fix involves a base record form), or for security / RTL / accessibility reviews (separate passes)./experience-lds-data-requirements-generateUse when a Lightning Web Component data need is described in ambiguous natural language — turn "get contact info" or "show account data" into a clear, PRD-ready data-requirements spec. TRIGGER when the user says "define data requirements for this LWC", "turn this PRD data section into validated object/field names", "recommend GraphQL vs UIAPI for this data need", "validate these Salesforce API names", or "spec out the LDS adapter for this component", or references LWC bundle files (`.js`, `.js-meta.xml`) whose data layer is not yet specified. DO NOT TRIGGER when the data layer is already fully specified, when authoring the actual query or adapter code from a known spec, or when implementing an LWC end-to-end (use experience-lwc-generate)./experience-lds-graphql-generateUse ALWAYS when a prompt mentions GraphQL, lightning/uiGraphQLApi, @wire(graphql, ...), or gql template tags in an LWC context — even if the surface ask is "build an LWC". Owns the ENTIRE flow: introspect the org's LDS GraphQL schema, identify entities/fields, construct the schema-validated gql query or mutation, wire it into the LWC via lightning/uiGraphQLApi, verify against a connected org. REQUIRED whenever a prompt asks to render, list, or edit Salesforce records (Account, Contact, Case, custom objects) via GraphQL — the .html and .js scaffolding IS in scope. DO NOT delegate to experience-lwc-generate: that skill has NO GraphQL schema introspection, NO create_lds_graphql_read_query binding, and defaults to getRecord/getRelatedListRecords wire adapters which will not satisfy a GraphQL prompt. DO NOT TRIGGER only if the prompt forbids GraphQL, chooses UIAPI/Apex (use experience-lds-best-practices-apply), or asks for data requirements (use experience-lds-data-requirements-generate)./experience-lwc-accessibility-jest-runUse ALWAYS when running Sa11y accessibility Jest tests for an LWC — locally before pushing, producing the command(s), running one file vs a suite, selecting tests by naming convention, saving Sa11y-rendered HTML, or reproducing a Sa11y/A11yBug failure. Covers core (Bazel; `bazel test //<module>:<target>`) and standalone `npx jest` (`.accessibility.test.js`, `@sa11y/jest`). REQUIRED for a `run-plan.md`, a failing a11y test's exit code, or `SA11Y_*`/`A11yBug`/core-Bazel test paths. DO NOT TRIGGER for functional Jest tests, a11y review without running tests (use experience-accessibility-validate), or Selenium-based a11y tests.3 plugins in 2 repositories ship this exact skill · first indexed Aug 23, 2026
Other plugins' skills for the same job