Skip to content

Commit d77d96f

Browse files
committed
docs: restore react devtools advanced guidance
1 parent 8e7c72c commit d77d96f

4 files changed

Lines changed: 74 additions & 1 deletion

File tree

skills/react-devtools/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ agent-device react-devtools profile rerenders --limit 5
3636

3737
Rules:
3838

39-
Keep reads bounded with `--depth`/`find`, treat `@c` refs as reload-local, profile only the investigated interaction, and run the same command in remote Android sessions; the CLI manages the companion tunnel.
39+
Keep reads bounded with `--depth`/`find`, treat `@c` refs as reload-local, profile only the investigated interaction, and run the same command in remote Android sessions; the CLI manages the needed local service tunnel.

src/utils/__tests__/args.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,26 @@ test('usageForCommand resolves dogfood help topic', () => {
872872
assert.match(help, /screenshot \.\/dogfood-output\/screenshots\/issue-001\.png --overlay-refs/);
873873
});
874874

875+
test('usageForCommand resolves react-devtools help topic', () => {
876+
const help = usageForCommand('react-devtools');
877+
if (help === null) throw new Error('Expected react-devtools help text');
878+
assert.match(help, /agent-device react-devtools start/);
879+
assert.match(help, /agent-device react-devtools wait --component <ComponentName>/);
880+
assert.match(help, /agent-device react-devtools find <ComponentName> --exact/);
881+
assert.match(help, /agent-device react-devtools errors/);
882+
assert.match(help, /agent-device react-devtools profile report @c5/);
883+
assert.match(help, /agent-device react-devtools profile timeline --limit 20/);
884+
assert.match(help, /agent-device react-devtools profile export profile\.json/);
885+
assert.match(
886+
help,
887+
/agent-device react-devtools profile diff before\.json after\.json --limit 10/,
888+
);
889+
assert.match(help, /render causes and changed props\/state\/hooks/);
890+
assert.match(help, /@c refs reset after reload\/remount/);
891+
assert.match(help, /isolated --state-dir/);
892+
assert.match(help, /local service tunnel/);
893+
});
894+
875895
test('apps defaults to --all filter and allows overrides', () => {
876896
const defaultFilter = parseArgs(['apps'], { strictFlags: true });
877897
assert.equal(defaultFilter.command, 'apps');

src/utils/command-schema.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,22 +386,40 @@ React Native internals:
386386
Use this for React Native performance/profiling and internals that the accessibility tree cannot expose: components, props, state, hooks, ownership, slow renders, and rerenders.
387387
388388
Core commands:
389+
agent-device react-devtools start
390+
agent-device react-devtools stop
389391
agent-device react-devtools status
390392
agent-device react-devtools wait --connected
393+
agent-device react-devtools wait --component <ComponentName>
394+
agent-device react-devtools count
391395
agent-device react-devtools get tree --depth 3
392396
agent-device react-devtools find <ComponentName>
397+
agent-device react-devtools find <ComponentName> --exact
393398
agent-device react-devtools get component @c5
399+
agent-device react-devtools errors
394400
agent-device react-devtools profile start
395401
agent-device react-devtools profile stop
396402
agent-device react-devtools profile slow --limit 5
397403
agent-device react-devtools profile rerenders --limit 5
404+
agent-device react-devtools profile report @c5
405+
agent-device react-devtools profile timeline --limit 20
406+
agent-device react-devtools profile export profile.json
407+
agent-device react-devtools profile diff before.json after.json --limit 10
398408
399409
Profiling loop:
400410
1. Verify the app is connected: react-devtools status, then wait --connected if needed.
401411
2. Start profiling immediately before the interaction.
402412
3. Drive the interaction with normal agent-device commands.
403413
4. Stop profiling.
404414
5. Inspect slow components and rerenders.
415+
6. Use profile report @cN for render causes and changed props/state/hooks; use get component @cN for current props/state/hooks.
416+
417+
Rules:
418+
Start with get tree --depth 3 or find <name>; use find --exact when fuzzy results are noisy.
419+
@c refs reset after reload/remount. After reload, wait --connected and inspect again.
420+
Keep the profile window narrow; unrelated navigation makes render data noisy.
421+
For cross-platform validation with explicit device selectors, prefer isolated --state-dir and restart react-devtools between platforms.
422+
Remote Android runs normally through agent-device react-devtools; the CLI manages the needed local service tunnel. Expo support depends on the SDK's bundled React Native runtime.
405423
406424
Example:
407425
agent-device react-devtools status
@@ -411,6 +429,7 @@ Example:
411429
agent-device react-devtools profile stop
412430
agent-device react-devtools profile slow --limit 5
413431
agent-device react-devtools profile rerenders --limit 5
432+
agent-device react-devtools profile report @c5
414433
415434
Use snapshot, screenshot, logs, network, and perf for device/app runtime evidence. Use react-devtools only when component internals or React rendering behavior matters.`,
416435
},

test/skillgym/suites/agent-device-smoke-suite.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,40 @@ const SKILL_GUIDANCE_CASES: TestCase[] = [
710710
],
711711
forbiddenOutputs: [commandPattern('snapshot'), commandPattern('perf')],
712712
}),
713+
makeCase({
714+
id: 'react-devtools-exact-component-inspect',
715+
contract: [
716+
'App name: Agent Device Tester',
717+
'React Native DevTools is connected',
718+
'Need current props, state, and hooks for component SearchScreen',
719+
'Fuzzy component search returns noisy matches unless exact matching is used',
720+
],
721+
task: 'Plan bounded React DevTools commands to find the exact SearchScreen component and inspect it.',
722+
outputs: [
723+
commandPattern('react-devtools find'),
724+
/SearchScreen/i,
725+
/--exact/i,
726+
commandPattern('react-devtools get component'),
727+
],
728+
forbiddenOutputs: [commandPattern('snapshot'), commandPattern('perf')],
729+
}),
730+
makeCase({
731+
id: 'react-devtools-render-cause-report',
732+
contract: [
733+
'App name: Agent Device Tester',
734+
'React Native profile has already been stopped',
735+
'Rerender suspect from profile output: @c12',
736+
'Need render causes and changed props/state/hooks for that component',
737+
],
738+
task: 'Plan the React DevTools command to inspect render causes for @c12.',
739+
outputs: [commandPattern('react-devtools profile report'), /@c12/i],
740+
forbiddenOutputs: [
741+
commandPattern('snapshot'),
742+
commandPattern('perf'),
743+
commandPattern('react-devtools profile slow'),
744+
commandPattern('react-devtools profile rerenders'),
745+
],
746+
}),
713747
makeCase({
714748
id: 'gesture-swipe-carousel',
715749
contract: [

0 commit comments

Comments
 (0)