Audit and fix accessibility issues across the portfolio to ensure WCAG 2.1 AA compliance.
中文简介正在准备中。当前显示原文说明。
Lighthouse audits, bundle analysis, image optimization, font loading, Core Web Vitals tracking, and performance monitoring setup.
中文简介正在准备中。当前显示原文说明。
安装前可以查看交给 AI 代理的指令内容。
| 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/image还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Audit and fix accessibility issues across the portfolio to ensure WCAG 2.1 AA compliance.
中文简介正在准备中。当前显示原文说明。
Creates a new blog post document in the Sanity studio. Use when the user wants to write a blog post, publish an article, or schedule a future post.
中文简介正在准备中。当前显示原文说明。
Creates a new certification document in the Sanity studio. Use when the user wants to add a credential, certificate, or professional accreditation to the Certifications collection.
中文简介正在准备中。当前显示原文说明。
Adds a new skill MD file to the studio's skills collection. Use when the user wants to author a new step-by-step recipe for the studio's in-app Skills tool or the .agents mirror.
中文简介正在准备中。当前显示原文说明。
Creates a new project document in the Sanity studio. Use when the user wants to add a new portfolio project, a case study, or a work sample to the Projects collection.
中文简介正在准备中。当前显示原文说明。
Creates a new experience document in the Sanity studio. Use when the user wants to add a job, role, internship, or work history entry to the Experience collection.
中文简介正在准备中。当前显示原文说明。