Skip to content

Commit 3c4da62

Browse files
joelgwebberclaude
andcommitted
Update skills to use view-inspect for sightmap selector discovery
The sightmap setup recipe previously used live-eval-script with JS one-liners to discover CSS selectors — a hack born from snapshots not exposing selector info. Replace with live-view-inspect, which returns the full component tree with tag, id, classes, and attributes natively. Also adds view-inspect / review-inspect to the live and session tool catalogs, with clear guidance that these are for sightmap authoring only — not as a general snapshot replacement. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e583372 commit 3c4da62

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

skills/live/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ API catalog for live browser tools (all prefixed `live-`) on the unified subtext
3232
| `live-view-select` | Switch to a different view |
3333
| `live-view-close` | Close a view |
3434
| `live-view-snapshot` | Component tree snapshot (no screenshot) |
35+
| `live-view-inspect` | Component tree with full CSS selectors — for sightmap authoring only, not general use |
3536
| `live-view-screenshot` | Visual screenshot of current view |
3637
| `live-view-resize` | Resize the viewport |
3738

@@ -94,6 +95,7 @@ After every `live-connect`, check `capture_status` and respond as follows:
9495

9596
- Always `live-view-snapshot` before interacting — you need element UIDs to click/fill.
9697
- `live-view-snapshot` is cheaper than `live-view-screenshot`. Prefer snapshots; use screenshots for visual evidence.
98+
- `live-view-inspect` is for **sightmap authoring only** — it returns verbose CSS selectors on every node. Do not use it as a general snapshot replacement. Use it once to discover selectors, write your `.sightmap/` YAML, then use `live-view-snapshot` for everything else.
9799
- Component names from sightmap appear in snapshots — use `[src: ...]` annotations to find source files.
98100
- Close connections when done to free server resources.
99101

skills/recipe-sightmap-setup/SKILL.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,8 @@ metadata:
1515
1. **Navigate to the page**: `live-view-navigate(url=...)` or `live-view-new(url=...)`
1616
2. **Take a baseline snapshot**: `live-view-snapshot()` to see the current a11y tree with generic roles
1717
3. **Identify key UI components** in the snapshot (navigation, forms, cards, modals, etc.)
18-
4. **Find good selectors** using `live-eval-script`:
19-
```js
20-
(el) => { return el.tagName + '.' + el.className + ' ' + el.id; }
21-
```
22-
Prefer `data-*` attributes when available — they're stable and semantically meaningful (e.g., `[data-component="ProductTile"]`, `[data-testid="checkout-button"]`). Check for them with:
23-
```js
24-
(el) => { return JSON.stringify(Object.fromEntries([...el.attributes].filter(a => a.name.startsWith('data-')).map(a => [a.name, a.value]))); }
25-
```
18+
4. **Find good selectors** using `live-view-inspect()` — this returns the full component tree with CSS selectors (tag, id, classes, `data-*` attributes, `aria-*`, `href`, etc.) on every node. Use it to identify stable targeting info, then switch back to `live-view-snapshot()` for normal interaction.
19+
Prefer `data-*` attributes when available — they're stable and semantically meaningful (e.g., `[data-component="ProductTile"]`, `[data-testid="checkout-button"]`).
2620
5. **Create `.sightmap/components.yaml`** with component definitions (see `subtext:sightmap` skill for schema)
2721
6. **Add memories** to key components — contextual notes that appear in a `[Guide]` section at the top of every snapshot. Focus on:
2822
- **Auth/access**: passwords, test accounts, login flows (e.g., `"Password is 'argus'"`)

skills/session/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ API catalog for the session replay tools (all prefixed `review-`). These tools l
1818
|------|-------------|
1919
| `review-open` | Open a session for analysis. Returns event summaries, metadata, timestamps. |
2020
| `review-view` | Capture UI state at a timestamp — component tree + screenshot |
21+
| `review-inspect` | Component tree with full CSS selectors — for sightmap authoring only, not general use |
2122
| `review-diff` | Compare UI state between two timestamps |
2223
| `review-close` | Close the session and free resources |
2324

0 commit comments

Comments
 (0)