Communitygithub.com

sakilanwar12/nextjs-typescript-skills

Use when optimizing Next.js performance — Image/Font optimization, bundle analysis, dynamic imports, ISR/PPR caching, and Core Web Vitals fixes.

What is nextjs-typescript-skills?

nextjs-typescript-skills is a Claude Code agent skill that use when optimizing Next.js performance — Image/Font optimization, bundle analysis, dynamic imports, ISR/PPR caching, and Core Web Vitals fixes.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/sakilanwar12/nextjs-typescript-skills/tree/HEAD/skills/nextjs-performance

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Next.js Performance

Rules

  1. Images: always next/image with explicit sizes, priority only for LCP hero. Fonts: next/font (no render-blocking Google <link>).
  2. Measure first: @next/bundle-analyzer, next build output, Lighthouse. Fix the biggest chunk first.
  3. dynamic(() => import(...), { ssr: false }) for heavy client-only widgets (charts, editors). Keep initial JS < 200KB gz where possible.
  4. Cache aggressively: static + revalidate (ISR) for semi-dynamic pages; loading.tsx/Suspense to stream slow parts instead of blocking TTFB.
  5. Avoid waterfalls: parallelize in RSC, memoize repeated fetch (auto-deduped per request), use unstable_cache for expensive computes.

Patterns

// next/image — sized, lazy by default
import Image from 'next/image';
<Image src="/hero.jpg" alt="Dashboard" width={1200} height={630} priority sizes="100vw" />
<Image src="/avatar.png" alt="User" width={64} height={64} sizes="64px" />

// next/font — self-hosted, zero CLS
import { Inter } from 'next/font/google';
const inter = Inter({ subsets: ['latin'], display: 'swap' });
export default function RootLayout({ children }: { children: React.ReactNode }) {
  return <html lang="en" className={inter.className}><body>{children}</body></html>;
}

// Heavy client widget — code-split
import dynamic from 'next/dynamic';
const Chart = dynamic(() => import('@/components/chart'), { ssr: false, loading: () => <p>Loading chart…</p> });

// ISR
export const revalidate = 60;
// next.config.js — analyzer
const withBundleAnalyzer = require('@next/bundle-analyzer')({ enabled: process.env.ANALYZE === 'true' });
module.exports = withBundleAnalyzer({});
// ANALYZE=true next build

Checklist

  • Hero image priority + sizes, others lazy?
  • next/font used, no external font links?
  • Heavy components dynamically imported?
  • Bundle analyzed, largest import justified?
  • ISR/revalidate set for cacheable pages?
  • LCP/CLS/INP checked in Lighthouse?

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

Related Skills