nextjs-app-router

nextjs-app-router is a skill for Claude Code from VersoXBT/claude-initial-setup. It costs 95 tokens per session (1,811 once invoked), scanned A, original, MIT.

A guide to the Next.js App Router, the system for organizing pages, server-side code, API route handlers, middleware, loading states, and caching in modern Next.js applications.

In plain words
What is it for?
Use it when building or migrating a Next.js application with server components, route handlers, middleware, nested routes, or revalidation.
Why use it?
It helps developers choose where code runs and control routing, data loading, streaming, and cached content.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the claude-initial-setup plugin — 75 skills, 15 commands, 14 agents, 2 hooks shipped together

Good fit Use it when building or migrating a Next.js application with server components, route handlers, middleware, nested routes, or revalidation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/versoxbt/claude-initial-setup/nextjs-app-router
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 VersoXBT/claude-initial-setup --skill nextjs-app-router
Clone the repo
git clone --depth 1 https://github.com/VersoXBT/claude-initial-setup

Made for: Claude Code.

Or install claude-initial-setup, the plugin that ships this one along with the rest of its 75 skills, 15 commands, 14 agents, 2 hooks.

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-app-router

README.md
[![agentmods](https://agentmods.dev/badge/skills/versoxbt/claude-initial-setup/nextjs-app-router/github.svg)](https://agentmods.dev/skills/versoxbt/claude-initial-setup/nextjs-app-router)
Your own site
<a href="https://agentmods.dev/skills/versoxbt/claude-initial-setup/nextjs-app-router"><img src="https://agentmods.dev/badge/skills/versoxbt/claude-initial-setup/nextjs-app-router/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-app-router

Your own site · 80×15
<a href="https://agentmods.dev/skills/versoxbt/claude-initial-setup/nextjs-app-router"><img src="https://agentmods.dev/badge/skills/versoxbt/claude-initial-setup/nextjs-app-router.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 95 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,811 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.00095 $0.01811
Opus 5 $0.00048 $0.00905
Sonnet 5 $0.00019 $0.00362
Haiku 4.5 $0.00010 $0.00181

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

Security

Grade A, and why

nextjs-app-router 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 6d 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.

skills/react-nextjs/nextjs-app-router/SKILL.md · 245 lines

How it starts

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

Next.js App Router Patterns

Patterns for building applications with the Next.js App Router architecture.

When to Use

  • User is building or migrating to Next.js App Router
  • User asks about server vs client components
  • User needs route handlers, middleware, or API routes
  • User asks about parallel routes or intercepting routes
  • User needs streaming, Suspense, or loading states
  • User asks about Next.js caching or revalidation

Core Patterns

Server Components (Default)

All components in the App Router are server components by default. They run on the server, can access databases directly, and send zero JavaScript to the client.

// app/products/page.tsx -- Server Component (no "use client" directive)
import { db } from '@/lib/db'

interface Product {
  id: string
  name: string
  price: number
}

export default async function ProductsPage() {
  const products: Product[] = await db.query('SELECT * FROM products ORDER BY name')

  return (
    <main>
      <h1>Products</h1>
      <ul>
        {products.map((p) => (
          <li key={p.id}>
            {p.name} -- ${p.price}
          </li>
        ))}
      </ul>
    </main>
  )
}

Use "use client" only when the component needs interactivity (event handlers, hooks, browser APIs).

'use client'
// app/products/add-to-cart-button.tsx -- Client Component
import { useState } from 'react'

export function AddToCartButton({ productId }: { productId: string }) {
  const [isPending, setIsPending] = useState(false)

  const handleClick = async () => {
    setIsPending(true)
    await fetch('/api/cart', {
      method: 'POST',
      body: JSON.stringify({ productId }),
    })
    setIsPending(false)
  }

  return (
    <button onClick={handleClick} disabled={isPending}>
      {isPending ? 'Adding...' : 'Add to Cart'}
    </button>
  )
}

Route Handlers

Replace API routes from Pages Router. Define HTTP methods as named exports.

// app/api/users/route.ts
import { NextRequest, NextResponse } from 'next/server'
import { z } from 'zod'
import { db } from '@/lib/db'

const CreateUserSchema = z.object({
  name: z.string().min(1).max(100),
  email: z.string().email(),
})

export async function GET(request: NextRequest) {
  const { searchParams } = request.nextUrl
  const page = parseInt(searchParams.get('page') || '1', 10)
  const limit = parseInt(searchParams.get('limit') || '20', 10)

  const users = await db.user.findMany({
    skip: (page - 1) * limit,
    take: limit,
  })

  return NextResponse.json({ data: users, meta: { page, limit } })
}

export async function POST(request: NextRequest) {
  const body = await request.json()
  const parsed = CreateUserSchema.safeParse(body)

  if (!parsed.success) {
    return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 })
  }

  const user = await db.user.create({ data: parsed.data })
  return NextResponse.json({ data: user }, { status: 201 })
}

Read the full file on GitHub · 245 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. 6d ago First seen · 245 lines · 95 tokens per session scan A af21fd7dd547

Subscribe to this mod's changes

nextjs-app-router is a skill published in the GitHub repository VersoXBT/claude-initial-setup (4 stars, last pushed 4mo ago), licensed MIT. It adds 95 tokens to every session and 1,811 once invoked, about $0.0005 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-09-03.

Related

Other skills, from other repositories

dev-nextjs

Next.js development (App Router, Server Components, caching, streaming). Trigger when the user works with Next.js, modifies app/, pages/, next.config, or talks about RSC, Server Actions, Route Handlers, middleware.

christopherlouet/claude-base · 50 tokens

tanstack-start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 +…

jezweb/claude-skills · 115 tokens

software-frontend

Builds frontend applications across major web stacks. Use when implementing UI, fixing hydration or SSR issues, or setting up modern frontend architecture.

vasilyu1983/AI-Agents-public · 31 tokens

software-realtime

Designs real-time and collaborative systems. Use when building chat, live dashboards, collaborative editing, notifications, WebSockets, SSE, or CRDT workflows.

vasilyu1983/AI-Agents-public · 35 tokens

software-localisation

Implements production-grade i18n/l10n for React, Vue, Angular, and Next.js with ICU format and RTL support. Use when setting up or debugging localisation.

vasilyu1983/AI-Agents-public · 39 tokens

trpc

Skill "trpc" from claude-dev-suite/claude-dev-suite, covering trpc core knowledge, router definition, client usage (react), protected procedures and with next.js.

claude-dev-suite/claude-dev-suite · 132 tokens