| name | perf-audit |
| description | Audit frontend performance for the EPUB reader and entity UI. Use when the reader is slow, entity drawer lags, or bundle size grows. |
| allowed-tools | Bash, Read, Grep, Glob |
Frontend Performance Audit
Quick Checks
Bundle Size
cd frontend && npm run build 2>&1 | tail -20
Type Check
cd frontend && time npx tsc --noEmit
Reader Performance Checklist
Files to Profile
EpubReader.tsx (286 lines, orchestrator)
useDescriptionHighlighting.ts (8 search strategies)
EntityDrawer.tsx, EntityList.tsx
chapterCache.ts (IndexedDB)
Bundle Targets
- Total JS: < 500KB gzipped
- epub.js: ~150KB (unavoidable)
- React + ReactDOM: ~45KB
- Vendor chunk: monitor for growth
Anti-Patterns to Check
- CSS-in-JS at runtime (use Tailwind 4)
- Missing React.lazy for non-critical routes
- Missing code splitting
- Overfetching with TanStack Query (check staleTime)