forcedotcom/sf-skills / plugins/builder/experience-lwc/skills/experience-lwc-runtime-observe
experience-lwc-runtime-observe
VerifiedUse 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.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 10.0 KB |
| examples/component-preview-and-dom.md | markdown | 1.5 KB |
| scripts/extract-dom.shexecutable | script | 2.1 KB |
| scripts/open-frontdoor.shexecutable | script | 1.8 KB |
| scripts/verify-toolchain.shexecutable | script | 1.7 KB |
examples/component-preview-and-dom.md
View on GitHub# Example — preview a component and grab its DOM
**User:** "Preview `accountTile` from my org `dev-sandbox` and give me the
rendered HTML."
**Agent:**
1. `"<skill_dir>/scripts/verify-toolchain.sh" dev-sandbox` — passes.
2. `OPEN_BROWSER=false sf lightning dev component -o dev-sandbox -n accountTile`
3. Log: `Lightning Preview running at URL: http://localhost:3333/...`
4. Capture the helper output first so a failure aborts the caller, then
eval the exports:
```bash
frontdoor_env="$("<skill_dir>/scripts/open-frontdoor.sh" dev-sandbox http://localhost:3333/...)" || exit 1
eval "$frontdoor_env"
```
`$FRONTDOOR_URL_FILE` and `$PREVIEW_URL` are now exported for the
browser process (do NOT read/print the tempfile's contents).
5. Browser driver reads the URL from `$FRONTDOOR_URL_FILE`, navigates to
establish session, then deletes the file.
6. Navigate to preview URL, wait for network idle.
7. Compute the selector:
```bash
selector="$("<skill_dir>/scripts/extract-dom.sh" selector accountTile)"
# → c-account-tile
```
8. Pierce `lwr_dev-preview-container` shadow root via the driver, find
the first `$selector` host, read `element.shadowRoot.innerHTML` into
`$html_subtree`, and wrap:
```bash
printf '%s' "$html_subtree" \
| "<skill_dir>/scripts/extract-dom.sh" wrap component accountTile
```
Emits:
```text
DOM_OUTPUT_START
<c-account-tile>
<!-- rendered shadow DOM here -->
</c-account-tile>
DOM_OUTPUT_END
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |