Agent skill

Experience Lwc Runtime Observe

by forcedotcom in forcedotcom/sf-skills

A skill your agent uses when running Salesforce Lightning Preview for an app or a single LWC component to extract the runtime DOM for inspection.

Apache-2.0Auto-check passedSales & Support

Install Experience Lwc Runtime Observe

skills CLI
$ npx skills add forcedotcom/sf-skills --skill experience-lwc-runtime-observe -a claude-code

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

GitHub CLI
$ gh skill install forcedotcom/sf-skills experience-lwc-runtime-observe --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-runtime-observe .claude/skills/experience-lwc-runtime-observe && 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-runtime-observe
GitHub stars
1.1k
Token cost
~2.5k tokens
SKILL.md length
1,141 words
Files
5 (incl. scripts)
Skills in repo
251
Repo updated
First seen
Licence
Apache-2.0

At a glance

A skill your agent uses when running Salesforce Lightning Preview for an app or a single LWC component to extract the runtime DOM for inspection.

  • Works in 2 steps: Start the Lightning Preview → Extract the Runtime DOM
  • Running Salesforce Lightning Preview for an app
  • SKILL.md covers When to Use This Skill, Prerequisites, Step 1 — Start the Lightning… and Step 2 — Extract the Runtime DOM, plus 3 more sections
  • Runs Shell scripts from its folder; calls sf

What it does

Experience Lwc Runtime Observe is an agent skill from forcedotcom/sf-skills. Use when running Salesforce Lightning Preview for an app or a single LWC component to extract the runtime DOM for inspection. TRIGGER when the user says "preview an LWC locally", "run sf lightning dev", "launch Local Dev", "inspect a component's shadow DOM at runtime", "grab rendered HTML from a live preview", "troubleshoot what actually renders versus the template", "set up Salesforce Live Preview plugin", "lightning preview", "local dev server", or "extract runtime DOM". DO NOT TRIGGER when the user is…

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including scripts (for example `examples/component-preview-and-dom.md`, `scripts/extract-dom.sh` and `scripts/open-frontdoor.sh`).

It sits in Sales & Support, covering CRM management. It works with Salesforce. 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

  • Running Salesforce Lightning Preview for an app
  • A single LWC component to extract the runtime DOM for inspection
  • The user says preview an LWC locally
  • Run sf lightning dev

Example prompts

  • “preview an LWC locally”
  • “run sf lightning dev”
  • “launch Local Dev”
  • “/experience-lwc-runtime-observe”

Requirements

  • A Bash shell

Workflow steps

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

  1. Start the Lightning Preview
  2. Extract the Runtime DOM

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 3 files in scripts/ (Shell), which the agent can run.

    Shell commands in SKILL.md call:

    • sf

    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

    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 Runtime Observe loads about 2.5k tokens when it runs. Until then it costs about 167 tokens; SKILL.md has 1,141 words of instructions outside code blocks.

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

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). 1,141 words, ~2,539 tokens.

Download SKILL.mdSave it as .claude/skills/experience-lwc-runtime-observe/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
experience-lwc-runtime-observe
description
Use when running Salesforce Lightning Preview for an app or a single LWC component to extract the runtime DOM for inspection. TRIGGER when the user says "preview an LWC locally", "run sf lightning dev", "launch Local Dev", "inspect a component's shadow DOM at runtime", "grab rendered HTML from a live preview", "troubleshoot what actually renders versus the template", "set up Salesforce Live Preview plugin", "lightning preview", "local dev server", or "extract runtime DOM". DO NOT TRIGGER when the user is authoring or editing LWC source code (use experience-lwc-generate) or reviewing component code statically without running it.
metadata.version
1.0
metadata.domains
Experience, Developer Experience
metadata.relatedSkills
experience-lwc-generate
<!-- adk-managed-skill -->

Previewing LWC Runtime — Local Dev + DOM Inspection

Guides the agent through two sequential jobs that typically run together:

  1. Start a Lightning Preview session with the Salesforce CLI so an LWC app or component renders in a local dev environment.
  2. Navigate to that preview URL and extract the runtime DOM subtree so the agent (or user) can reason about what actually rendered.

Preview is the prerequisite for DOM inspection. Keep them in this order.

When to Use This Skill

  • The user wants to preview an LWC app or component locally before deploying (sf lightning dev app / sf lightning dev component).
  • The user wants the rendered HTML subtree for a specific component at runtime — for a diff, a screenshot pipeline, or to reason about shadow DOM.
  • The user asks why the template content "isn't in the DOM" — almost always a shadow-DOM misunderstanding handled in Step 2.

Prerequisites

  • Salesforce CLI (sf) installed. Check with sf version.
  • @salesforce/plugin-lightning-dev installed. Check with sf plugins.
  • An authenticated org (sf org list shows at least one connected org).
  • For DOM extraction: browser automation available in the agent harness (Playwright, Puppeteer, Chrome DevTools Protocol — whatever is wired up).

Step 1 — Start the Lightning Preview

Ask the user (or infer from the request) whether the scope is app or component.

1a. Verify the toolchain

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:

bash
"<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.

1b. Read the subcommand's flags
bash
# 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.

1c. Launch the preview

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

ScopeCommand
appOPEN_BROWSER=false sf lightning dev app -o <orgAlias> -n <appName> -t desktop
componentOPEN_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:

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


Step 2 — Extract the Runtime DOM

Only run this step once Step 1 has produced a live preview URL.

2a. Get an authenticated front-door URL — without surfacing the token to agent context

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:

bash
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:

  1. Read the URL from $FRONTDOOR_URL_FILE.
  2. Navigate to it to establish a session.
  3. Delete the tempfile immediately after use.
  4. Never 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.

Show full SKILL.md (448 more words)Show less
2b. Navigate and wait
  1. Open the preview URL from Step 1 in the automation browser.
  2. Wait for the network to go idle and the initial render to complete.
  3. If the expected element isn't there, back off briefly and retry before declaring failure — local dev pages sometimes hydrate in two phases.
2c. Extract the subtree

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.

If scope is component

Compute the selector deterministically:

bash
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:

bash
printf '%s' "$html_subtree" \
  | "<skill_dir>/scripts/extract-dom.sh" wrap component <componentName>
If scope is app

Using 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:

bash
printf '%s' "$html_subtree" \
  | "<skill_dir>/scripts/extract-dom.sh" wrap app

Emit the script's stdout unchanged as the DOM output.

2d. About LWC Shadow DOM (the #1 gotcha)

Lightning Web Components use Shadow DOM. The template content is not directly queryable on the host element:

Access patternWhat you get
element.innerHTMLempty, or only slotted light-DOM content
element.outerHTMLjust the host tag, no children
element.shadowRoot.innerHTMLthe 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.


Examples

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.


Verification Checklist

  • <skill_dir>/scripts/verify-toolchain.sh <orgAlias> exited zero for the target alias.
  • Preview command ran with OPEN_BROWSER=false.
  • Preview URL logged in the Lightning Preview running at URL: <URL> format.
  • Front-door URL fetched via <skill_dir>/scripts/open-frontdoor.sh (never sf org open directly).
  • DOM extraction used shadowRoot traversal (not innerHTML on the host).
  • DOM output was produced by <skill_dir>/scripts/extract-dom.sh wrap … (script owns the markers).

Troubleshooting

  • 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.
  • Preview opens a browser window — you forgot OPEN_BROWSER=false.
  • Empty DOM on extraction — you're looking at innerHTML on a host. Use element.shadowRoot.innerHTML instead. Also verify you pierced the lwr_dev-preview-container shadow root.
  • Front-door token fails — it's expired. Re-invoke <skill_dir>/scripts/open-frontdoor.sh and navigate within ~60 seconds.

© 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 4 other files (scripts) in skills/experience-lwc-runtime-observe of forcedotcom/sf-skills.

  • SKILL.md
  • examples/component-preview-and-dom.md
  • scripts/extract-dom.sh
  • scripts/open-frontdoor.sh
  • scripts/verify-toolchain.sh

Open the folder on GitHubat commit e5164d9

Compare with similar skills

Experience Lwc Runtime Observe 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 Runtime Observe compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Experience Lwc Runtime Observe this skillforcedotcom/sf-skills1.1k—~2.5kAutomated safety check: PassApache-2.0
Soql Lib Query Builderbeyond-the-cloud-dev/soql-lib154—~4.3kAutomated safety check: PassMIT
Sf DatacloudJaganpro/sf-skills424—~2.7kAutomated safety check: PassMIT
Soql Lib Selectorbeyond-the-cloud-dev/soql-lib154—~2kAutomated safety check: PassMIT
Dev SetupPortwood-Global-Solutions/Portwood126—~1.1kAutomated safety check: PassApache-2.0
Sf FlowJaganpro/sf-skills424—~1.8kAutomated safety check: PassMIT

Similar skills

  • Soql Lib Query Builder

    beyond-the-cloud-dev/soql-lib

    Builds Salesforce SOQL queries using the SOQL Lib fluent builder API (SOQL.cls).

    154 GitHub stars~4.3k tokensUpdated 5 days ago
    Sales & SupportAuto-check passed
  • Sf Datacloud

    Jaganpro/sf-skills

    Salesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows.

    424 GitHub stars~2.7k tokensUpdated 5 mo ago
    Sales & SupportAuto-check passed
  • Soql Lib Selector

    beyond-the-cloud-dev/soql-lib

    Creates Salesforce Apex selector classes using the SOQL Lib selector pattern.

    154 GitHub stars~2k tokensUpdated 5 days ago
    Sales & SupportAuto-check passed
  • Dev Setup

    Portwood-Global-Solutions/Portwood

    Get from a fresh clone of Portwood to a working, fully-tested Salesforce org.

    126 GitHub stars~1.1k tokensUpdated today
    Sales & SupportAuto-check passed
  • Sf Flow

    Jaganpro/sf-skills

    Creates and validates Salesforce Flows with 110-point scoring.

    424 GitHub stars~1.8k tokensUpdated 5 mo ago
    Sales & SupportAuto-check passed
  • Google Maps Export

    gmapsscraper/google-maps-agent-skills

    Export Google Maps business data to CSV, JSON, or CRM format (HubSpot, Pipedrive, Salesforce).

    132 GitHub stars~1.2k tokensUpdated 4 mo ago
    Sales & SupportAuto-check passed

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 2 days ago
    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 2 days ago
    Auto-check passed
  • Apply a Salesforce sandbox post-copy automation JSON config against a target org.

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

    1.1k GitHub stars~5.4k tokensUpdated 2 days ago
    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 2 days ago
    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 2 days ago
    Auto-check passed

Works with

Categories

Questions about Experience Lwc Runtime Observe

What does Experience Lwc Runtime Observe do?

A skill your agent uses when running Salesforce Lightning Preview for an app or a single LWC component to extract the runtime DOM for inspection. Experience Lwc Runtime Observe is an agent skill from forcedotcom/sf-skills. Use when running Salesforce Lightning Preview for an app or a single LWC component to extract the runtime DOM for inspection.

When should I use Experience Lwc Runtime Observe?

Experience Lwc Runtime Observe fits situations like: running Salesforce Lightning Preview for an app; A single LWC component to extract the runtime DOM for inspection; the user says preview an LWC locally; run sf lightning dev.

How do I install Experience Lwc Runtime Observe in Claude Code?

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

How do I install Experience Lwc Runtime Observe in Codex?

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

Can I use Experience Lwc Runtime Observe 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-runtime-observe -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-runtime-observe, .gemini/skills/experience-lwc-runtime-observe, .github/skills/experience-lwc-runtime-observe and .opencode/skills/experience-lwc-runtime-observe in your project.

What does Experience Lwc Runtime Observe need to run?

Going by SKILL.md and its folder, Experience Lwc Runtime Observe needs a shell for the scripts in its folder and the command-line tools its instructions call (sf). Our summary lists: A Bash shell.

Does Experience Lwc Runtime Observe access the network?

SKILL.md names 1 domain. As links in the text: developer.salesforce.com. This is read from the text; nothing was executed.

Is Experience Lwc Runtime Observe 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 Runtime Observe use?

Experience Lwc Runtime Observe 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 Runtime Observe use?

About 2.5k tokens (SKILL.md is roughly 10k 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 Runtime Observe?

Skills that share tags, products or a category with Experience Lwc Runtime Observe: Soql Lib Query Builder (beyond-the-cloud-dev/soql-lib, 154 stars), Sf Datacloud (Jaganpro/sf-skills, 424 stars), Soql Lib Selector (beyond-the-cloud-dev/soql-lib, 154 stars) and Dev Setup (Portwood-Global-Solutions/Portwood, 126 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Experience Lwc Runtime Observe?

forcedotcom (a GitHub organization) maintains it in forcedotcom/sf-skills, which has 1,065 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.