/sf-experience:experience-lwc-runtime-observefrom Salesforce — Experience, LWC & Mobile
Guides the agent through starting a Lightning Preview session for an LWC app/component and extracting runtime DOM for inspection.
Ships in Salesforce — Experience, LWC & Mobile. 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
3 plugins in 2 repositories ship this exact skill · first indexed Aug 23, 2026
48 skills in this plugin
/commerce-b2b-open-code-components-integrateIntegrate Salesforce B2B Commerce open source components from GitHub into B2B Commerce stores. Use when users mention "integrate open code components", "open source B2B commerce", "add open code components", "forcedotcom/b2b-commerce-open-source-components", or want to add open source commerce components to their store. Copies all components and labels so they become available in Experience Builder./commerce-b2b-open-code-components-replaceReplace OOTB (out-of-the-box) B2B Commerce components with open source equivalents in site metadata content.json files, or look up the equivalent open code `site:` component for OOTB definitions. Use when users mention "replace OOTB components", "replace commerce components with open code", "swap OOTB for open source", "replace commerce_builder:", "replace OOTB in site", "replace component in site metadata", "replace component definition", "find open code equivalent", "equivalent open code component", "OOTB to open code mapping", "what is the site component for", components "in this view" or "for a given view", or a specific list of component names — and want to update or only discover mappings in their store metadata.npx claudepluginhub reej-consulting/reej-sf-skills --plugin sf-experienceOther plugins' skills for the same job