Agent Skills › software-mansion/argent › argent-react-native-optimization

argent-react-native-optimization

GitHub

React Native性能优化入口,通过测量定位瓶颈并修复。涵盖Lint扫描、语义审查及Profiler深度分析,确保修复有效且无回归。

packages/skills/skills/argent-react-native-optimization/SKILL.md software-mansion/argent

Trigger Scenarios

应用运行缓慢 需要减少渲染次数或卡顿 要求优化启动速度

Install

npx skills add software-mansion/argent --skill argent-react-native-optimization -g -y
More Options

Non-standard path

npx skills add https://github.com/software-mansion/argent/tree/main/packages/skills/skills/argent-react-native-optimization -g -y

Use without installing

npx skills use software-mansion/argent@argent-react-native-optimization

指定 Agent (Claude Code)

npx skills add software-mansion/argent --skill argent-react-native-optimization -a claude-code -g -y

安装 repo 全部 skill

npx skills add software-mansion/argent --all -g -y

预览 repo 内 skill

npx skills add software-mansion/argent --list

SKILL.md

Frontmatter
{
    "name": "argent-react-native-optimization",
    "description": "Optimizes a React Native app by profiling first to find real bottlenecks, then sweeping for mechanical issues. Entry-point for all performance work. Use when the app feels slow, user asks to optimize, fix re-renders, reduce jank, or improve startup. Delegates to argent-react-native-profiler for measurement."
}

Rules

  • Do not apply shotgun optimizations. Measure first, define what "good enough" looks like (target metric + threshold), fix the top offender, re-measure honestly.
  • Profile for discovery, not only verification. Use the profiler to find issues static analysis missed, not only to confirm fixes.
  • Verify before fixing: recollect the evidence and conclude whether the fix is worth undertaking. Validate a fix with debugger-evaluate before committing it.
  • One fix per cycle for architectural changes. Mechanical batch fixes (inline styles, index keys) can be grouped; re-profile once after the batch. When the measurement involves device interaction, record it as an e2e test (argent-create-e2e skill) before the first run so every cycle replays identical steps.
  • React Compiler: if the project uses it (babel-plugin-react-compiler in the Babel config, or experiments.reactCompiler: true in the Expo config), skip memoization fixes (React.memo, useMemo, useCallback, hoisting inline objects and functions) in every phase; the compiler does them. Keep them for components the compiler skips (compilationMode: "annotation", "use no memo", a sources filter). Where the profiler report marks a component ⚠️ (bailout suspected), fix what stops the compiler.
  • Sub-agents: Phases 1–2 dispatch sub-agents: one per file for lint results, one per checklist item for semantic. Sub-agents CANNOT touch the device - all profiling and E2E verification must happen in the main agent.

Pipeline

Lint and semantic sweeps catch deterministic issues cheaply. Profiling finds runtime bottlenecks that static analysis misses. Do both.

Copy this checklist into your TODO list:

Optimization Progress:
- [ ] Phase 1: Lint sweep (deterministic: catch mechanical issues without a running app)
- [ ] Phase 2: Semantic sweep (judgment: memoization, lists, animations, etc.)
- [ ] Phase 3: Baseline profile (find real bottlenecks, fix top offenders)
- [ ] Phase 4: Verify no regressions (crashes, errors, red screens)
- [ ] Re-run lint to confirm the fixes added no new issues and none were missed

Phase 1: Lint sweep

Run ESLint once at the project root with a comprehensive RN performance ruleset. Dispatch sub-agents to fix results: one per file, in parallel. See references/lint-rules.md for ruleset and procedure.

Phase 2: Semantic sweep

Review each area requiring judgment: memoization, list rendering, animations, async patterns, effect cleanup, state hygiene, context architecture. Dispatch one sub-agent per checklist item. See references/semantic-checklist.md for full checklist.

Phase 3: Profiling

  1. For a quick look without a session, react-profiler-renders lists how many instances of each component are mounted (not how often they re-render).
  2. Load the argent-react-native-profiler skill and follow its workflow (React and native profiling together) on the key user flows: the screens the user named, or all major flows. It covers analysis, drill-down, and re-profiling after each fix.
  3. Cross-reference the profiling results with the Phase 1–2 findings, and fix the highest-impact issues top-down. Re-profile after architectural changes; batch mechanical fixes.

Phase 4: Verify no regressions

Navigate every screen and UI flow within scope (the entire app if no scope was given, via argent-device-interact) and confirm each renders without errors. Check debugger-log-registry for warnings and errors (Grep its log file). Argent hides LogBox toasts once a debugger-* tool connects, so screenshots catch only full-screen red errors. Look for regressions the fixes introduced (e.g. fewer re-renders but higher CPU, or new jank on a different screen). Main agent only.

Version History

  • b965c94 Current 2026-11-07 15:13
  • 617db8d 2026-11-02 18:47

    将e2e测试相关技能从flow重命名为e2e,更新技能引用以匹配新的命名规范。

  • f0e04a6 2026-10-19 02:09

    将工具描述、技能和规则中的破折号替换为标准标点符号,以统一文本风格。

  • b1abdec 2026-08-15 02:58
  • bc04c3b 2026-07-06 19:59

Same Skill Collection

packages/skills/skills/argent-android-emulator-setup/SKILL.md
packages/skills/skills/argent-create-e2e/SKILL.md
packages/skills/skills/argent-create-flow/SKILL.md
packages/skills/skills/argent-device-interact/SKILL.md
packages/skills/skills/argent-ios-device-interact/SKILL.md
packages/skills/skills/argent-ios-device-setup/SKILL.md
packages/skills/skills/argent-ios-simulator-setup/SKILL.md
packages/skills/skills/argent-lens/SKILL.md
packages/skills/skills/argent-metro-debugger/SKILL.md
packages/skills/skills/argent-native-profiler/SKILL.md
packages/skills/skills/argent-react-native-app-workflow/SKILL.md
packages/skills/skills/argent-react-native-profiler/SKILL.md
packages/skills/skills/argent-screen-recording/SKILL.md
packages/skills/skills/argent-screenshot-diff/SKILL.md
packages/skills/skills/argent-test-ui-flow/SKILL.md
packages/skills/skills/argent-tv-interact/SKILL.md
packages/skills/skills/argent-qa-e2e/SKILL.md
packages/skills/skills/argent-qa-flows/SKILL.md
packages/skills/skills/argent-settings-permissions/SKILL.md

Metadata

Files
0
Version
b965c94
Hash
6fc8c5ea
Indexed
2026-07-06 19:59

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-11-07 16:51
浙ICP备14020137号-1