Nextjs caching

From HoangNguyen0403/agent-skills-standard · View interactive version

Nextjs caching is an AI agent skill from the GitHub repository HoangNguyen0403/agent-skills-standard. Configure Next.js cache layers, invalidation, and cache-component APIs. Use when choosing `fetch` caching, `use cache`, tags, or stale-data debugging in Next.js.

How to use this skill

Skill file

Caching Architecture

**Priority: P1 (HIGH)**

Decision Map

Recipe

  1. Classify the read: static, periodically fresh, request-specific, or user-specific.
  2. Pick the narrowest cache: request memoization before persistent cache, tag invalidation before path-wide invalidation.
  3. Tag what mutates together: align tags with data ownership, not page names by habit.
  4. Keep personal data private: avoid broad route caching for request-specific state.
  5. Test stale paths: mutation -> invalidation -> refreshed UI.

Verify

| Layer | Where | Control |

| :---------------------- | :----- | :----------------------------- |

| Request Memoization | Server render | React cache() |

| Data Cache | Server | fetch, use cache, tags |

| Full Route Cache | Server | static rendering / revalidation |

| Router Cache | Client | router.refresh() |

Anti-Patterns

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.