# UI Performance Guard

> Enforces Vercel-standard performance optimizations for React and Next.js applications. Use when this capability is needed.

- Skill: `tomevault-io/ui-performance-guard` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/ui-performance-guard`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/ui-performance-guard/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/ui-performance-guard

---


# UI Performance Guard

Enforces Vercel-standard performance optimizations for React and Next.js applications.

## Instructions

### 1. Eliminate Waterfalls (CRITICAL)
- Defer `await` until the data is actually needed in the render tree.
- Use `Promise.all()` for independent, concurrent data fetching.
- Implement `Suspense` boundaries to unblock the initial paint of the shell.

### 2. Bundle & Tree Shaking (CRITICAL)
- AVOID barrel file imports (`import { x } from "@/components"`); use direct paths to ensure proper tree-shaking.
- Use dynamic imports (`next/dynamic` or `React.lazy`) for heavy components or those below the fold.
- Audit third-party libraries; prefer native browser APIs over heavy dependencies where possible.

### 3. Render Optimization
- Extract expensive computational work into memoized components or `useMemo`.
- Use functional updates in `setState` (e.g., `setCount(c => c + 1)`) to avoid stale closure dependencies.
- Deduplicate global event listeners and timers using `useRef` for persistence across renders.

### 4. Asset Management
- Optimize SVG precision and minimize path data.
- Use `content-visibility: auto` for off-screen components in long lists.
- Hoist static JSX elements out of the render loop to prevent unnecessary re-allocations.

## Verification
- Run `npm run lint` and check for performance-related warnings.
- Verify that initial bundle size is within the project's performance budget.

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/infodungeon) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-11 -->

