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 $0.00018 $0.01264
Sonnet 5 $0.00007 $0.00506
Haiku 4.5 $0.00004 $0.00253

Measured 8d ago against content hash 03b67ad5dc35, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, 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 8d 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 Routerapp/ directory exists; next.config.{js,ts,mjs} present.
  2. Confirm versionpackage.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. 8d 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 (10 stars, last pushed today), licensed MIT. It adds 37 tokens to every session and 2,529 once invoked, about $0.0002 per session on Opus 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

Other skills, from other repositories

21st-ui

Find, install, and generate UI with 21st.dev. Use when the user asks for a UI component (pricing table, hero, navbar, dashboard, form, etc.), wants design inspiration, needs a brand logo as an SVG component, or wants to generate new UI from a prompt.

21st-dev/magic-mcp · 63 tokens

vercel-react-native-skills

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

fcakyon/claude-codex-settings · 57 tokens

extract-source-sample

Given the path to a finished content-goose ad-run folder, extract everything that defines that ad — recipe shot list, VO script, characters, voices, world, atom-skills, master mp4 — and emit a source-sample.json in the exact shape the upload-ad-sample skill writes to the Goose Ads library. Also links every character…

gooseworks-ai/goose-skills · 160 tokens

vercel-react-best-practices

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance…

calesthio/OpenMontage · 67 tokens

vercel-composition-patterns

React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.

calesthio/OpenMontage · 58 tokens

frontend

Builds, styles, and polishes web UI and UX. Use for any frontend, page, component, styling, layout, animation, or visual-quality task, or when asked to make an interface look or feel a certain way.

code-yeongyu/oh-my-openagent · 49 tokens