perf-audit
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-10-02
- Stars
- ★ 9
- Forks
- 1
03 SKILL.md 正文
/perf-audit — Next.js Performance Audit Skill
Trigger
User says: "perf-audit", "performance check", "bundle size", "slow page", "optimize", "lighthouse"
Purpose
Audit Next.js app performance: bundle size, rendering, images, and data fetching.
Steps
1. Bundle Analysis
# Build with analysis
ANALYZE=true npx turbo build --filter=APP_NAME
# Check build output sizes
find apps/APP/.next -name "*.js" -size +100k | head -20
# Check for large dependencies
npx turbo build --filter=APP_NAME 2>&1 | grep -E "First Load|Route"
- Flag any route chunk > 100KB
- Flag First Load JS > 200KB
- Look for duplicate dependencies across chunks
2. Image Optimization
# Find raw img tags (should use next/image)
grep -rn "<img " --include="*.tsx" --include="*.jsx" apps/APP/
# Find large static images
find apps/APP/public -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" | xargs ls -lhS | head -10
# Check for missing width/height on next/image
grep -rn "Image" --include="*.tsx" apps/APP/ | grep -v "width\|height"
- All images should use
next/image - Static images > 200KB should be optimized or use WebP
- Verify
priorityprop on above-fold hero images
3. Rendering Analysis
# Find client components that could be server components
grep -rn "'use client'" --include="*.tsx" apps/APP/ | head -20
# Check for unnecessary client-side data fetching
grep -rn "useEffect.*fetch\|useSWR\|useQuery" --include="*.tsx" apps/APP/
# Find components importing large client libraries
grep -rn "import.*from.*framer-motion\|import.*from.*moment\|import.*from.*lodash" --include="*.tsx" apps/APP/
- Flag
'use client'components that don't use hooks or browser APIs - Flag client-side fetching that could be server-side
- Flag large libraries (moment.js, lodash full import)
4. Data Fetching
# Find fetch calls without caching config
grep -rn "fetch(" --include="*.ts" --include="*.tsx" apps/APP/ | grep -v "cache\|revalidate\|next:" | head -20
# Check for N+1 query patterns
grep -rn "findMany\|findFirst" --include="*.ts" apps/APP/ | head -20
- Verify fetch calls have
cacheornext.revalidateconfig - Look for N+1 Prisma queries in loops
- Check for missing
Suspenseboundaries on async components
5. Third-party Scripts
grep -rn "script.*src\|Script.*src\|gtag\|analytics\|hotjar\|intercom" --include="*.tsx" apps/APP/ | head -15
- Third-party scripts should use
next/scriptwithstrategy="lazyOnload" - Analytics should not block rendering
Output
Produce a summary table: | Category | Finding | Severity | File | Fix | Rate overall: Good / Needs Work / Critical
Rules
- Do NOT modify files during audit — report only
- Focus on the app the user specifies (marketing, web, or admin)
- If no app specified, audit all three and compare
04 同仓库更多 Skills
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
writing-plans
Use when you have a spec or requirements for a multi-step task, before touching code
docs:write-concisely
Apply writing rules to any documentation that humans will read. Makes your writing clearer, stronger, and more professional.
kaizen:why
Iterative Five Whys root cause analysis drilling from symptoms to fundamentals
verification-loop
A comprehensive verification system for Claude Code sessions.
verification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always