一键导入
performance-auditing
Lighthouse audits, bundle analysis, image optimization, font loading, Core Web Vitals tracking, and performance monitoring setup.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Lighthouse audits, bundle analysis, image optimization, font loading, Core Web Vitals tracking, and performance monitoring setup.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | performance-auditing |
| description | Lighthouse audits, bundle analysis, image optimization, font loading, Core Web Vitals tracking, and performance monitoring setup. |
| Metric | Target | Measurement |
|---|---|---|
| LCP (Largest Contentful Paint) | < 2.5s | Chrome DevTools / Lighthouse |
| CLS (Cumulative Layout Shift) | < 0.1 | Chrome DevTools / Lighthouse |
| INP (Interaction to Next Paint) | < 200ms | Chrome DevTools / Lighthouse |
| FCP (First Contentful Paint) | < 1.8s | Lighthouse |
| TTFB (Time to First Byte) | < 800ms | Lighthouse |
| Total bundle size | < 250KB gzipped | npm run build output |
| Lighthouse Performance score | ≥ 95 | Lighthouse |
Run locally:
# Start the production build
npm run build && npm run start
# Run Lighthouse (requires Chrome)
npx lighthouse http://localhost:3000 --output html --view
Run against deployed site:
npx lighthouse https://namias.tech --output html --view
Interpret the report:
Check build output:
npm run build 2>&1 | grep -E "First Load|shared|Route"
Understanding the output:
Route (app) Size First Load JS
┌ ○ / 5.2 kB 89 kB
├ ○ /projects 3.1 kB 87 kB
└ λ /api/chat 0.1 kB 87 kB
+ First Load JS shared by 85 kB
○ = Static (prerendered)λ = Dynamic (server-rendered)Identify bloat:
Checklist:
next/image with width and heightsizes prop for responsive loadingpriority for above-the-fold content (hero, project covers)next.config.js)Current image config (next.config.js):
formats: ['image/webp', 'image/avif'],
deviceSizes: [320, 480, 640, 768, 1024, 1280, 1536],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384, 512, 640, 750, 828, 1080, 1200, 1920, 2048, 3840],
qualities: [75, 85],
Sanity image optimization:
The media gateway (/api/media/[...path]) handles Sanity image optimization:
/api/media/sanity/<image-id>?w=800&q=80&auto=format
Parameters: w (width), q (quality), auto=format (automatic format selection)
Current setup:
next/font with display: swapCheck font loading:
font200 status (not 304 from cache)display: swap prevents thisFont optimization tips:
font-display: swap (already configured)<link rel="preload" as="font">font-size-adjust for fallback font consistencyChecklist:
defer or asyncThird-party script audit:
# Check what scripts load
# DevTools → Network → filter by JS
# Look for external domains loading scripts
Current scripts: Umami analytics only (lightweight, self-hosted)
Checklist:
transition: all (Vercel guideline)transform and opacityCheck CSS size:
npm run build 2>&1 | grep -i css
Checklist:
useMemo on expensive computationsuseCallback on functions passed to child componentsReact.memo where beneficialkey props (not index)next/dynamic for heavy componentsCommon performance anti-patterns:
// BAD: creating new object/function on every render
<Component style={{ color: 'red' }} onClick={() => handleClick()} />
// GOOD: memoize
const style = useMemo(() => ({ color: 'red' }), []);
const handleClick = useCallback(() => doSomething(), []);
<Component style={style} onClick={handleClick} />
Checklist:
# 1. Build and check output
npm run build 2>&1 | grep -E "First Load|shared"
# 2. Start production server
npm run start
# 3. Run Lighthouse
npx lighthouse http://localhost:3000 --output html --view
# 4. Check bundle in DevTools
# DevTools → Network → Size column
# 5. Check for layout shift
# DevTools → Rendering → Layout Shift Regions
useEffect for data fetching instead of SWR with SSRpriority on above-the-fold imagesJSON.parse without error handling (blocks main thread)| Metric | Target | Warning threshold |
|---|---|---|
| LCP | < 2.5s | > 4.0s |
| CLS | < 0.1 | > 0.25 |
| INP | < 200ms | > 300ms |
| FCP | < 1.8s | > 3.0s |
| TTFB | < 800ms | > 1.5s |
| Total bundle | < 250KB gzipped | > 350KB |
| Lighthouse score | ≥ 95 | < 90 |
The portfolio uses Umami (cloud.umami.is) for analytics. To review performance trends:
If implementing performance alerts (e.g., via Umami custom events or Vercel Analytics):
web-vitals librarynext/imageMigrate from Next.js 15 to Next.js 16 and handle breaking changes
Configure Content Security Policy and security headers for the portfolio
Deploy Next.js to Cloudflare Workers using OpenNext adapter
Manage the canary token honeypot system for detecting security scanning
Write, debug, and optimize GROQ queries for Sanity CMS in this portfolio
Advanced TypeScript patterns and type safety as used in this portfolio