/experience-lwc:experience-lwc-runtime-observefrom Salesforce LWC
Guides the agent through starting a Lightning Preview session for an LWC app/component and extracting runtime DOM for inspection.
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.
Guides the agent through two sequential jobs that typically run together:
Preview is the prerequisite for DOM inspection. Keep them in this order.
sf lightning dev app / sf lightning dev component).sf) installed. Check with sf version.@salesforce/plugin-lightning-dev installed. Check with sf plugins.sf org list shows at least one connected org).Ask the user (or infer from the request) whether the scope is app or component.
Ask the user for (or infer from the request) the org alias the preview
should target. Run the bundled verification script with that alias and
surface any error it emits — do not re-invoke sf version /
sf plugins / sf org display in prose. The script checks CLI
presence, @salesforce/plugin-lightning-dev installation, and that the
specific target alias is authenticated and Connected, and exits nonzero
with an actionable message on failure:
"<skill_dir>/scripts/verify-toolchain.sh" <orgAlias>
If it reports that the target alias is not authenticated or not
Connected, direct the user to
Enable Local Dev
and have them run sf org login web --alias <orgAlias>, then re-run the
verification script before proceeding.
# For app scope
sf lightning dev app --help
# For component scope
sf lightning dev component --help
Note required vs optional flags. If a required flag is ambiguous, ask the user before running.
Prefix every preview command with OPEN_BROWSER=false — the CLI opens a
browser window by default, which we do not want when an agent is driving.
(This env var is undocumented in --help; rely on it unless the user
explicitly asks for a browser window.)
| Scope | Command |
|---|---|
app | OPEN_BROWSER=false sf lightning dev app -o <orgAlias> -n <appName> -t desktop |
component | OPEN_BROWSER=false sf lightning dev component -o <orgAlias> -n <componentName> |
When the preview is up, capture the URL and log it in exactly this format:
Lightning Preview running at URL: <URL>
If any sub-step fails, stop and surface the error to the user — don't try to paper over auth or plugin-install problems.
Only run this step once Step 1 has produced a live preview URL.
The front-door URL returned by sf org open --url-only --json contains a
short-lived OTP that authenticates the session. Never run sf org open
directly — its output would land in the agent tool-output stream and leak
an auth token into the transcript, violating agent-safety standard S1.
The bundled helper is the only supported way to obtain the URL: it runs
sf org open internally with stdout redirected into a chmod 600 tempfile
and stderr suppressed, so no URL fragment or token substring ever reaches
agent context.
Instead, use the bundled helper script, which writes the URL to a
chmod 600 tempfile and prints only export assignments (no token
material). Capture the helper output first so a nonzero exit status
aborts the caller — eval "$(...)" alone masks failures, letting the
agent proceed with an unset $FRONTDOOR_URL_FILE:
frontdoor_env="$("<skill_dir>/scripts/open-frontdoor.sh" <orgAlias> <previewUrl>)" || exit 1
eval "$frontdoor_env"
The helper suppresses sf and python3 stderr as well as stdout, so
partial URLs and progress noise never reach the agent transcript.
The browser driver must:
$FRONTDOOR_URL_FILE.cat or otherwise echo the file contents.OTP tokens expire fast. Bring up the browser driver first, then invoke the helper just before navigating — otherwise the token goes stale.
Two deterministic string operations — turning a component name into its
c-<kebab> selector and wrapping the extracted HTML in the exact
DOM_OUTPUT_START / DOM_OUTPUT_END markers — are handled by
<skill_dir>/scripts/extract-dom.sh. Do NOT re-derive the selector or
compose the markers in prose; call the script.
Actual DOM traversal must be run by the browser-automation driver (Playwright / Puppeteer / CDP); the script does not drive the browser.
componentCompute the selector deterministically:
selector="$("<skill_dir>/scripts/extract-dom.sh" selector <componentName>)"
Then, using the driver, pierce the lwr_dev-preview-container shadow
root, locate the first visible element matching $selector, and read its
subtree HTML (via element.shadowRoot.innerHTML). Pipe that HTML into
the wrap step:
printf '%s' "$html_subtree" \
| "<skill_dir>/scripts/extract-dom.sh" wrap component <componentName>
appUsing the driver, identify the primary app root (prefer document.body
or the main app container — not document.documentElement), exclude
<head> and non-rendered nodes, and read the subtree HTML. Pipe it into
the wrap step:
printf '%s' "$html_subtree" \
| "<skill_dir>/scripts/extract-dom.sh" wrap app
Emit the script's stdout unchanged as the DOM output.
Lightning Web Components use Shadow DOM. The template content is not directly queryable on the host element:
| Access pattern | What you get |
|---|---|
element.innerHTML | empty, or only slotted light-DOM content |
element.outerHTML | just the host tag, no children |
element.shadowRoot.innerHTML | the real rendered template content |
If the browser driver's DOM query doesn't pierce shadow roots by default,
walk shadowRoot explicitly. Most modern automation drivers have a
shadow-piercing query helper — use it.
For a worked end-to-end example (preview a component, capture the front-door
URL safely, and extract its DOM), load
examples/component-preview-and-dom.md.
<skill_dir>/scripts/verify-toolchain.sh <orgAlias> exited zero for the target alias.OPEN_BROWSER=false.Lightning Preview running at URL: <URL> format.<skill_dir>/scripts/open-frontdoor.sh (never sf org open directly).shadowRoot traversal (not innerHTML on the host).<skill_dir>/scripts/extract-dom.sh wrap … (script owns the markers).verify-toolchain.sh reports "Target org alias is not authenticated or not Connected" —
run sf org login web --alias <orgAlias> (the alias must match the one
you passed to verify-toolchain.sh and the -o value the preview
command uses).verify-toolchain.sh reports the plugin is missing — install it with
sf plugins install @salesforce/plugin-lightning-dev.OPEN_BROWSER=false.innerHTML on a host. Use
element.shadowRoot.innerHTML instead. Also verify you pierced the
lwr_dev-preview-container shadow root.<skill_dir>/scripts/open-frontdoor.sh and navigate within ~60 seconds.What SKILL.md sets; muted values are Claude Code's defaults
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