experience-lwc-typescript-migrate

experience-lwc-typescript-migrate is a skill for Claude Code from forcedotcom/sf-skills. It costs 176 tokens per session (2,138 once invoked), scanned A, original, Apache-2.0.

A workflow for converting a JavaScript Lightning Web Component to TypeScript, including a declaration file that exposes its public properties and methods.

In plain words
What is it for?
Use it to migrate LWC files from JavaScript to TypeScript or create a typed .d.ts file for an existing component.
Why use it?
It adds explicit types to an existing component and makes its public interface clearer to other components or TypeScript code.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the experience-lwc plugin — 12 skills shipped together

Good fit Use it to migrate LWC files from JavaScript to TypeScript or create a typed .d.ts file for an existing component.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/forcedotcom/sf-skills/experience-lwc-typescript-migrate
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add forcedotcom/sf-skills --skill experience-lwc-typescript-migrate
Clone the repo
git clone --depth 1 https://github.com/forcedotcom/sf-skills

Made for: Claude Code.

Or install experience-lwc, the plugin that ships this one along with the rest of its 12 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for experience-lwc-typescript-migrate

README.md
[![agentmods](https://agentmods.dev/badge/skills/forcedotcom/sf-skills/experience-lwc-typescript-migrate/github.svg)](https://agentmods.dev/skills/forcedotcom/sf-skills/experience-lwc-typescript-migrate)
Your own site
<a href="https://agentmods.dev/skills/forcedotcom/sf-skills/experience-lwc-typescript-migrate"><img src="https://agentmods.dev/badge/skills/forcedotcom/sf-skills/experience-lwc-typescript-migrate/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for experience-lwc-typescript-migrate

Your own site · 80×15
<a href="https://agentmods.dev/skills/forcedotcom/sf-skills/experience-lwc-typescript-migrate"><img src="https://agentmods.dev/badge/skills/forcedotcom/sf-skills/experience-lwc-typescript-migrate.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 176 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,138 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 19 Aug 2026
  • Snyk pass 19 Aug 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00176 $0.02138
Opus 5 $0.00088 $0.01069
Sonnet 5 $0.00035 $0.00428
Haiku 4.5 $0.00018 $0.00214

Measured 10d ago against content hash 57b34a6398fa, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

experience-lwc-typescript-migrate scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

The scan reads SKILL.md. This mod also ships 3 executable files (assets/dts-template.ts, assets/type-patterns.ts, scripts/find-consumers.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/builder/experience-lwc/skills/experience-lwc-typescript-migrate/SKILL.md · 209 lines

How it starts

The opening of the file, as written. The whole thing — 209 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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:

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

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.

Read the full file on GitHub · 209 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 209 lines · 176 tokens per session scan A 57b34a6398fa

Subscribe to this mod's changes

experience-lwc-typescript-migrate is a skill published in the GitHub repository forcedotcom/sf-skills (978 stars, last pushed yesterday), licensed Apache-2.0. It adds 176 tokens to every session and 2,138 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

fast-typescript-check

Keep www-sacred's TypeScript fast to type-check and fast to run. Use when touching the ASCII/canvas animation components (the only real per-frame code here), tightening type-check wall-clock, or auditing a change for runtime or compiler regressions. Scoped to this repo — a React 19 / Next.js 16 component library plus…

internet-development/www-sacred · 84 tokens

onejs-setup-and-overview

Use this skill whenever the user wants to build or set up user interface in a Unity project using OneJS, React, TypeScript, or JSX, e.g. 'add a main menu to my game', 'build a settings screen', 'make a HUD', 'set up OneJS', 'my OneJS panel is blank', 'the UI is not hot reloading'. Covers confirming OneJS is installed…

Singtaa/OneJS · 199 tokens

coding-standards

A set of general coding standards and practical patterns for TypeScript, JavaScript, React, and Node.js. It covers readable naming, simple designs, avoiding repetition, and delaying unnecessary features.

loulanyue/awesome-claude-notes · 41 tokens

typescript-rules

React/TypeScript frontend development rules including type safety, component design, state management, and error handling. Use when implementing React components, TypeScript code, or frontend features.

shinpr/claude-code-workflows · 39 tokens

electron-development

Electron development guidelines for building cross-platform desktop applications with JavaScript/TypeScript.

Mindrally/skills · 18 tokens

typescript-best-practices

TypeScript best practices. Use when reading or editing any .ts or .tsx file.

cursor/plugins · 24 tokens