nextjs-app-router

nextjs-app-router is a skill for Claude Code from johnku2011/boilerplates-with-ai-skills. It costs 33 tokens per session (555 once invoked), scanned A, original, MIT.

A set of guidelines for building pages and API endpoints with the Next.js App Router, a way to organize Next.js applications around folders and routes. It explains when code should run on the server or in the browser.

In plain words
What is it for?
Use it when adding pages, shared layouts, route handlers, data fetching, or server-side form changes in a Next.js project.
Why use it?
It helps avoid server-and-browser compatibility errors, unnecessary client-side data loading, and missing loading or error states.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it when adding pages, shared layouts, route handlers, data fetching, or server-side form changes in a Next.js project.

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

Made for: Claude Code.

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/johnku2011/boilerplates-with-ai-skills/nextjs-app-router/github.svg)](https://agentmods.dev/skills/johnku2011/boilerplates-with-ai-skills/nextjs-app-router)
Your own site
<a href="https://agentmods.dev/skills/johnku2011/boilerplates-with-ai-skills/nextjs-app-router"><img src="https://agentmods.dev/badge/skills/johnku2011/boilerplates-with-ai-skills/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/johnku2011/boilerplates-with-ai-skills/nextjs-app-router"><img src="https://agentmods.dev/badge/skills/johnku2011/boilerplates-with-ai-skills/nextjs-app-router.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 555 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00033 $0.00555
Opus 5.5 $0.00013 $0.00222
Sonnet 5.5 $0.00007 $0.00111
Haiku 4.5 $0.00003 $0.00056

Measured 1mo ago against content hash 766cefae14cb, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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.

boilerplates/nextjs-app/skills/nextjs-app-router/SKILL.md · 63 lines

How it starts

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

Next.js App Router

Overview

Build features the App Router way: server components by default, client components only when needed, and colocated routes under app/.

Process

  1. Add a route by creating app/<segment>/page.tsx; add layout.tsx for shared UI and loading.tsx/error.tsx for states.
  2. Keep components as React Server Components unless they need state, effects, or browser APIs. Add "use client" only to those leaf components.
  3. Fetch data in server components with async/await; avoid client-side fetching for initial render when the server can do it.
  4. Put API endpoints in app/api/<name>/route.ts using the Web Request/ Response APIs.
  5. Verify with npm run build (catches server/client boundary and type errors).

Data Fetching

  • Prefer fetch in Server Components with Next.js caching options (cache, next.revalidate) documented in code comments when non-default.
  • Use loading.tsx for slow segments; avoid blocking the entire page.
  • Mutations: Server Actions or Route Handlers — validate input server-side.

Route Handlers

  • Export named HTTP functions (GET, POST, …) from route.ts.
  • Return Response.json() with correct status codes.
  • Never import client-only modules into route.ts.

Guidelines

  • Never import server-only modules (fs, secrets, DB clients) into client components.
  • Read secrets from environment variables on the server only; never expose them via NEXT_PUBLIC_* unless they are truly public.
  • Keep page.tsx thin; move logic into small, typed functions under src/ or colocated lib/.
  • Prefer next/link and next/image over raw anchors/images.
  • Colocate tests for pure helpers; run npm run build before claiming done.

Deployment

See the shared deploy-vercel skill when shipping to Vercel.

Anti-patterns

  • Marking entire pages "use client" to avoid thinking about server boundaries.
  • Fetching secrets or private APIs from the browser.
  • Giant page.tsx files mixing UI, data access, and validation.

Read the full file on GitHub · 63 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. 1mo ago First seen · 63 lines · 33 tokens per session scan A 766cefae14cb

Subscribe to this mod's changes

nextjs-app-router is a skill published in the GitHub repository johnku2011/boilerplates-with-ai-skills (239 stars, last pushed 2mo ago), licensed MIT. It adds 33 tokens to every session and 555 once invoked, about $0.0001 per session on Opus 5.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-30.

Related

Other skills, from other repositories

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens