next-data-fetching

Next.js App Router data fetching decision tree focused on TTFB-first and honest UX. Use when adding or changing data fetching logic (RSC fetch, caching, SSG/ISR, streaming Suspense), when metadata or generateMetadata depends on remote data, when dealing with user-specific auth/session data, when implementing hybrid server prefetch plus client hydration (TanStack Query), or when reviewing TTFB/LCP regressions.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "next-data-fetching" with this command: npx skills add bartdbont/next-data-fetching/bartdbont-next-data-fetching-next-data-fetching

Next Data Fetching

Overview

Choose where and how to fetch data in Next.js (App Router) using a consistent decision tree. Optimize for good TTFB without lying UX: defer only what the page can be content-correct without.

Workflow (Decision Tree)

Ask these questions in order for each dataset you introduce (or change):

  1. Is the page content-correct without this data on first render?
  2. Does SEO/metadata depend on it (including generateMetadata)?
  3. Is it user-specific (auth/session/permissions)?
  4. Is it static or safe-to-cache for everyone (static/semi-static)?
  5. What is the expected request latency and payload size?
  6. Does the data need to remain interactive after load (filters, refetch, live updates)?

Use the answers to pick one of these patterns:

  • SSG / ISR for static or semi-static, non-user-specific, SEO-relevant data.
  • Blocking server fetch for fast and small requests where blocking TTFB is acceptable.
  • Server fetch + Suspense (streaming) when data is needed but slower, and the rest of the page can render content-correct without it.
  • Client-side fetch when data is not needed for first render, or when it is heavy/slow and can be deferred without making the page misleading.
  • Hybrid (server fetch + client hydrate) when initial server data is needed but the data stays interactive after load.

See references/decision-tree.md for the full tree (including latency/payload thresholds).

Rules Of Thumb

  • Treat Suspense as a UX choice, not a default performance trick; only stream what can load independently and does not make the page misleading.
  • If data is user-specific, exclude SSG and ISR.
  • If SEO/metadata depends on data, fetch on the server (and likely before render).
  • When in doubt, answer: can the page be content-correct without this data?

App Router Notes

  • cookies() / headers() make a route dynamic; avoid them in static/ISR pages.
  • Prefer parallel server fetching (start promises early; Promise.all for independent calls).
  • Minimize RSC-to-client serialization; pass only what client components actually need.

Resources

  • references/decision-tree.md - English version of the decision tree + thresholds (with Mermaid diagram)
  • references/patterns-app-router.md - Implementation templates for each choice (App Router)
  • references/examples.md - Worked examples based on the team wiki
  • references/review-checklist.md - Code review checklist (TTFB/LCP, caching, UX correctness)
  • assets/decision-tree-nl.png - Original diagram (Dutch)

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

openclaw-version-monitor

监控 OpenClaw GitHub 版本更新,获取最新版本发布说明,翻译成中文, 并推送到 Telegram 和 Feishu。用于:(1) 定时检查版本更新 (2) 推送版本更新通知 (3) 生成中文版发布说明

Archived SourceRecently Updated
Coding

ask-claude

Delegate a task to Claude Code CLI and immediately report the result back in chat. Supports persistent sessions with full context memory. Safe execution: no data exfiltration, no external calls, file operations confined to workspace. Use when the user asks to run Claude, delegate a coding task, continue a previous Claude session, or any task benefiting from Claude Code's tools (file editing, code analysis, bash, etc.).

Archived SourceRecently Updated
Coding

ai-dating

This skill enables dating and matchmaking workflows. Use it when a user asks to make friends, find a partner, run matchmaking, or provide dating preferences/profile updates. The skill should execute `dating-cli` commands to complete profile setup, task creation/update, match checking, contact reveal, and review.

Archived SourceRecently Updated