К основному содержанию
скилл Claude Code CX Codex Cursor GitHub Copilot

argent-react-native-profiler — скилл для Claude Code

Профилирует React Native-приложение на Hermes: показывает ререндеры, загрузку CPU и горячие места. Нужен для проверки оптимизаций.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add software-mansion/argent --skill argent-react-native-profiler -a claude-code
Открыть на GitHub

Что делает argent-react-native-profiler

Скилл запускает профилирование React Native-приложения на Hermes и собирает данные о React-коммитах и загрузке CPU. После остановки он формирует отчёт с коммитами, отсортированными по времени рендера, а также сохраняет исходные данные для дальнейшего разбора.

В набор входят инструменты react-profiler-start, react-profiler-stop, react-profiler-analyze, react-profiler-renders, react-profiler-fiber-tree и react-profiler-component-source. После анализа можно искать горячие функции, каскады коммитов, CPU по компонентам и стеки зависаний через query-инструменты.

Физический iPhone не поддерживается: профилирование нужно запускать на симуляторе. Это повод проверить среду до начала замеров. Скилл дополняет argent-react-native-optimization, а не заменяет его.

Какие задачи решает

  • найти компоненты с частыми ререндерами
  • измерить CPU до и после исправления
  • составить список самых долгих React-коммитов
  • проверить горячие функции и узкие места CPU
  • разобрать каскад обновлений компонента

Примеры запросов агенту

  • Запусти профилирование сценария прокрутки списка и покажи компоненты с наибольшим временем рендера.
  • Сравни CPU и длительность React-коммитов до и после моего исправления.
  • Проанализируй самый долгий коммит и найди компонент, который запускает каскад обновлений.

Как установить argent-react-native-profiler

1Через Skills CLI (Vercel)

npx skills add software-mansion/argent --skill argent-react-native-profiler -a claude-code

2Вручную: положить файлы

~/.claude/skills/argent-react-native-profiler/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/argent-react-native-profiler/

Из того же набора15

Весь набор →
argent-android-emulator-setup software-mansion Скилл подключает Android-эмулятор через инструменты argent MCP. Нужен перед работой с интерфейсом Android или запуском эмулятора. Claude Code CX Codex Cursor +1 26 500установок argent-react-native-optimization software-mansion Скилл выявляет узкие места в React Native через замеры и очищает код от механических проблем. Запускается при лагах интерфейса, долгом старте или частых лишних рендерах. Claude Code CX Codex Cursor +1 26 400установок argent-react-native-app-workflow software-mansion Задаёт пошаговый процесс сборки, запуска и отладки React Native в симуляторе iOS или эмуляторе Android. Помогает поднять Metro и разобрать сбои билда. Claude Code CX Codex Cursor +1 26 300установок argent-ios-simulator-setup software-mansion Скилл для подключения к iOS-симулятору через MCP-инструменты argent. Используй перед любой работой с симулятором: загрузка устройства, получение UDID, взаимодействие с интерфейсом. Claude Code CX Codex Cursor +1 26 300установок argent-native-profiler software-mansion Профилирует нативную производительность на iOS и Android, помогает находить нагрузку на CPU и зависания интерфейса. Утечки памяти анализирует на iOS. Claude Code CX Codex Cursor +1 26 200установок argent-metro-debugger software-mansion Скилл подключает отладчик к JS-рантайму через CDP: инспектируете React-компоненты, читаете логи консоли, вычисляете код прямо в процессе. Работает с React Native (iOS, Android, Vega) и Chromium-приложениями (Electron, браузеры). Claude Code CX Codex Cursor +1 26 200установок argent-test-ui-flow software-mansion Скилл для автономного тестирования интерфейсов iOS и Android в Claude Code. Прогоняет цикл из кликов, скриншотов и проверок через MCP-инструменты argent. Claude Code CX Codex Cursor +1 26 200установок argent-screenshot-diff software-mansion Сравнивает скриншоты до и после изменений в UI: ловит сдвиги в раскладке, отступах, цвете и рендере текста. Claude Code CX Codex Cursor +1 24 900установок

Похожие

apple-hig nexu-io Подключает базу Apple Human Interface Guidelines для iOS, macOS, visionOS, watchOS и tvOS к агенту при проектировании интерфейсов. Claude Code CX Codex Cursor +1 3 200установок vercel-react-native-skills vercel Набор правил по React Native и Expo для ИИ-агента: списки, анимации, навигация. Пригодится, когда агент правит мобильный код и надо, чтобы он делал это одинаково. Claude Code CX Codex Cursor +1 253 900установок animate-expo emilkowalski Создаёт мобильные анимации для React Native и Expo на базе Reanimated и Gesture Handler. Помогает избежать просадок кадров на реальных устройствах. Claude Code CX Codex Cursor +1 135 900установок mobile-native emilkowalski Убирает мелочи, из-за которых веб-приложение на телефоне выдаёт себя: залипающий hover, вспышку при тапе, ошибку с 100vh. Claude Code CX Codex Cursor +1 84 500установок aso coreyhaines31 Анализирует страницы приложений в App Store и Google Play по правилам поисковой оптимизации. Находит слабые места в метаданных, графике и конверсии. Claude Code CX Codex Cursor +1 74 900установок swiftui-pro Paul Hudson Проверяет SwiftUI-код на устаревшие API, ошибки в структуре и проблемы доступности. Пригодится для ревью и доработки проектов на SwiftUI. Claude Code CX Codex Cursor +1 35 000установок orca-emulator stablyai Управляет iOS Simulator внутри Orca с живым экраном устройства. Пригодится для тапов, жестов, поворота экрана и сбора доказательств работы iOS-приложения. Claude Code CX Codex Cursor +1 5 800установок

Вопросы о argent-react-native-profiler

Как установить argent-react-native-profiler в Claude Code?

Выполните по порядку: npx skills add software-mansion/argent --skill argent-react-native-profiler -a claude-code, затем повторите npx skills add software-mansion/argent --skill argent-react-native-profiler -a claude-code, после этого откройте ~/.claude/skills/argent-react-native-profiler/SKILL.md.

Что делает argent-react-native-profiler?

Скилл профилирует React Native-приложение на Hermes, измеряет ререндеры и CPU, а затем формирует отчёт по горячим коммитам и компонентам. Результаты можно исследовать через query-инструменты.

Работает ли профилирование на физическом iPhone?

Нет. Инструменты react-profiler-* не поддерживают kind: "device", поэтому профилирование запускают на симуляторе.

Исходный текст

SKILL.md · Apache-2.0
---
name: argent-react-native-profiler
description: Profile a React Native Hermes app to measure re-render and CPU performance using argent profiler tools. Use when optimizing for performance, measuring before/after a fix, spotting slow components, diagnosing re-renders, checking CPU hotspots, or producing a ranked issue report.
---

This skill is complementary to `argent-react-native-optimization`, not a replacement for it.

Physical iPhone: not supported; `react-profiler-*` reject `kind: "device"`. Profile on a simulator.

## 2. Tool Overview

### React Profiler (Hermes / React commits)

| Tool                              | Purpose                                                                                                                                                                                                                                                           |
| --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `react-profiler-start`            | Start CPU sampling + inject React commit-capture hook. Optional: `sample_interval_us` (default 100).                                                                                                                                                              |
| `react-profiler-stop`             | Stop recording; stores cpuProfile + commitTree in session.                                                                                                                                                                                                        |
| `react-profiler-status`           | **Call if you were interrupted in the middle of the flow, never in another scenario** (debugger drop, Metro reload, pause, subagent handoff, any doubt). Returns `session_status: "active" \| "taken_over" \| "stopped" \| "no_react_runtime"`. Side-effect free. |
| `react-profiler-analyze`          | Run pipeline -> report with CPU-enriched hot commits, sorted by `totalRenderMs` DESC. Saves raw data to disk.                                                                                                                                                     |
| `react-profiler-component-source` | AST lookup: file, line, memoization status, 50 lines of source for a component.                                                                                                                                                                                   |
| `react-profiler-renders`          | Live fiber walk: render counts + durations per component (no profiling session required).                                                                                                                                                                         |
| `react-profiler-fiber-tree`       | Live fiber walk: full component hierarchy as JSON.                                                                                                                                                                                                                |

### Drill-Down Query Tools (call after analyze)

| Tool                       | Purpose                                                                                      |
| -------------------------- | -------------------------------------------------------------------------------------------- |
| `profiler-cpu-query`       | Targeted CPU investigation: top functions, time-windowed CPU, call trees, per-component CPU. |
| `profiler-commit-query`    | Targeted commit investigation: by component, time range, commit index, or cascade tree.      |
| `profiler-stack-query`     | iOS Instruments drill-down: hang stacks, function callers, thread breakdown, leak details.   |
| `profiler-combined-report` | Cross-correlated report when both React Profiler and native profiler ran in parallel.        |
| `profiler-load`            | List and reload previous profiling sessions from disk for re-investigation with query tools. |

For native profiling (CPU hotspots, UI hangs, memory leaks), see the `argent-native-profiler` skill.

---

## 3. Agent Behavior Guidelines

Follow these rules throughout the profiling workflow:

- Start `react-profiler-start` and `native-profiler-start` in parallel (two tool calls in one message). Both need `device_id`; use the same UDID for both so their data can be correlated later. This gives best coverage.
- If the user only wants native profiling, use the `argent-native-profiler` skill workflow. Only skip `native-profiler-start` if the user has **already explicitly said** they don't want native profiling in this session

### After analysis: ask about next steps

After presenting the analysis report, always ask the user what they want to do next. Present these options:

1. **Investigate further**: drill down into specific findings using query tools (CPU call trees, commit cascades, hang stacks, etc.) to identify root causes with confidence before making changes.
2. **Implement fixes**: apply changes based on the current findings, then re-profile to measure whether the metric changed (improved, regressed, or stayed flat).
3. **Done for now**: accept the report as-is.

Do NOT silently move on after the report. The report is the starting point, not the end; query tools exist specifically to let you dig deeper into anything the report flags.

### During investigation: use query tools proactively

When drilling down, chain query tool calls based on what you find:

- A hot commit -> `profiler-commit-query` mode=`by_index` to see all components -> `profiler-cpu-query` mode=`component_cpu` for the slowest one -> `profiler-cpu-query` mode=`call_tree` for the hot function -> read the source file -> propose a fix.
- A memory leak -> `profiler-stack-query` mode=`leak_stacks` to identify the responsible module -> read the native source if actionable.
- A native hang -> `profiler-stack-query` mode=`hang_stacks` to get the native call chain -> correlate with React commit timing.

### After fixes: always re-profile

When you apply a fix, always re-profile the same scenario afterward. Compare before/after metrics (commit durations, CPU time, render counts) and report honestly: did the target metric improve, stay flat, or regress? Did any _other_ metric get worse? If you need to reference the original data, use `profiler-load` to reload the pre-fix session. If the fix showed no improvement or introduced a regression, say so explicitly and reconsider the approach.

### Use e2e tests for reproducible profiling

When profiling requires a specific interaction sequence (scroll a list, navigate screens, trigger an animation), **record the interaction as an e2e test** using the `argent-create-e2e` skill before the first profiling run. Then replay the same e2e test for every subsequent run. This eliminates interaction variance as a confounder and makes before/after comparisons meaningful. Especially important when:

- You are about to re-profile after applying a fix (Step 8).
- The user asks you to compare multiple profiling sessions.
- The interaction path is more than 2-3 steps long.

---

## 4. Standard Profiling Workflow

**Complete all steps in order; do not break mid-flow.**

### Step 1: Start profiling

Mind the react-native and ios-native profiler selection mentioned above when starting the session and start the tools. **Save `startedAtEpochMs` from the response**: you will need it for annotation offsets. Every subsequent profiler/query call in this session must use the same `device_id`. Before beginning, define lightweight success criteria with the user: which metric matters most (e.g., `totalRenderMs`, specific commit duration, render count for a component) and what threshold would be meaningful. This anchors later evaluation. On success:

- if user asked you to perform the profiling, determine how to profile yourself using tools described in `argent-device-interact` skill.
- if the user stated they wish to perform the interaction themselves, suggest what interaction to perform (e.g. "scroll the list", "switch tabs") and wait for their reply.
  If you received information about **existing profiling session** being owned by another agent:
- if session is marked as "stale", you may overtake it without prompting the user for allowance
- if session is NOT "stale" - before taking action and terminating the other session, **stop and ask user what you should do**, explaining the situation.

#### Annotate every interaction

After each `gesture-tap` or `gesture-swipe` call, record an annotation using the returned `timestampMs`. Compute `offsetMs = timestampMs - startedAtEpochMs`. Do this for _every_ interaction, including back-navigation swipes, not just the primary action. Pass all collected annotations to `react-profiler-analyze` in Step 3.

### Step 2: Stop and collect

Call `react-profiler-stop` **and** `native-profiler-stop` in parallel. Only skip `native-profiler-stop` if you did not start it in Step 1. Note `duration_ms` and `fiber_renders_captured`.
If `fiber_renders_captured: 0`, warn the user: React commit data may be missing.

### Step 3: Analyze

Call `react-profiler-analyze` with `port`, `device_id`, `project_root`, `platform`, and `rn_version`. The report includes metadata such as `reactCompilerEnabled`, `strictModeEnabled`, and `buildMode`; check these in the returned markdown report.

If you performed interactions using `gesture-tap`/`gesture-swipe`, pass `annotations` to mark when each action occurred. Each annotation's `offsetMs` must be computed as `tapTimestampMs - startedAtEpochMs`, where `tapTimestampMs` is the `timestampMs` returned by the gesture-tap/gesture-swipe tool and `startedAtEpochMs` was returned by `react-profiler-start`. Do **not** use `Date.now()` for this calculation; only server-side timestamps from the tool return values.

If dual profiling, also call `native-profiler-analyze`, then **you must** call `profiler-combined-report` for the cross-correlated view; do not skip this step when both profilers ran; the combined report surfaces correlations that individual reports miss.

The analyze report includes **CPU hotspots per commit**, showing exactly which JS functions ran during each slow React commit. Raw data is saved to disk automatically for later reload.

### Step 4: Assess results

Analyze whether the results give you a proper image of what is wrong with the application - **do not assume improvement always exists**, verify results logically with reference to how react-native works. Make sure to give honest feedback and be ready to change the approach if needed.

### Step 5: Present findings and ask about next steps

Present a concise summary of the key findings - present whether possibilities for improvement exist and how performing further actions could affect performance. Then follow the "After analysis" guideline: ask whether to investigate further, implement fixes (if available), or stop.

### Step 6: Drill-down investigation (iterative)

Based on findings from the report, use query tools to investigate deeper:

- **Slow component?** -> `profiler-cpu-query` mode=`component_cpu` component_name=`AppNavigator`: shows what JS functions ran during that component's commits.
- **Want to see the call tree?** -> `profiler-cpu-query` mode=`call_tree` function_name=`expensiveFunction`: shows callers and callees.
- **What happened during a time window?** -> `profiler-commit-query` mode=`by_time_range`: lists all commits in a range.
- **Full commit detail?** -> `profiler-commit-query` mode=`by_index` commit_index=38: all components, props changes, parent cascade.
- **Who triggered whom?** -> `profiler-commit-query` mode=`cascade_tree`: visual parent-child cascade.
- **iOS hang details?** -> `profiler-stack-query` mode=`hang_stacks`: native call stacks during a hang.

Repeat as needed until you identify the root cause function and file, referring to step 4 for honest evaluation. After each round of investigation, ask the user if they want to continue digging or move to fixing.

### Step 7: Reload a previous session

If you profiled multiple scenarios and need to revisit earlier data:

1. Call `profiler-load` mode=`list` to see all saved sessions with timestamps (the list now also shows Runtime / Device / Metro bundle columns to help identify the right session).
2. Call `profiler-load` mode=`load_react` session_id=`<timestamp>` device_id=`<UDID>` to reload React data. `device_id` scopes the reload into the `port:device_id` cache slot.
3. Call `profiler-load` mode=`load_native` session_id=`<timestamp>` device_id=`<UDID>` to reload native profiler data.
4. Query tools now operate on the reloaded session data; **pass the same `device_id` you loaded with**, otherwise they will miss the cache.

This is useful for before/after comparisons: profile, fix, re-profile, then reload the original session to compare metrics side by side.

### Step 8: Apply fix and re-profile

If fix is present, read the source code of the identified bottleneck using `react-profiler-component-source` or the Read tool. Apply the fix, then re-profile (Step 1 -> user interaction -> Step 2 -> Step 3 -> Step 4). Report whether the target metric improved, stayed flat, or regressed. Also check whether the fix introduced regressions in other metrics (e.g., render count dropped but CPU time increased, or a different component now re-renders more). If the fix showed no net benefit or unacceptable tradeoffs, revert and reconsider.

**Tip:** If the interaction sequence was recorded as an e2e test (see "Use e2e tests for reproducible profiling" above), replay it with `e2e-execute` instead of manually repeating the steps. This guarantees identical interaction conditions for the comparison. If the e2e test fails during replay (e.g., a UI fix changed the layout), follow `argent-create-e2e`'s [Diagnose a replay failure](../argent-create-e2e/references/reliability-and-recovery.md#diagnose-a-replay-failure) to repair the e2e test before retrying the profiling cycle.

If the user stated that they do not wish for changes, present the profiling report and skip the fix but suggest it to the user.

**React Compiler rule:** If the analyze report indicates React Compiler is enabled, do NOT propose `useCallback`/`useMemo`/`React.memo` unless you confirmed compiler bail-out (check `react-profiler-fiber-tree` for absent `useMemoCache` on that component).

---

## 5. Important Caveats

- **Dev mode inflation**: `buildMode: "dev"` renders are ~3x slower than production. Prioritize high `normalizedRenderCount`; it scales to prod.
- **Re-run after fixes**: Always re-profile after changes. Report honestly whether the metric improved, regressed, or stayed flat; do not assume improvement.
- **`excluded` is informational**: Components in `animatedSubtrees` and `recyclerChildren` re-render by design.
- **Strict Mode**: Double-invokes renders. The pipeline halves `normalizedRenderCount` automatically when detected.
- **Debugger connection**: If interrupted, started profiling also closes. Before attempting recovery, call `react-profiler-status`: it tells you whether the session is `active`, `taken_over`, `stopped`, or `no_react_runtime`, so you can decide whether to stop, restart, or reconnect first.
- **Confounders to watch for**:
  - Live API data may differ between runs (different payload sizes, content counts), which shifts render counts and durations independently of your fix. Note when data-dependent components show variance.
  - Profiler overhead inflates CPU measurements. If iOS Instruments shows `JSLexer`, `JSONEmitter`, or Hermes internals dominating the JS thread, that reflects profiler instrumentation cost, not app work. Discount those entries.
  - Runs are not perfectly reproducible. Small variations (under ~10-15%) in commit duration may be noise; only treat consistent, directional changes as signal.

For standalone diagnostic tools (live render stats, fiber tree, CPU summary), see `references/diagnostic-tools.md`.

© software-mansion · Apache-2.0 · software-mansion/argent

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой