nextjs-patterns

nextjs-patterns is a skill for Claude Code, Codex from event4u-app/agent-config. It costs 37 tokens per session (2,529 once invoked), scanned A, original, MIT.

A coding guide for Next.js App Router applications, covering server-rendered and browser-side components, routes, data loading, caching, and streaming.

In plain words
What is it for?
It is for writing or editing Next.js App Router pages, layouts, API route handlers, server actions, middleware, and loading or error states.
Why use it?
It helps developers follow the framework's conventions and avoid mistakes at the boundary between server and browser code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for writing or editing Next.js App Router pages, layouts, API route handlers, server actions, middleware, and loading or error states.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/event4u-app/agent-config/nextjs-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add event4u-app/agent-config --skill nextjs-patterns
Clone the repo
git clone --depth 1 https://github.com/event4u-app/agent-config

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for nextjs-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/event4u-app/agent-config/nextjs-patterns/github.svg)](https://agentmods.dev/skills/event4u-app/agent-config/nextjs-patterns)
Your own site
<a href="https://agentmods.dev/skills/event4u-app/agent-config/nextjs-patterns"><img src="https://agentmods.dev/badge/skills/event4u-app/agent-config/nextjs-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for nextjs-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/event4u-app/agent-config/nextjs-patterns"><img src="https://agentmods.dev/badge/skills/event4u-app/agent-config/nextjs-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,529 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00037 $0.02529
Opus 5.5 $0.00015 $0.01012
Sonnet 5.5 $0.00007 $0.00506
Haiku 4.5 $0.00004 $0.00253

Measured 2mo ago against content hash 03b67ad5dc35, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

nextjs-patterns scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

`fetch(url, { next: { tags: ['posts'] } })` then `revalidateTag('posts')`.
src/skills/nextjs-patterns/SKILL.md · 213 lines

How it starts

The opening of the file, as written. The whole thing — 213 lines — stays where its author put it; the contents beside it link to each section on GitHub.

nextjs-patterns

Compatibility

  • Tested against: Next.js 14.x and 15.x (App Router), React 18+ / 19+.
  • Pages Router is out of scope. On a Pages-Router project (no app/), fall back to plain React skills; ask before introducing App Router.

When to use

Use this skill for Next.js-specific code generation and editing on the App Router:

  • Server Components (RSC) and Client Components ("use client")
  • Server Actions ("use server")
  • Route Handlers (app/api/**/route.ts)
  • Layouts, templates, loading / error / not-found boundaries
  • Data fetching with fetch + cache directives
  • revalidatePath / revalidateTag invalidation
  • Streaming and <Suspense> boundaries
  • Middleware (middleware.ts)
  • Metadata API (static + dynamic)
  • Route Groups, Parallel Routes, Intercepting Routes

When to use the analysis sibling

When the task is understanding how a Next.js app boots, where the server/client boundary lives, what is cached vs streamed, or why a hydration mismatch fires — defer to project-analysis-nextjs first, then return here for the edit.

Procedure: write Next.js code

  1. Confirm App Router — app/ directory exists; next.config.{js,ts,mjs} present.
  2. Confirm version — package.json major for next. 14.x vs 15.x differs in default caching (15.x is uncached by default for fetch) and in cookies() / headers() being async.
  3. Inspect routing layout — flat app/ vs grouped (app/(marketing)/, app/(app)/); identify shared layouts and parallel routes.
  4. Inspect data layer — Server Actions vs route handlers vs external API; ORM (Prisma, Drizzle) or fetch-based.
  5. Inspect styling — Tailwind, CSS Modules, or styled engine; respect the chosen stack, do not mix.
  6. Check test conventions — Vitest / Jest + RTL for components; Playwright for E2E; route-handler tests via node runtime.

Server vs Client boundary

  • Server Components are the default. Add "use client" only when a leaf component needs state, effects, browser APIs, or event handlers.
  • The "use client" boundary is viral upward at the import graph, but you can keep a Server Component rendered as a child of a Client Component by passing it as a prop / children — that pattern keeps server logic out of the client bundle.
  • Never put database access, secrets, or server-only modules inside a Client Component or a file imported by one. Use import "server-only" at the top of a server module to make leaks fail at build time.
  • Symmetric guard: import "client-only" for code that must never run on the server (e.g. browser-only SDKs).
  • Props passed from Server → Client must be serializable. No functions, no Dates with custom prototypes, no Map / Set — use plain JSON.

Read the full file on GitHub · 213 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 213 lines · 37 tokens per session scan A 03b67ad5dc35

Subscribe to this mod's changes

nextjs-patterns is a skill published in the GitHub repository event4u-app/agent-config (19 stars, last pushed yesterday), licensed MIT. It adds 37 tokens to every session and 2,529 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.

Related

nextjs-patterns compared with skills from other repositories

nextjs-patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
nextjs-patternsevent4u-app/agent-configSkill19yesterdayMITA37Claude Code, Codex
frontendcode-yeongyu/oh-my-openagentSkill71kyesterdaynoneA79Claude Code, Codex
cometchat-react-v7-corecometchat/cometchat-skillsSkill16222d agoMITA94Claude Code
shadcnPyModel/react-frontend-skillsSkill423d agoMITA16Claude Code, Codex
cometchat-react-v7-migrationcometchat/cometchat-skillsSkill16222d agoMITA160Claude Code
lov-video-chapter-designlovstudio/skillsSkill723d agoMITA51Claude Code
front-vitestlouisbrulenaudet/monorepo-templateSkill195d agoApache-2.0A100Claude Code, Codex