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 |
scripts/extract-dom.sh
View on GitHub#!/usr/bin/env bash
# Deterministic wrapper for runtime DOM extraction. Handles the two
# operations that are pure string ops (and therefore should not be left to
# an LLM):
# 1. Convert a component name to its LWC selector (camelCase / PascalCase
# → kebab-case, prefixed with `c-`).
# 2. Wrap an already-extracted DOM subtree in the exact
# DOM_OUTPUT_START / DOM_OUTPUT_END markers the harness expects.
#
# Actual DOM traversal must be done by the caller's browser-automation
# driver (Playwright / Puppeteer / CDP) since the agent harness controls
# the browser. Feed the extracted HTML into this script on stdin and its
# marker-wrapped output goes to stdout.
#
# Usage:
# # 1. Compute the selector for a component
# <skill_dir>/scripts/extract-dom.sh selector accountTile
# → c-account-tile
#
# # 2. Wrap an app-scope subtree captured by the browser driver
# printf '%s' "$html_subtree" | <skill_dir>/scripts/extract-dom.sh wrap app
#
# # 3. Wrap a component-scope subtree (selector inferred from the name)
# printf '%s' "$html_subtree" | <skill_dir>/scripts/extract-dom.sh wrap component accountTile
set -euo pipefail
usage() {
cat >&2 <<'EOF'
usage:
extract-dom.sh selector <componentName>
extract-dom.sh wrap app
extract-dom.sh wrap component <componentName>
EOF
exit 2
}
to_selector() {
local name="$1"
python3 - "$name" <<'PY'
import re, sys
name = sys.argv[1]
kebab = re.sub(r'(?<!^)(?=[A-Z])', '-', name).lower()
kebab = re.sub(r'[^a-z0-9]+', '-', kebab).strip('-')
print(f"c-{kebab}")
PY
}
cmd="${1:-}"
case "$cmd" in
selector)
[[ $# -eq 2 ]] || usage
to_selector "$2"
;;
wrap)
scope="${2:-}"
case "$scope" in
app)
[[ $# -eq 2 ]] || usage
printf 'DOM_OUTPUT_START\n'
cat
printf '\nDOM_OUTPUT_END\n'
;;
component)
[[ $# -eq 3 ]] || usage
selector="$(to_selector "$3")"
printf 'DOM_OUTPUT_START\n<%s>' "$selector"
cat
printf '</%s>\nDOM_OUTPUT_END\n' "$selector"
;;
*)
usage
;;
esac
;;
*)
usage
;;
esac
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 |