Agent SkillsAFK-surf/OpenBridge › react-component-performance

react-component-performance

GitHub

用于分析和优化React组件性能,解决慢渲染、重渲染风暴等问题。通过复现问题、定位触发源、隔离状态、稳定Props及减少计算开销,结合Profiler验证,提升UI响应速度。

.agents/skills/react-component-performance/SKILL.md AFK-surf/OpenBridge

Trigger Scenarios

分析React组件性能瓶颈 减少不必要的重渲染 优化列表渲染卡顿 加速UI更新

Install

npx skills add AFK-surf/OpenBridge --skill react-component-performance -g -y
More Options

Non-standard path

npx skills add https://github.com/AFK-surf/OpenBridge/tree/main/.agents/skills/react-component-performance -g -y

Use without installing

npx skills use AFK-surf/OpenBridge@react-component-performance

指定 Agent (Claude Code)

npx skills add AFK-surf/OpenBridge --skill react-component-performance -a claude-code -g -y

安装 repo 全部 skill

npx skills add AFK-surf/OpenBridge --all -g -y

预览 repo 内 skill

npx skills add AFK-surf/OpenBridge --list

SKILL.md

Frontmatter
{
    "name": "react-component-performance",
    "description": "Analyze and optimize React component performance issues (slow renders, re-render thrash, laggy lists, expensive computations). Use when asked to profile or improve a React component, reduce re-renders, or speed up UI updates in React apps."
}

React Component Performance

Overview

Identify render hotspots, isolate expensive updates, and apply targeted optimizations without changing UI behavior.

Workflow

  1. Reproduce or describe the slowdown.
  2. Identify what triggers re-renders (state updates, props churn, effects).
  3. Isolate fast-changing state from heavy subtrees.
  4. Stabilize props and handlers; memoize where it pays off.
  5. Reduce expensive work (computation, DOM size, list length).
  6. Validate with profiling; avoid speculative changes.

Checklist

  • Measure: use React DevTools Profiler or log renders; capture baseline.
  • Find churn: identify state updated on a timer, scroll, input, or animation.
  • Split: move ticking state into a child; keep heavy lists static.
  • Memoize: wrap leaf rows with memo only when props are stable.
  • Stabilize props: use useCallback/useMemo for handlers and derived values.
  • Avoid derived work in render: precompute, or compute inside memoized helpers.
  • Control list size: window/virtualize long lists; avoid rendering hidden items.
  • Keys: ensure stable keys; avoid index when order can change.
  • Effects: verify dependency arrays; avoid effects that re-run on every render.
  • Style/layout: watch for expensive layout thrash or large Markdown/diff renders.

Optimization Patterns

  • Isolate ticking state: move a timer/animation into a child component so the parent list does not re-render every tick.
  • Stabilize callbacks: prefer useCallback for handlers passed to memoized rows.
  • Split rows: extract list rows into memoized components with narrow props.
  • Defer heavy rendering: lazy-render or collapse expensive content until expanded.
  • Prefer derived data outside render: compute summaries with useMemo or helper functions when inputs are stable.

Example Reference

Load references/examples.md when the user wants a concrete refactor example.

Version History

  • a9ca905 Current 2026-07-24 11:34

Same Skill Collection

.agents/skills/app-store-changelog/SKILL.md
.agents/skills/bridge-agent-log-analyzer/SKILL.md
.agents/skills/gh-issue-fix-flow/SKILL.md
.agents/skills/github/SKILL.md
.agents/skills/swift-concurrency-expert/SKILL.md
.agents/skills/swift-testing-expert/SKILL.md
.agents/skills/swiftui-expert-skill/SKILL.md
.agents/skills/swiftui-performance-audit/SKILL.md
.agents/skills/swiftui-ui-patterns/SKILL.md
.agents/skills/swiftui-view-refactor/SKILL.md
macos/OpenBridge/Resources/SystemSkills.bundle/format-converter/SKILL.md
macos/OpenBridge/Resources/SystemSkills.bundle/github/SKILL.md
macos/OpenBridge/Resources/SystemSkills.bundle/linear/SKILL.md
macos/OpenBridge/Resources/SystemSkills.bundle/skill-manager/SKILL.md
macos/OpenBridge/Resources/SystemSkills.bundle/ui-designer/SKILL.md
.agents/skills/swift-concurrency/SKILL.md
macos/OpenBridge/Resources/SystemSkills.bundle/docs/SKILL.md
macos/OpenBridge/Resources/SystemSkills.bundle/pdfs/SKILL.md
macos/OpenBridge/Resources/SystemSkills.bundle/spreadsheets/SKILL.md

Metadata

Files
0
Version
a9ca905
Hash
b3ffe6f6
Indexed
2026-07-24 11:34

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-07 00:12
浙ICP备14020137号-1 $Гость$