| name | perf |
| description | Audit component performance and identify optimization opportunities with actionable fixes |
| argument-hint | ["component-name"] |
| allowed-tools | Read, Grep, Glob, Bash(git diff*) |
Performance Audit Skill
Audit Terrae components for performance issues. Identifies problems, explains their impact, and provides actionable fixes.
If $ARGUMENTS is provided, audit only that component. Otherwise, audit all components in src/registry/map/.
Performance patterns and best practices are defined in .claude/rules/react/performance.md.
Instructions
Step 1: Identify Target
If a component name is provided, locate it in src/registry/map/. Otherwise, scan all component files.
Step 2: Run the Audit
For each component, read the full file and check every rule in .claude/rules/react/performance.md:
- Resource cleanup (RAF, timers, listeners, markers, layers, sources, images, observers, canvas)
- Recursive requestAnimationFrame polling
- Untracked timers in renderers
- Mapbox objects in state vs refs
- useEffect dependency arrays (oversized, unstable references, callbacks)
- Layer and source management (setPaintProperty vs remove/re-add, existence checks)
- GeoJSON data handling (recomputation, update frequency)