kensaurus/cursor-kenji/audit-performance
Claude Code and agent skill by kensaurus/cursor-kenji
- community
- ext:[{"type":"context","description":"Custom context provider definitions"}]
Checking that the SKILL.md file is still in the repository.
Audit and fix runtime performance (Core Web Vitals, load priority). Use when "slow page", "LCP/INP/CLS", "fetchpriority", "long tasks", or "bfcache". JS payload → audit-bundle-size. Instant nav → enhance-web-instant-nav. Load limits → test-load.
Install
npx vskill@latest install kensaurus/cursor-kenji/audit-performanceSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as kensaurus/cursor-kenji/audit-performance.
Performance Audit Skill
Degree of freedom: MIXED — what to optimize [HIGH freedom]; measure-first Sentry/vitals and EXPLAIN [LOW freedom — run exactly].
Audit-and-fix exception. Measure, then optimize. JS payload →audit-bundle-size. Instant navigations →enhance-web-instant-nav. Breaking point →test-load. Timeouts/retries →audit-resilience.When fixing: change only the measured bottleneck and re-measure it; log other slow paths you notice as follow-ups, not fixes. Edit the existing file in place rather than rewriting it. Add a perf test only where the repo already keeps them or the task asks; scratch measurements stay out of the repo.
This skill vs neighbors
| Skill | Owns | |
|---|---|---|
| audit-performance (this) | Audit and fix runtime performance: Core Web Vitals, load priority | |
audit-bundle-size | Analyse and shrink the JavaScript bundle: code splitting, initial load | |
enhance-web-instant-nav | Instant in-site navigation: Speculation Rules, View Transitions, bfcache, Early Hints | |
plan-perf-audit | Plan-only performance audit across web, mobile, backend, data; fixes nothing | |
test-load | k6 or Artillery load profile: throughput, latency percentiles, breaking point | |
audit-agent-speed | Measure and fix a slow coding-agent setup: hooks, status line, bloat | |
workflow-quality-gate | Pre-release gate across red-team, security, bundle, performance, unit tests |
How to reason
- Observe — quote LCP/INP/CLS, p95, or
EXPLAIN/ N+1 loop (file:line) - Interpret — is the user waiting on bytes, a query, or main-thread work?
- Classify — vital-miss / N+1 / missing-index / bundle / image / re-render
- Severity — poor LCP/INP or p95 >> target on a live path = Critical
Worked example
Observe: Sentry p95/users= 2.3s; handlerfindAllthen per-userOrder.findByUserId(app/api/users/route.ts:31).Interpret: N+1; TTFB/LCP suffer on that page.Classify: N+1.Severity: Critical (p95 far over 200ms).Finding:/users| N+1 | eager-load orders | then re-measure
Step 0: Gather Performance Data [LOW freedom — run exactly]
Before optimizing, measure. Collect data from multiple sources.
Production Data (Sentry)
If Sentry performance monitoring is enabled, fetch real production metrics:
Check for performance-related issues:
Research Current Benchmarks
Fetch current performance targets:
Field Data (source of truth) [LOW freedom — run exactly]
Lab (Lighthouse) is for diagnosis; field decides pass/fail.
- CrUX / PageSpeed Insights field tab for the origin and top 5 URLs by
traffic — record p75 LCP / INP / CLS (mobile first).
web-vitals/attributionin the app (not the base build): it names the
LCP element, the INP interaction target, and the CLS-shifting node.
- Lighthouse CI with a
budget.json(seereferences/loading-priority-2026.md
§Budgets). Fail the PR on regression, not on absolute score.
Record all three in the report's "Production Metrics" block before touching code.
Verification protocol [LOW freedom — run exactly]
Performance Targets
Core Web Vitals
| Metric | Good | Needs Work | Poor | |
|---|---|---|---|---|
| LCP (Largest Contentful Paint) | <2.5s | 2.5-4s | >4s | |
| INP (Interaction to Next Paint) | <200ms | 200-500ms | >500ms | |
| CLS (Cumulative Layout Shift) | <0.1 | 0.1-0.25 | >0.25 |
Other Key Metrics
- TTFB: <800ms field p75 (Google threshold); aim <200ms at the edge
- FCP: <1.8s
- Long tasks: none >50ms on the critical interaction path (INP driver)
- LCP resource load delay: <100ms (gap between TTFB and the LCP image request starting — usually "image not discoverable / not preloaded")
- bfcache: eligible on every content page (DevTools → Application → Back/forward cache)
Frontend Performance Audit [HIGH freedom]
Bundle Size Analysis
Checklist:
- [ ] Total bundle <200KB gzipped
- [ ] No single chunk >100KB gzipped
- [ ] Tree shaking working (no unused exports in bundle)
- [ ] Heavy libraries lazy-loaded (charts, editors, maps)
- [ ] No moment.js (use date-fns or dayjs)
- [ ] No lodash full import (use lodash-es or specific imports)
Code Splitting
- [ ] Route-based splitting (each page loads its own chunk)
- [ ] Component-level splitting for heavy components (
lazy()/dynamic()) - [ ] Below-fold content deferred
Image Optimization
- [ ] WebP/AVIF format used (not PNG/JPEG for photos)
- [ ] Images sized appropriately (not serving 4K to mobile)
- [ ]
loading="lazy"on below-fold images - [ ] Responsive
srcSetfor different screen sizes - [ ] Image CDN used (Cloudinary, imgix, Vercel Image Optimization)
Loading Priority & Speculation [HIGH freedom on which to apply, LOW freedom on the LCP rules]
Deep syntax: references/loading-priority-2026.md. Instant-nav implementation → enhance-web-instant-nav.
LCP element (find it first with `web-vitals/attribution` or DevTools → Performance → LCP)
- [ ] LCP image is not
loading="lazy"— lazy on the LCP image is an automatic Critical finding - [ ] LCP image has
fetchpriority="high"(Next.js:<Image priority />, which also injects the preload) - [ ] LCP image is discoverable from HTML — not a CSS
background-image, not injected by client JS, not behind a hydration boundary - [ ]
<link rel="preload" as="image" imagesrcset imagesizes>when the LCP image is responsive and not already preloaded by the framework - [ ] Non-critical images:
loading="lazy" decoding="async";<picture>AVIF → WebP → JPEG fallback
Fonts
- [ ]
font-display: swap(oroptionalfor non-brand text); fallback metrics set (size-adjust,ascent-override) so swap causes no CLS —next/fontdoes this automatically, verify it's actually used - [ ] Preload only the above-fold weight(s); subset to used unicode ranges; self-host
Early Hints (103)
- [ ] Origin/CDN sends
103 Early Hintswithpreconnectfor the image/font CDN andpreloadfor the LCP image + critical CSS. Verify:curl -sv https://site/ 2>&1 | grep -i "< HTTP/.* 103" - [ ] Node:
res.writeEarlyHints({ link: [...] }); otherwise configure at the CDN
Speculation Rules (next-navigation speed)
- [ ]
<script type="speculationrules">present withprefetchdocument rules atmoderateeagerness for in-site links - [ ]
prerenderonly for high-probability next pages (pagination, "next article", product detail); eagernessmoderate/conservative - [ ] Excluded from speculation: logout, cart/checkout, auth, anything with side effects on GET, URLs with
?unlessexpects_no_vary_searchis set - [ ] Server ignores side-effects when
Sec-Purpose: prefetch;prerenderis present; analytics/ads guarded bydocument.prerendering+prerenderingchange - [ ] Full implementation →
enhance-web-instant-nav
bfcache
- [ ] No
unloadlisteners (usepagehide); noCache-Control: no-storeon HTML; no open WebSocket / IndexedDB transaction atpagehide - [ ] Verified green in DevTools → Application → Back/forward cache → "Test back/forward cache"
Render strategy (Next.js 16 / React 19)
- [ ] Server Components by default;
'use client'only at interactive leaves - [ ] Slow data wrapped in
<Suspense>so the shell streams; static shell + dynamic holes (cacheComponents/'use cache') instead of blocking the whole route - [ ] React Compiler enabled (
reactCompiler: true) before any manualmemo/useMemo/useCallback— manual memo only where Profiler proves the Compiler missed it
INP (responsiveness)
- [ ] No task >50ms on tap/click/keypress paths; break work with
scheduler.yield()(fallbacksetTimeout(0)) orstartTransition - [ ] No synchronous layout reads (
offsetHeight,getBoundingClientRect) inside input handlers - [ ]
content-visibility: auto+contain-intrinsic-sizeon long off-screen sections - [ ] Third-party scripts:
async/defer, Next<Script strategy="lazyOnload">(or"worker"via Partytown where safe), consent-gated, facades for embeds (lite-youtube, static map image → iframe on click)
CLS
- [ ] Every
<img>,<video>,<iframe>, ad slot haswidth/heightoraspect-ratio - [ ] Late-arriving UI (banners, toasts, cookie bars) reserves space or overlays — never pushes content
React Performance (if applicable)
- [ ] React Compiler on; manual memo only with Profiler evidence (see Loading Priority & Speculation)
- [ ] No unnecessary re-renders (React DevTools Profiler)
- [ ] Long lists virtualized (react-window, @tanstack/react-virtual)
- [ ] No inline object/array creation in JSX props
- [ ] Context providers scoped narrowly (not wrapping entire app for local state)
CSS Performance
- [ ] No layout thrashing (reads before writes)
- [ ] Animations use
transform/opacity(GPU-accelerated) - [ ] No
@importchains (bundled instead) - [ ] Critical CSS inlined for above-fold content
- [ ] Fonts subset and preloaded (
<link rel="preload">)
Backend Performance Audit [HIGH freedom]
Database Queries
N+1 Detection:
Checklist:
- [ ] N+1 queries eliminated (eager loading, joins, batch loading)
- [ ] Indexes on frequently queried columns (WHERE, JOIN, ORDER BY)
- [ ] SELECT only needed columns (no
SELECT *) - [ ] Pagination on all list endpoints
- [ ] Connection pooling configured
- [ ] Slow query logging enabled
Index verification: [LOW freedom — run exactly]
API Response Optimization
- [ ] Response compression enabled (gzip/brotli)
- [ ] Appropriate cache headers (
Cache-Control,ETag) - [ ] No over-fetching (return only what the client needs)
- [ ] Pagination for list endpoints
- [ ] Response time <200ms for p95
Caching Strategy
| Layer | Tool | TTL | Use For | |
|---|---|---|---|---|
| Browser | Cache-Control headers | Varies | Static assets, API responses | |
| CDN | Vercel/CloudFront/Cloudflare | 1h-1d | Static pages, images | |
| API | Redis/Memcached | 5m-1h | Expensive queries, computed data | |
| ORM | Query cache | 1m-5m | Repeated identical queries |
Network Optimization
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/audit-performance/SKILL.md
Popularity
- Repository stars
- 9
- 7-day trend score
- 12
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
contextCustom context provider definitions
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kensaurus/cursor-kenji/audit-performance)