ankyr-performance

Enforces resource cleanup and render optimization rules for React and Three.js code.

1|Updated May 21, 2026
One-click install
npx skills add https://github.com/GuyErreich/AI_Agents --skill ankyr-performance-guyerreich
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ankyr-performance
Source: https://github.com/GuyErreich/AI_Agents/tree/main/plugins/ankyr/skills/ankyr-performance
Command: npx skills add https://github.com/GuyErreich/AI_Agents --skill ankyr-performance-guyerreich

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Memory leaks and unnecessary re-renders accumulate silently in frontend code when effects, listeners, timers, and GPU resources are not properly disposed. This Skill provides enforceable rules and reference patterns that prevent leaks and keep rendering efficient. ## Core Features & Use Cases - Resource Cleanup Rules: Mandates cleanup for AudioContext, Three.js geometries/materials/textures, event listeners, timers, and in-flight async work via AbortController. - Render Optimization Guidance: Covers targeted memoization (useCallback, useMemo, React.memo), throttling high-frequency listeners, and lazy-loading heavy route-local code. - Leak Audit Reference: Includes a risk-ranked audit table mapping common patterns (unclosed AudioContext, uncleared intervals) to their fixes. - Use Case: When adding a Three.js animation or a scroll listener to a React component, apply this Skill to ensure every allocated resource is disposed in the effect cleanup and renders are memoized only where profiling justifies it. ## Quick Start Review this component for memory leaks and render performance issues, and add cleanup for any listeners, timers, or Three.js resources it allocates.

Frequently Asked Questions about ankyr-performance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent memory leaks in React useEffect hooks?▼

Return a cleanup function from every effect that allocates a resource. Remove event listeners with removeEventListener, clear timers with clearInterval or clearTimeout, close AudioContext instances, and dispose Three.js geometries and materials in the cleanup.

How to clean up Three.js geometries and materials in React?▼

Call .dispose() on every geometry, material, and texture created inside the effect's scope within the cleanup function. Create expensive objects once via useMemo and reuse them rather than recreating per frame.

When should I use useMemo and useCallback in React?▼

Use useCallback when a handler is passed to a memoized child or appears in a dependency array, and useMemo for expensive derived values or values passed to memoized children. Avoid memoizing trivial values reflexively; profile first.

How do I cancel fetch requests when a React component unmounts?▼

Create an AbortController inside the effect, pass its signal to fetch, and call abort() in the cleanup function. Catch the resulting AbortError separately so intentional cancellations are not logged as errors.

Why does my scroll or resize listener cause performance problems?▼

Scroll, resize, and mousemove events can fire over 100 times per second, triggering excessive state updates. Throttle the callback with a timeout guard so the handler runs at most once per delay interval, and remove the listener in cleanup.