alamenai/terrae / .claude/skills/perf
perf
VerifiedAudit component performance and identify optimization opportunities with actionable fixes
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)
- Canvas performance (pixel ratio, size, getImageData, off-screen canvas)
- DOM manipulation (innerHTML, style injection)
- Memory leaks (event listeners, growing collections, stale closures)
Also check for:
- Component re-render cost (expensive computations in render path, large JSX trees)
- Duplicate utility functions across files (DRY violations that bloat bundle size)
Step 3: Report
Structure the report as:
## Performance Audit: [Component Name]
### Score: [X/10]
### Critical Issues
Issues that cause measurable performance degradation or memory leaks.
### Warnings
Patterns that could degrade performance under load or over time.
### Best Practices
Recommendations for following optimal patterns.
### Passed Checks
Checks that the component already handles correctly.
For each issue found, include:
- What: Description of the problem
- Where: File path and line number
- Impact: What happens if not fixed (memory leak, jank, unnecessary re-renders, etc.)
- Fix: Concrete code example showing the solution
Scoring Guide
- 10/10: No issues found, follows all best practices
- 8-9/10: Minor warnings only, no performance impact
- 6-7/10: Some warnings that could cause issues under load
- 4-5/10: Has performance issues that affect user experience
- 2-3/10: Critical issues causing memory leaks or severe jank
- 0-1/10: Fundamentally broken performance patterns
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |