nextjs-best-practices

nextjs-best-practices is a skill for Claude Code, Codex from Jignesh-Ponamwar/skills-mcp. It costs 77 tokens per session (2,261 once invoked), scanned A, original, Apache-2.0.

A set of practices for building Next.js applications with the App Router, the part of Next.js that organizes pages, layouts, data loading, and server-side code. It covers common project files, React Server Components, APIs, metadata, and error handling.

In plain words
What is it for?
Use it when writing, reviewing, or migrating full-stack React applications built with Next.js, including their pages, API endpoints, images, fonts, and deployment setup.
Why use it?
It helps avoid incorrect file structures, outdated asynchronous code, inefficient data loading, and missing handling for errors or unavailable pages.

Skill for Claude CodeCodex

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

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is COPY --from=base /app/.next/static ./.next/static.

Good fit Use it when writing, reviewing, or migrating full-stack React applications built with Next.js, including their pages, API endpoints, images, fonts, and deployment setup.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/Jignesh-Ponamwar/skills-mcp
agentmods
npx agentmods add skills/jignesh-ponamwar/skills-mcp/nextjs-best-practices

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-best-practices

README.md
[![agentmods](https://agentmods.dev/badge/skills/jignesh-ponamwar/skills-mcp/nextjs-best-practices/github.svg)](https://agentmods.dev/skills/jignesh-ponamwar/skills-mcp/nextjs-best-practices)
Your own site
<a href="https://agentmods.dev/skills/jignesh-ponamwar/skills-mcp/nextjs-best-practices"><img src="https://agentmods.dev/badge/skills/jignesh-ponamwar/skills-mcp/nextjs-best-practices/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-best-practices

Your own site · 80×15
<a href="https://agentmods.dev/skills/jignesh-ponamwar/skills-mcp/nextjs-best-practices"><img src="https://agentmods.dev/badge/skills/jignesh-ponamwar/skills-mcp/nextjs-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 77 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,261 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00077 $0.02261
Opus 5 $0.00039 $0.01130
Sonnet 5 $0.00015 $0.00452
Haiku 4.5 $0.00008 $0.00226

Measured 11d ago against content hash 78a5aff8eb04, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

nextjs-best-practices scanned grade A with 0 findings 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 11d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skill_mcp/skills_data/nextjs-best-practices/SKILL.md · 352 lines

How it starts

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

Next.js Best Practices Skill

Apply these rules when writing or reviewing Next.js code. Covers App Router (Next.js 13+).


1. File Conventions

Project Structure

app/
├── layout.tsx           # Root layout (required)
├── page.tsx             # Home page
├── loading.tsx          # Loading UI (Suspense boundary)
├── error.tsx            # Error boundary
├── not-found.tsx        # 404 page
├── global-error.tsx     # Root-level error boundary
├── (auth)/              # Route group (no URL segment)
│   ├── login/page.tsx
│   └── register/page.tsx
├── [id]/                # Dynamic segment
│   └── page.tsx
├── [...slug]/           # Catch-all segment
└── api/
    └── route.ts         # Route Handler

Special Files

File Purpose
layout.tsx Shared UI, persists across navigations
page.tsx Unique page UI, makes route publicly accessible
loading.tsx Auto-wraps page in <Suspense>
error.tsx Error boundary for segment (client component)
not-found.tsx Rendered when notFound() is thrown
route.ts API endpoint (no co-located page.tsx allowed)
middleware.ts Runs before request, at edge

2. React Server Components (RSC) Boundaries

Server Components (default) - do:

  • async/await data fetching directly in component
  • Access databases, file system, environment variables
  • Import server-only packages

Client Components ('use client') - required when:

  • Using useState, useEffect, useReducer, useContext
  • Using browser APIs (window, document, localStorage)
  • Using event handlers (onClick, onChange)
  • Using third-party client libraries

Rules

  • Never make a Client Component async - it's invalid
  • Never pass non-serializable props (functions, class instances) from Server → Client
  • Server Components can import Client Components, not the reverse
  • Use 'use server' only for Server Actions, not to mark Server Components

3. Async APIs - Next.js 15+

Read the full file on GitHub · 352 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. 11d ago First seen · 352 lines · 77 tokens per session scan A 78a5aff8eb04

Subscribe to this mod's changes

nextjs-best-practices is a skill published in the GitHub repository Jignesh-Ponamwar/skills-mcp (7 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 77 tokens to every session and 2,261 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

astro

Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

sickn33/agentic-awesome-skills · 28 tokens

antigravity-design-expert

Core UI/UX engineering skill for building highly interactive, spatial, weightless, and glassmorphism-based web interfaces using GSAP and 3D CSS.

sickn33/agentic-awesome-skills · 39 tokens

algolia-search

Expert patterns for Algolia search implementation, indexing strategies, React InstantSearch, and relevance tuning.

sickn33/agentic-awesome-skills · 22 tokens

nextjs-on-cloudflare

Build, migrate, and deploy Next.js apps on Cloudflare Workers with vinext. Use when starting a Next.js project on Cloudflare, moving an existing app to Workers, choosing between vinext and OpenNext, or setting up vinext for Workers. For setup, migration, or deployment, install vinext's upstream skills with npx skills…

cloudflare/skills · 96 tokens

frontend-mobile-development-component-scaffold

You are a React component architecture expert specializing in scaffolding production-ready, accessible, and performant components. Generate complete component implementations with TypeScript, tests, s.

rmyndharis/antigravity-skills · 38 tokens

frontend-developer

Build React components, implement responsive layouts, and handle client-side state management. Masters React 19, Next.js 15, and modern frontend architecture. Optimizes performance and ensures accessibility. Use PROACTIVELY when creating UI components or fixing frontend issues.

rmyndharis/antigravity-skills · 55 tokens