Skip to content

Commit 8f8e64c

Browse files
Ring-wdrclaude
andauthored
Upgrade skill docs with missing commands, options, and engine semantics (#4)
Both skills were missing documentation for session status/close, node pick, profiler export, and advanced session open options (--browser, --channel, --device, --storage-state, --user-data-dir, --headless). Also adds engine selection semantics (auto/custom/devtools) to runtime-semantics.md and improves skill descriptions for better triggering accuracy. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6c60270 commit 8f8e64c

5 files changed

Lines changed: 246 additions & 21 deletions

File tree

skills/react-devtool-cli-repo/SKILL.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: react-devtool-cli-repo
3-
description: Maintain and validate the `react-devtool-cli` repository. Use when working inside this repo to change source, run tests, validate `test-app` browser flows, inspect snapshot-aware node commands, verify profiler behavior, confirm package contents, or align runtime field semantics with the bundled repo references.
3+
description: Maintain and validate the `react-devtool-cli` repository. Use when working inside this repo to change source, run tests, validate `test-app` browser flows, inspect snapshot-aware node commands, use interactive node picking, verify profiler behavior and export workflows, confirm package contents, or align runtime field semantics with the bundled repo references. Also use when debugging test failures, checking engine selection logic, or reviewing session lifecycle implementation.
44
---
55

66
# React Devtool CLI Repo
@@ -29,7 +29,8 @@ Use this skill for repository maintenance and validation. Treat the skill bundle
2929
4. Treat `test-app/` as the default browser-backed validation target.
3030
5. Run `node bin/rdt.js session doctor --session <name>` before profiler-heavy or helper-heavy validation.
3131
6. Prefer built-in `interact` commands before ad hoc Playwright helper scripts.
32-
7. Keep user-owned working tree changes out of commits unless explicitly requested.
32+
7. Use `session status` to check session health and `session close` to clean up sessions.
33+
8. Keep user-owned working tree changes out of commits unless explicitly requested.
3334

3435
## Core Repo Commands
3536

@@ -38,6 +39,8 @@ Use this skill for repository maintenance and validation. Treat the skill bundle
3839
```bash
3940
node bin/rdt.js --help
4041
node bin/rdt.js session doctor --session app
42+
node bin/rdt.js session status --session app
43+
node bin/rdt.js session close --session app
4144
node bin/rdt.js interact wait --session app --ms 250
4245
```
4346

@@ -54,6 +57,7 @@ npm run dev -- --host 127.0.0.1 --port 3000
5457
node bin/rdt.js session open --url http://127.0.0.1:3000 --session app --timeout 10000
5558
```
5659

60+
- Advanced session open options: `--browser`, `--engine`, `--channel`, `--device`, `--storage-state`, `--user-data-dir`, `--headless=false`.
5761
- Use `session attach` only when an external Chromium with CDP is already running.
5862

5963
## Validate Snapshot Workflows
@@ -62,40 +66,46 @@ node bin/rdt.js session open --url http://127.0.0.1:3000 --session app --timeout
6266
- Persist the returned `snapshotId`.
6367
- Pass `--snapshot <id>` to `node search`, `node inspect`, `node highlight`, and `source reveal`.
6468
- If `snapshot-expired` appears, collect a fresh tree and do not reuse old node ids.
69+
- Use `node pick` for interactive browser-based node selection (30s default timeout).
6570

6671
Example:
6772

6873
```bash
6974
node bin/rdt.js tree get --session app
7075
node bin/rdt.js node search SlowSearchDemo --session app --snapshot <snapshotId>
7176
node bin/rdt.js node inspect <nodeId> --session app --snapshot <snapshotId>
77+
node bin/rdt.js node pick --session app --timeout-ms 30000
7278
```
7379

7480
## Validate Profiler Workflows
7581

7682
- Use the profiler against `test-app/`, especially `SlowSearchDemo`, `ResultList`, and `ResultRow`.
7783
- Treat profiler output as commit-oriented analysis with explicit limitations.
78-
- Use the newer drill-down commands for commit analysis:
84+
- Use the drill-down commands for commit analysis:
7985

8086
```bash
81-
node bin/rdt.js profiler start --session app
87+
node bin/rdt.js profiler start --session app [--profile-id <id>]
8288
node bin/rdt.js profiler stop --session app
8389
node bin/rdt.js profiler summary --session app
8490
node bin/rdt.js profiler commits --session app
8591
node bin/rdt.js profiler commit <commitId> --session app
8692
node bin/rdt.js profiler ranked <commitId> --session app --limit 10
8793
node bin/rdt.js profiler flamegraph <commitId> --session app
8894
node bin/rdt.js profiler compare --session app --left baseline --right candidate
95+
node bin/rdt.js profiler export --session app [--output file.jsonl] [--compress]
8996
node bin/rdt.js node inspect <nodeId> --session app --commit <commitId>
9097
```
9198

9299
- Read `measurementMode`, `measuresComponentDuration`, `limitations`, and `runtimeWarnings` literally.
93100
- Treat rerender reasons as snapshot-diff inference, not changed-fiber truth.
94101
- Treat `node inspect --commit` node ids as commit-local profiler ids, not general tree snapshot ids.
102+
- `flamegraph` and `export` do not support `--format yaml`.
103+
- Exported `.jsonl` / `.jsonl.gz` files can be used as inputs to `profiler compare`.
95104

96105
## Prefer Built-in Interact Commands
97106

98107
- Use `interact click`, `interact type`, `interact press`, and `interact wait` before ad hoc helper scripts.
108+
- All interact commands accept optional `--timeout-ms <ms>` for element location timeout.
99109
- Keep selectors deterministic and CSS-based.
100110
- Use `session doctor` to confirm `supportsBuiltInInteract` before relying on interaction replay.
101111

skills/react-devtool-cli-repo/references/repo-workflows.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,33 @@ npm run dev -- --host 127.0.0.1 --port 3000
2929
node bin/rdt.js session open --url http://127.0.0.1:3000 --session app --timeout 10000
3030
```
3131

32+
- Advanced session open options:
33+
- `--browser chromium|firefox|webkit` — defaults to chromium
34+
- `--engine auto|custom|devtools` — defaults to auto
35+
- `--channel <name>` — browser channel variant
36+
- `--device <name>` — device emulation profile
37+
- `--storage-state <path>` — saved browser state
38+
- `--user-data-dir <path>` — persistent browser data directory
39+
- `--headless=false` — launch with visible browser window
40+
41+
- Use `session attach` only when an external Chromium with CDP is already running.
42+
43+
## Session Management
44+
45+
- Check session state with `session status`:
46+
47+
```bash
48+
node bin/rdt.js session status --session app
49+
```
50+
51+
- Close a session when done:
52+
53+
```bash
54+
node bin/rdt.js session close --session app
55+
```
56+
57+
Close attempts graceful shutdown first, then force-kills the process tree as fallback.
58+
3259
## Validation Lanes
3360

3461
### Snapshot-aware inspection
@@ -38,17 +65,42 @@ node bin/rdt.js session open --url http://127.0.0.1:3000 --session app --timeout
3865
- Pass `--snapshot <id>` to `node search`, `node inspect`, `node highlight`, and `source reveal`.
3966
- If `snapshot-expired` appears, collect a fresh tree and rerun lookup commands before trusting node ids.
4067

68+
### Interactive node selection
69+
70+
- Use `node pick` to let the user click a component in the browser:
71+
72+
```bash
73+
node bin/rdt.js node pick --session app [--timeout-ms 30000]
74+
```
75+
76+
Default timeout is 30 seconds. Returns the picked node details.
77+
4178
### Interaction
4279

4380
- Prefer built-in `interact click`, `interact type`, `interact press`, and `interact wait`.
4481
- Keep selectors deterministic and CSS-based.
4582
- Run `session doctor` first to confirm `supportsBuiltInInteract`.
83+
- All interact commands accept optional `--timeout-ms <ms>` for element location timeout.
4684

4785
### Profiler
4886

4987
- Treat profiler output as commit-oriented analysis, not full DevTools frontend state.
50-
- Use `profiler start`, `profiler stop`, `profiler summary`, `profiler commits`, `profiler commit`, `profiler ranked`, `profiler flamegraph`, and `profiler compare` for drill-down.
88+
- Use `profiler start [--profile-id <id>]`, `profiler stop`, `profiler summary`, `profiler commits`, `profiler commit`, `profiler ranked`, `profiler flamegraph`, and `profiler compare` for drill-down.
5189
- Use `node inspect --commit <commitId>` only with profiler-local node ids from that commit.
90+
- `flamegraph` does not support `--format yaml`.
91+
92+
### Profiler export
93+
94+
- Export recorded profiler events to NDJSON:
95+
96+
```bash
97+
node bin/rdt.js profiler export --session app [--output file.jsonl] [--compress]
98+
```
99+
100+
- `--compress` produces gzip-compressed `.jsonl.gz`.
101+
- `--output` sets the file path; defaults to `<session>-<profileId>.jsonl` in the current directory.
102+
- `export` does not support `--format yaml`.
103+
- Exported files can be used as `--left` or `--right` inputs to `profiler compare`.
52104

53105
## Publish Checks
54106

skills/react-devtool-cli-repo/references/runtime-semantics.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,49 @@
66
- `react-devtools-core` is a naming and concept reference, not a runtime dependency.
77
- `react-debug-tools` is a weak implementation reference in the current repo state.
88

9+
## Engine Selection
10+
11+
`rdt` supports multiple inspection engines, selected per-session via `--engine`:
12+
13+
| Engine | Behavior |
14+
|---|---|
15+
| `auto` (default) | Resolves the best available engine at runtime; prefers custom, falls back to devtools |
16+
| `custom` | Uses `rdt`'s own snapshot-diff inspection engine for tree collection and reason attribution |
17+
| `devtools` | Uses the DevTools-aligned hook-based engine that mirrors `react-devtools-core` conventions |
18+
19+
Engine selection affects:
20+
- **Tree collection**: Each engine maintains its own snapshot store; snapshots from one engine are not interchangeable with another.
21+
- **Reason attribution**: The custom engine uses snapshot-diff inference; the devtools engine relies on hook-reported change data.
22+
- **Profiler capabilities**: The devtools engine may report different `measurementMode` and `measuresComponentDuration` values.
23+
- **Available metadata fields**: Fields like `engineFallback`, `engineReasons`, and `availableEngines` appear in `session doctor` and `session status` output.
24+
25+
### Engine fields in doctor/status output
26+
27+
| Field | Meaning |
28+
|---|---|
29+
| `enginePreference` | The engine requested via `--engine` |
30+
| `selectedEngine` | The engine actually in use after resolution |
31+
| `availableEngines` | Engines that the runtime supports for this page |
32+
| `recommendedEngine` | The engine the runtime considers optimal |
33+
| `engineFallback` | `true` if the selected engine differs from the preference (auto resolved to a specific engine, or a forced engine was unavailable) |
34+
| `engineReasons` | Human-readable explanation of why the engine was selected |
35+
936
## Concept Mapping
1037

1138
| `rdt` concept | Closest DevTools concept | Meaning |
1239
| --- | --- | --- |
1340
| Playwright-managed session | Runtime/backend host process | `rdt` owns browser and session lifecycle directly. |
1441
| `__REACT_DEVTOOLS_GLOBAL_HOOK__` shim | DevTools global hook | Used for renderer and root discovery without adopting the frontend protocol. |
15-
| `collectTree()` snapshot | Inspected tree payload | `rdt` serializes a CLI-friendly tree snapshot. |
42+
| `collectTree()` snapshot | Inspected tree payload | `rdt` serializes a CLI-friendly tree snapshot. Engine-specific. |
1643
| `snapshotId` | No direct public equivalent | CLI-specific stability layer for follow-up commands. |
17-
| Snapshot-local node id | Inspector element identity | Only valid within the collected snapshot. |
44+
| Snapshot-local node id | Inspector element identity | Only valid within the collected snapshot and its engine. |
1845
| `node inspect` payload | Inspected element details | Snapshot-time serialized element details. |
46+
| `node pick` | Element picker | Interactive browser-based component selection. |
1947
| Profiler summary/export | Profiler commit data | Commit-oriented summaries and NDJSON export. |
2048
| `interact` commands | No direct public equivalent | Playwright-backed deterministic interaction helpers. |
2149
| `session doctor` | No direct public equivalent | CLI-specific readiness and trust-boundary report. |
50+
| `session status` | No direct public equivalent | Current session state including transport, engine, and runtime info. |
51+
| `session close` | No direct public equivalent | Graceful shutdown with force-kill fallback. |
2252

2353
## Interpretation Rules
2454

@@ -27,16 +57,21 @@
2757
- Treat `hooks` and `context` as simplified serialized views.
2858
- Expect `source` to be `null` in many builds when `_debugSource` is unavailable.
2959
- Treat rerender reasons as snapshot-diff inference, not changed-fiber truth.
60+
- Check `selectedEngine` and `engineFallback` before making claims about what the profiler or inspector can observe.
3061

3162
## Snapshot Rules
3263

3364
- Persist `snapshotId` from `tree get`.
3465
- Reuse node ids only with the same snapshot.
3566
- If a requested snapshot expires, recollect the tree before further node lookup.
67+
- Snapshots are engine-specific: a snapshot collected under the custom engine cannot be used with the devtools engine, and vice versa.
3668

3769
## Profiler Rules
3870

3971
- `measurementMode`, `measuresComponentDuration`, and `tracksChangedFibers` are capability flags that limit what can be claimed.
4072
- `nodeCountMeaning` is `live-tree-size-at-commit`.
73+
- `profiler start` accepts `--profile-id` to assign a custom identifier.
4174
- `profiler compare` works with in-memory profile ids or exported `.jsonl` / `.jsonl.gz` files.
75+
- `profiler export` writes NDJSON with optional gzip compression (`--compress`).
4276
- `node inspect --commit <commitId>` expects profiler-local node ids, not ids from `tree get`.
77+
- Exported NDJSON includes engine metadata (`engine`, `enginePreference`, `selectedEngine`, `measurementSource`) in the summary record.

skills/react-devtool-cli/SKILL.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: react-devtool-cli
3-
description: Operate and troubleshoot the published `rdt` CLI outside the source repo. Use when a user wants help installing `react-devtool-cli`, opening or attaching sessions, collecting tree snapshots, inspecting nodes, running profiler flows, interpreting `session doctor`, comparing custom vs DevTools-aligned engine output, or understanding CLI trust boundaries.
3+
description: Operate and troubleshoot the published `rdt` CLI outside the source repo. Use when a user wants help installing `react-devtool-cli`, opening or attaching sessions, checking session status, closing sessions, collecting tree snapshots, inspecting or picking nodes, running profiler flows, exporting profiler data, interpreting `session doctor`, comparing custom vs DevTools-aligned engine output, or understanding CLI trust boundaries. Also use when the user mentions React performance debugging, component tree inspection, or Playwright-based React tooling.
44
---
55

66
# React Devtool CLI
@@ -9,6 +9,8 @@ description: Operate and troubleshoot the published `rdt` CLI outside the source
99

1010
Use this skill for installed-CLI workflows used by real end users after distribution. Prefer published `rdt` commands and bundled references; if the task requires changing source code, validating `test-app/`, or editing repository docs, switch to `react-devtool-cli-repo` instead.
1111

12+
Requires Node.js >= 22.
13+
1214
## Start Here
1315

1416
- Read [references/cli-workflows.md](references/cli-workflows.md) before giving commands or interpreting output.
@@ -26,8 +28,46 @@ Use this skill for installed-CLI workflows used by real end users after distribu
2628
4. Prefer `--engine auto` unless the user explicitly wants to force `custom` or `devtools`.
2729
5. Collect a tree with `tree get` and persist `snapshotId`.
2830
6. Use snapshot-aware node commands with the same `snapshotId`.
29-
7. Run profiler commands only after a reproducible user interaction is defined.
30-
8. Prefer `primaryUpdateCommitId` or `recommendedCommitIds` over blindly drilling into `commit-1`.
31+
7. For interactive selection, use `node pick` to let the user click a component in the browser.
32+
8. Run profiler commands only after a reproducible user interaction is defined.
33+
9. Prefer `primaryUpdateCommitId` or `recommendedCommitIds` over blindly drilling into `commit-1`.
34+
10. Use `profiler export` with `--compress` to save profiler data for later comparison.
35+
11. Use `session status` to check session health and `session close` to clean up when done.
36+
37+
## Command Reference
38+
39+
### Session
40+
- `session open` — Launch a local Playwright-managed browser session
41+
- `session connect` — Connect to a remote Playwright WebSocket endpoint
42+
- `session attach` — Connect to an existing Chromium CDP target
43+
- `session status` — Check current session state
44+
- `session doctor` — Diagnose runtime readiness and trust boundaries
45+
- `session close` — Gracefully close or force-kill a session
46+
47+
### Inspection
48+
- `tree get` — Collect a component tree snapshot (returns `snapshotId`)
49+
- `node search` — Find nodes by display name within a snapshot
50+
- `node inspect` — Inspect a specific node (supports `--commit` for profiler context)
51+
- `node highlight` — Highlight a node in the browser
52+
- `node pick` — Interactively select a node by clicking in the browser
53+
- `source reveal` — Open the source file for a node in the editor
54+
55+
### Interaction
56+
- `interact click` — Click a DOM element by CSS selector
57+
- `interact type` — Type text into an element
58+
- `interact press` — Press a keyboard key
59+
- `interact wait` — Wait for a duration
60+
61+
### Profiler
62+
- `profiler start` — Begin profiling (accepts `--profile-id`)
63+
- `profiler stop` — Stop the current profiling session
64+
- `profiler summary` — Get commit count, node ranges, measurement modes
65+
- `profiler commits` — List all captured commits
66+
- `profiler commit` — Detailed analysis for a specific commit
67+
- `profiler ranked` — Ranked component analysis (accepts `--limit`)
68+
- `profiler flamegraph` — Flamegraph visualization for a commit
69+
- `profiler compare` — Compare two profiles by id or exported file path
70+
- `profiler export` — Export profiler events as NDJSON (accepts `--output`, `--compress`)
3171

3272
## Interpretation Rules
3373

0 commit comments

Comments
 (0)