Communitygithub.com

ComeOnOliver/skillshub

SSG、SSR、ISR、流式渲染和部分预渲染(PPR)。在 Next.js 中选择渲染策略(SSG、SSR、ISR、PPR 或流式渲染)时使用。(触发条件:**/page.tsx, **/layout.tsx, generateStaticParams, dynamic, dynamicParams, PPR, streaming)

skillshub 是什么?

该技能是 Next.js 应用路由器(App Router)下渲染策略选择的权威指南,涵盖 SSG(静态站点生成)、SSR(服务端渲染)、ISR(增量静态再生成)、流式渲染(Streaming)和部分预渲染(PPR)。它帮助开发者根据数据新鲜度和扩展需求选择最佳渲染方式:默认使用 SSG,并在需要时通过 `generateStaticParams` 在构建时预渲染路由;SSR 通过 `cookies()`、`headers()` 或 `cache: 'no-store'` 触发,适合个性化或高新鲜度数据场景;ISR 利用 `revalidate` 或 `revalidateTag` 在构建后更新静态内容;流式渲染通过 `<Suspense>` 包裹慢速组件避免阻塞首屏加载;PPR 则需在 `next.config.js` 中开启 `ppr: true` 以合并静态外壳与动态区域。此外,技能还提供了反模式指导,如避免在 `page.tsx` 中根层级 `await`、不要为静态内容使用 SSR,以及在初始渲染中避免使用 `window` 相关值导致水合错误。支持 Edge Runtime 以实现低延迟全局分发。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/HoangNguyen0403/agent-skills-standard/nextjs-rendering

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

渲染策略(应用路由器)

优先级:P0(关键)

根据数据新鲜度和扩展需求选择渲染策略。请参阅策略矩阵。

实现指南

  • SSG(静态站点生成):应用路由器的默认策略。使用 generateStaticParams 在构建时预渲染路由。通过 fetch 配合 cache: 'force-cache' 触发。
  • SSR(服务端渲染):通过 cookies()、headers() 或 fetch 配合 cache: 'no-store' 触发。适用于个性化或高新鲜度数据场景。
  • ISR(增量静态再生成):在构建后更新静态内容。使用 revalidate(基于时间)或 revalidatePath / revalidateTag(按需触发)。
  • 流式渲染:使用 Suspense 包裹慢速异步组件,防止它们阻塞首屏加载。使用 loading.tsx 实现路由级别的骨架屏。
  • PPR(部分预渲染):在单个 HTTP 请求中组合静态外壳和动态区域。在 next.config.js 中启用 ppr: true。
  • 策略选择:根据 SEO(SSG/ISR)与 交互性(客户端)与 个性化(SSR)进行选择。利用 dynamicParams 控制未缓存路由的回退行为。
  • 水合:避免在初始渲染中使用仅浏览器端可用的值(如 window.innerWidth、Date.now())导致水合错误。请使用 mounted 的 useEffect 模式。
  • Edge 运行时:使用 runtime: 'edge' 实现低延迟的全局分布式执行,适用于不需要完整 Node.js API 的场景。

反模式

  • 不要在 page.tsx 中根层级 await:将慢速组件包裹在 <Suspense> 中以实现流式渲染。
  • 不要为静态内容使用 SSR:使用 SSG 或 ISR;SSR 仅用于真正动态的数据。
  • 不要在初始渲染中使用 typeof window:使用 useEffect 避免水合错误。

参考资料

Individual skills in this repo

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

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

相关技能