home / skills / harborgrid-justin / lexiflow-premium / advanced-memoization-strategies
/frontend/.github-skills/advanced-memoization-strategies
This skill helps optimize React rendering by applying principled memoization strategies to reduce re-renders while preserving correctness.
npx playbooks add skill harborgrid-justin/lexiflow-premium --skill advanced-memoization-strategiesReview the files below or copy the command above to add this skill to your agents.
---
name: advanced-memoization-strategies
description: Apply principled memoization techniques to reduce re-rendering without introducing correctness bugs.
---
# Advanced Memoization Strategies (React 18)
## Summary
Apply principled memoization techniques to reduce re-rendering without introducing correctness bugs.
## Key Capabilities
- Distinguish structural vs semantic memoization benefits.
- Detect memoization thrashing and unstable dependencies.
- Use fine-grained memoization with stable object identity.
## PhD-Level Challenges
- Construct a formal cost model for memoization trade-offs.
- Prove absence of stale closure bugs under refactoring.
- Quantify memoization impact using real workloads.
## Acceptance Criteria
- Provide before/after render counts for target components.
- Demonstrate stable dependency graphs for memoized hooks.
- Document memoization policy and its rationale.
This skill applies principled memoization techniques to reduce unnecessary re-rendering in React apps without introducing correctness bugs. It focuses on identifying where memoization yields semantic benefit versus where it only masks structural issues. The goal is measurable render reductions with verified stable dependency graphs and documented policies.
The skill inspects component render counts, hook dependency stability, and object identity patterns to find memoization opportunities. It flags unstable dependencies, memoization thrashing, and places where fine-grained memoization (useMemo/useCallback/React.memo) will help. Results include before/after render metrics, a dependency stability report, and a recommended memoization policy with rationales.
Will memoization change component behavior?
If applied correctly with stable dependencies and tests that assert behavior, memoization should not change observable behavior. The skill emphasizes proving absence of stale closures and documenting invariants.
How do I know memoization is worth it?
Measure render counts and CPU cost before and after. The skill requires before/after metrics and a cost model to justify memoization choices.