Agent skill

Experience Lwc Typescript Migrate

by forcedotcom in forcedotcom/sf-skills

A skill your agent uses when converting an existing JavaScript Lightning Web Component (.js, .html, .css) to TypeScript with full type annotations and a matching .d.ts file that exposes only the…

Apache-2.0Auto-check passedTesting & QA

Install Experience Lwc Typescript Migrate

skills CLI
$ npx skills add forcedotcom/sf-skills --skill experience-lwc-typescript-migrate -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install forcedotcom/sf-skills experience-lwc-typescript-migrate --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/forcedotcom/sf-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/experience-lwc-typescript-migrate .claude/skills/experience-lwc-typescript-migrate && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
experience-lwc-typescript-migrate
GitHub stars
1.1k
Token cost
~2.1k tokens
SKILL.md length
902 words
Files
4 (incl. scripts, assets)
Skills in repo
251
Repo updated
First seen
Licence
Apache-2.0

At a glance

A skill your agent uses when converting an existing JavaScript Lightning Web Component (.js, .html, .css) to TypeScript with full type annotations and a matching .d.ts file that exposes only the…

  • Works in 6 steps: Read the component → Rename .js → .ts using git mv → Add type annotations in the .ts → …
  • Converting an existing JavaScript Lightning Web Component (.js
  • SKILL.md covers When to Use This Skill, Prerequisites, Workflow and Verification Checklist, plus 2 more sections
  • Runs TypeScript and Shell scripts from its folder; calls git and tsc

What it does

Experience Lwc Typescript Migrate is an agent skill from forcedotcom/sf-skills. Use when converting an existing JavaScript Lightning Web Component (.js, .html, .css) to TypeScript with full type annotations and a matching .d.ts file that exposes only the component's @api surface. TRIGGER when the user says "convert LWC to TypeScript", "migrate LWC to TS", "rename .js to .ts for this component", "add types to my LWC", "generate .d.ts for this LWC", "type-annotate @api properties", or "produce declare module 'c/componentName' definitions". DO NOT TRIGGER when the user is authoring a brand-new…

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including scripts and assets (for example `assets/dts-template.ts`, `assets/type-patterns.ts` and `scripts/find-consumers.sh`).

It sits in Testing & QA, covering Unit testing. It works with TypeScript, JavaScript, Salesforce and Jest. The repository describes itself as: Salesforce's curated collection of agent skills for building applications. Optimized for Agentforce Vibes, compatible with all AI tools. The licence is Apache-2.0.

When your agent uses it

  • Converting an existing JavaScript Lightning Web Component (.js
  • .css) to TypeScript with full type annotations and a matching .d.ts file that exposes only the components @api surface
  • The user says convert LWC to TypeScript
  • Migrate LWC to TS

Example prompts

  • “s @api surface. TRIGGER when the user says”
  • “migrate LWC to TS”
  • “rename .js to .ts for this component”
  • “/experience-lwc-typescript-migrate”

Requirements

  • Node.js
  • A Bash shell

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Read the component
  2. Rename .js → .ts using git mv
  3. Add type annotations in the .ts
  4. Generate the .d.ts
  5. Compile and test
  6. Expected final bundle shape

What it can do on your machine

Read from SKILL.md and the folder at commit e5164d9. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (TypeScript and Shell), which the agent can run.

    Shell commands in SKILL.md call:

    • git
    • tsc

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • developer.salesforce.com
    • typescriptlang.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Experience Lwc Typescript Migrate loads about 2.1k tokens when it runs. Until then it costs about 179 tokens; SKILL.md has 902 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~179
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from forcedotcom/sf-skills at commit e5164d9, republished under its Apache-2.0 licence (© forcedotcom). 902 words, ~2,113 tokens.

Download SKILL.mdSave it as .claude/skills/experience-lwc-typescript-migrate/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
experience-lwc-typescript-migrate
description
Use when converting an existing JavaScript Lightning Web Component (.js, .html, .css) to TypeScript with full type annotations and a matching `.d.ts` file that exposes only the component's `@api` surface. TRIGGER when the user says "convert LWC to TypeScript", "migrate LWC to TS", "rename .js to .ts for this component", "add types to my LWC", "generate .d.ts for this LWC", "type-annotate @api properties", or "produce declare module 'c/componentName' definitions". DO NOT TRIGGER when the user is authoring a brand-new LWC from scratch (use experience-lwc-generate), generating Jest tests for an existing LWC (use experience-lwc-generate), or migrating an Aura component to LWC.
metadata.version
1.0
metadata.domains
Experience
metadata.relatedSkills
experience-lwc-generate
<!-- adk-managed-skill -->

Converting LWC to TypeScript

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).

When to Use This Skill

  • User wants to migrate a single component or a folder of components from .js to .ts.
  • User needs a .d.ts for an existing LWC so other components (or an external TypeScript host) can import it safely.
  • User is adding type annotations to an already-renamed .ts LWC that hasn't been properly typed yet.
  • User wants JSDoc-style type hints upgraded to real TypeScript types.

Prerequisites

  • The component builds and runs correctly in JavaScript today.
  • git is available (the rename must preserve history via git mv).
  • A TypeScript compiler is wired into the build (either the SFDX TS pipeline or a standalone tsc step).

Workflow

Step 1 — Read the component

Open every file in the bundle:

text
componentName/
├── componentName.js
├── componentName.html
├── componentName.css
└── (possibly) __tests__/, __utam__/, existing .d.ts

Understand:

  • What extends LightningElement? What is the class name?
  • Which fields and methods carry the @api decorator?
  • Which properties/methods have existing JSDoc (use as a type hint starting point, but validate against actual usage — JSDoc lies).
  • Which parameters / return types can you infer from how the code is called internally?
Step 2 — Rename .js → .ts using git mv
bash
git 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.

Step 3 — Add type annotations in the .ts

Apply types in this priority order so you stop as soon as the public contract is solid:

  1. @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.
  2. Complex shapes become interface or type aliases — not inline shapes repeated everywhere.
  3. Optional members use ? only when the value is genuinely allowed to be undefined. Do not sprinkle ? defensively.
  4. Private/internal state — still type it, but don't export the types. Use private for members that must never be touched by consumers.
  5. Event handlers — prefer precise DOM event types:
    • 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.
  6. Async methods always return Promise<T> — never bare T.
  7. Avoid any. If you genuinely can't type something, use unknown and narrow with a type guard.
Reference patterns

Load [[assets/type-patterns.ts|assets/type-patterns.ts]] as an inline example covering property types, method types, and event handler types.

Step 4 — Generate the .d.ts

Create componentName.d.ts next to the .ts. It must:

  • Contain only @api members — no private state, no internal methods, no lifecycle hooks unless they are themselves @api.
  • Preserve @api JSDoc verbatim (including @type, @required, @default, @param, @returns tags) directly above each declaration.
  • Declare the LWC module namespace 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.

Show full SKILL.md (346 more words)Show less
Step 5 — Compile and test
  • Run the TypeScript compiler (tsc --noEmit or the build's equivalent). Resolve every error before calling it done; no @ts-ignore patches.
  • Run the component's existing Jest tests. The behavior should be identical.
  • Run the bundled consumer-finder unconditionally — empty output is a valid result, not a reason to skip. The script resolves the search paths from 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:
bash
"<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.

Step 6 — Expected final bundle shape
text
componentName/
├── componentName.ts          # Main TypeScript implementation
├── componentName.html        # Template (unchanged)
├── componentName.css         # Styles (unchanged)
└── componentName.d.ts        # Type definitions (new)

Verification Checklist

Before conversion:

  • Component is valid JS and all tests pass.
  • You've identified every @api member and its intended type.

After conversion:

  • git mv was used so history is preserved.
  • Every variable and parameter in the .ts has a concrete type (no implicit any).
  • Complex object shapes live in interface / type aliases, not inline repeats.
  • Optional ? is only on genuinely optional fields.
  • .d.ts exists, declares c/componentName, extends LightningElement, includes only @api members.
  • Every @api JSDoc is preserved verbatim in the .d.ts.
  • tsc passes with zero errors; no @ts-ignore or any used as a workaround.
  • Jest tests still pass.

Common Pitfalls

  • Using any to silence errors. Solve the actual type instead. If the value is truly unknown, use unknown + a type guard.
  • Including private members in the .d.ts. The .d.ts is the public contract. Internal lifecycle and helpers must not leak.
  • Losing JSDoc during the rename. Scan before and after — JSDoc comments on @api members must appear in both the .ts and .d.ts.
  • Skipping git mv. Makes review miserable and confuses blame.
  • Forgetting async return types. foo() with an async keyword always returns a Promise. Declare it.
  • Typing 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.

Support Resources

© forcedotcom, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (scripts, assets) in skills/experience-lwc-typescript-migrate of forcedotcom/sf-skills.

  • SKILL.md
  • assets/dts-template.ts
  • assets/type-patterns.ts
  • scripts/find-consumers.sh

Open the folder on GitHubat commit e5164d9

Compare with similar skills

Experience Lwc Typescript Migrate next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Experience Lwc Typescript Migrate compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Experience Lwc Typescript Migrate this skillforcedotcom/sf-skills1.1k—~2.1kAutomated safety check: PassApache-2.0
Jest Skillsickn33/agentic-awesome-skills47k1 repos~1.4kAutomated safety check: PassMIT
Vitest Skillsickn33/agentic-awesome-skills47k1 repos~1.2kAutomated safety check: PassMIT
Javascript Typescript Jestgithub/awesome-copilot40k1 repos~559Automated safety check: PassMIT
Jest UnitPramodDutta/qaskills232—~3.8kAutomated safety check: PassMIT
Typescript Rulessoftspark/ai-toolkit179—~2.7kAutomated safety check: NotesApache-2.0

Similar skills

  • Jest Skill

    sickn33/agentic-awesome-skills

    Generates Jest unit and integration tests in JavaScript or TypeScript.

    47k GitHub starsUsed in 1 repo~1.4k tokens
    Testing & QAAuto-check passed
  • Vitest Skill

    sickn33/agentic-awesome-skills

    Generates Vitest tests in JavaScript/TypeScript with Vite-native speed.

    47k GitHub starsUsed in 1 repo~1.2k tokens
    Testing & QAAuto-check passed
  • Javascript Typescript Jest

    github/awesome-copilot

    Official

    Best practices for writing JavaScript/TypeScript tests using Jest, including mocking strategies, test structure, and common patterns.

    40k GitHub starsUsed in 1 repo~559 tokens
    Testing & QAAuto-check passed
  • Jest Unit

    PramodDutta/qaskills

    Unit testing skill using Jest for TypeScript and JavaScript, covering mocking, spies, snapshots, coverage, async testing, and custom matchers.

    232 GitHub stars~3.8k tokensUpdated 4 days ago
    Testing & QAAuto-check passed
  • Typescript Rules

    softspark/ai-toolkit

    TypeScript/JavaScript coding rules: style, patterns, security, testing.

    179 GitHub stars~2.7k tokensUpdated yesterday
    Testing & QAAuto-check: notes
  • Jest Generator

    secondsky/claude-skills

    Generate Jest unit tests for JavaScript/TypeScript with mocking, coverage.

    227 GitHub stars~1.1k tokensUpdated 10 days ago
    Testing & QAAuto-check: notes

More from forcedotcom/sf-skills

All 251 skills in this repo
  • Agentforce Architecture Analyze

    forcedotcom/sf-skills

    Declared architecture snapshot for one Agentforce agent: planner, topics, actions, flows, Apex, prompt templates, and NGA plugins.

    1.1k GitHub stars~4.5k tokensUpdated yesterday
    Auto-check passed
  • Agentforce D360 Analyze

    forcedotcom/sf-skills

    Data Cloud 360° view of a single Agentforce session. An agent skill from forcedotcom/sf-skills.

    1.1k GitHub stars~3.4k tokensUpdated yesterday
    Auto-check passed
  • Apply a Salesforce sandbox post-copy automation JSON config against a target org.

    1.1k GitHub stars~5.3k tokensUpdated yesterday
    Auto-check: notes
  • Apply a Salesforce sandbox post-copy automation JSON config against a target org.

    1.1k GitHub stars~5.4k tokensUpdated yesterday
    Auto-check: notes
  • Design Systems Slds Apply

    forcedotcom/sf-skills

    Apply SLDS-compliant UI using the correct blueprints, styling hooks, utility classes, and icons.

    1.1k GitHub stars~3.7k tokensUpdated yesterday
    Auto-check passed
  • Experience Lwc Generate

    forcedotcom/sf-skills

    Lightning Web Components with PICKLES methodology and 165-point scoring.

    1.1k GitHub stars~2.4k tokensUpdated yesterday
    Auto-check passed

Questions about Experience Lwc Typescript Migrate

What does Experience Lwc Typescript Migrate do?

A skill your agent uses when converting an existing JavaScript Lightning Web Component (.js, .html, .css) to TypeScript with full type annotations and a matching .d.ts file that exposes only the…. Experience Lwc Typescript Migrate is an agent skill from forcedotcom/sf-skills.ts file that exposes only the component's @api surface.

When should I use Experience Lwc Typescript Migrate?

Experience Lwc Typescript Migrate fits situations like: converting an existing JavaScript Lightning Web Component (.js; .css) to TypeScript with full type annotations and a matching .d.ts file that exposes only the components @api surface; the user says convert LWC to TypeScript; migrate LWC to TS.

How do I install Experience Lwc Typescript Migrate in Claude Code?

Run `npx skills add forcedotcom/sf-skills --skill experience-lwc-typescript-migrate -a claude-code`. Or copy the skill folder (skills/experience-lwc-typescript-migrate in forcedotcom/sf-skills) into .claude/skills/experience-lwc-typescript-migrate in your project. Claude Code loads it when a task matches its description.

How do I install Experience Lwc Typescript Migrate in Codex?

Run `npx skills add forcedotcom/sf-skills --skill experience-lwc-typescript-migrate -a codex`. Or copy the skill folder (skills/experience-lwc-typescript-migrate in forcedotcom/sf-skills) into .agents/skills/experience-lwc-typescript-migrate in your project. Codex loads it when a task matches its description.

Can I use Experience Lwc Typescript Migrate in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add forcedotcom/sf-skills --skill experience-lwc-typescript-migrate -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/experience-lwc-typescript-migrate, .gemini/skills/experience-lwc-typescript-migrate, .github/skills/experience-lwc-typescript-migrate and .opencode/skills/experience-lwc-typescript-migrate in your project.

What does Experience Lwc Typescript Migrate need to run?

Going by SKILL.md and its folder, Experience Lwc Typescript Migrate needs TypeScript and a shell for the scripts in its folder and the command-line tools its instructions call (git and tsc). Our summary lists: Node.js; A Bash shell.

Does Experience Lwc Typescript Migrate access the network?

SKILL.md names 2 domains. As links in the text: developer.salesforce.com and typescriptlang.org. This is read from the text; nothing was executed.

Is Experience Lwc Typescript Migrate safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Experience Lwc Typescript Migrate use?

Experience Lwc Typescript Migrate is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Experience Lwc Typescript Migrate use?

About 2.1k tokens (SKILL.md is roughly 8.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Experience Lwc Typescript Migrate?

Skills that share tags, products or a category with Experience Lwc Typescript Migrate: Jest Skill (sickn33/agentic-awesome-skills, 47k stars), Vitest Skill (sickn33/agentic-awesome-skills, 47k stars), Javascript Typescript Jest (github/awesome-copilot, 40k stars) and Jest Unit (PramodDutta/qaskills, 232 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Experience Lwc Typescript Migrate?

forcedotcom (a GitHub organization) maintains it in forcedotcom/sf-skills, which has 1,060 GitHub stars. The repository holds 251 skills in this directory. The repository was last updated on October 7, 2026.

Source: forcedotcom/sf-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.