Agent skill
react-performance-optimizer
Analyzes React/Next.js code for performance bottlenecks, focusing on waterfalls, bundle size, and rendering efficiency.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/react-best-practices-mdbabumiamssm-llms-universal-life-
Metadata
Additional technical details for this skill
- author
- Vercel Labs (Synthesized)
- version
- 1.0.0
SKILL.md
React Performance Optimization Skill
This skill assists in identifying and resolving common performance issues in React and Next.js applications. It applies rules from Vercel's engineering best practices.
When to Use This Skill
- When a user asks to "optimize" a React component or page.
- When a user mentions "slow loading", "waterfalls", or "large bundle size".
- When reviewing code for production readiness.
Core Capabilities
- Waterfall Detection: Identifies nested data fetching patterns that block rendering.
- Bundle Size Analysis: Suggests dynamic imports (
next/dynamic,React.lazy) for heavy components. - Render Optimization: Checks for unnecessary re-renders and suggests
useMemo,useCallback, or composition patterns. - Image Optimization: Verifies usage of
next/imageand proper sizing attributes. - Server Components: Recommends moving logic to Server Components (RSC) where appropriate to reduce client JS.
Workflow
- Analyze Imports: Check for heavy libraries (e.g., moment.js, lodash) that could be tree-shaken or replaced.
- Check Data Fetching:
- Look for
awaitinside loops or sequentialawaitcalls that could bePromise.all. - Identify Client Components fetching data that could be Server Components.
- Look for
- Inspect Rendering Logic:
- Look for expensive computations directly in the render body.
- Check for
useEffectusage that triggers cascading updates.
- Review References: Consult
references/performance_rules.mdfor specific patterns to avoid.
Example Usage
User: "Why is my dashboard loading so slowly?"
Agent:
- Read
src/app/dashboard/page.tsxand components. - Identify multiple sequential
await fetch(...)calls. - Suggest using
Promise.allor moving data fetching up to a layout/parent RSC. - Suggest wrapping the Chart component with
next/dynamic.
References
references/performance_rules.md: detailed explanation of the rules.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?