nextjs-15 — Claude Code skill: what it does, how to install
Supplies Next.js 15 App Router patterns covering file conventions, Server Actions, parallel data fetching, and middleware.
Apache-2.0 185 installs ★ 678 updated 2026-03-28
npx skills add Gentleman-Programming/Gentleman-Skills --skill nextjs-15 -a claude-codeWhat nextjs-15 does
The skill feeds Next.js 15 App Router standards into the agent's context. It reinforces proper app/ directory layouts: required layout.tsx files, route groups like (auth)/, private _components/ folders, and asynchronous Server Components by default.
It includes reference snippets for Server Actions paired with revalidatePath and redirect, parallel data fetching using Promise.all, and Suspense streaming. It also establishes patterns for Route Handlers using NextRequest and NextResponse, dynamic metadata generation, and root-level middleware.ts. For sensitive logic, it enforces the server-only package so builds fail immediately if server code gets pulled into client components.
What it helps with
- Structure routes and private folders inside the
app/directory - Implement Server Actions with cache revalidation and redirects
- Set up parallel data fetching with Suspense fallbacks
- Prevent client leaks of sensitive functions using
server-only
Example prompts for the agent
- Create a Server Action to submit user data and revalidate
/users - Scaffold a
POSTroute handler inapp/api/users/route.ts - Write a
middleware.tsredirecting unauthenticated traffic from/dashboard
How to install nextjs-15
1Skills CLI (Vercel)
npx skills add Gentleman-Programming/Gentleman-Skills --skill nextjs-15 -a claude-code2Manually: put the files in place
~/.claude/skills/nextjs-15/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/nextjs-15/
1Skills CLI (Vercel)
npx skills add Gentleman-Programming/Gentleman-Skills --skill nextjs-15 -a codex2Manually: put the files in place
.agents/skills/nextjs-15/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Gentleman-Programming/Gentleman-Skills --skill nextjs-15 -a cursor2Manually: put the files in place
.cursor/skills/nextjs-15/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Gentleman-Programming/Gentleman-Skills curated/nextjs-15/SKILL.md2Manually: put the files in place
.github/skills/nextjs-15/SKILL.md1Skills CLI (Vercel)
npx skills add Gentleman-Programming/Gentleman-Skills --skill nextjs-15 -a gemini-cli2Platform CLI
gemini skills install https://github.com/Gentleman-Programming/Gentleman-Skills --path curated/nextjs-15Manually: put the files in place
.devin/skills/nextjs-15/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Gentleman-Programming/Gentleman-Skills --skill nextjs-15 -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about nextjs-15
How do I install nextjs-15 in Claude Code?
Run npx skills add Gentleman-Programming/Gentleman-Skills --skill nextjs-15 -a claude-code in your terminal.
What does the nextjs-15 skill do?
It guides the agent on Next.js 15 conventions, including App Router file layouts, Server Actions, streaming, and Route Handlers.
Why does the skill use the server-only package?
Importing server-only triggers a build error whenever client components attempt to import server-side database queries or secrets.
Source text
SKILL.md · Apache-2.0
---
name: nextjs-15
description: >
Next.js 15 App Router patterns.
Trigger: When working with Next.js - routing, Server Actions, data fetching.
license: Apache-2.0
metadata:
author: gentleman-programming
version: "1.0"
---
## App Router File Conventions
```
app/
├── layout.tsx # Root layout (required)
├── page.tsx # Home page (/)
├── loading.tsx # Loading UI (Suspense)
├── error.tsx # Error boundary
├── not-found.tsx # 404 page
├── (auth)/ # Route group (no URL impact)
│ ├── login/page.tsx # /login
│ └── signup/page.tsx # /signup
├── api/
│ └── route.ts # API handler
└── _components/ # Private folder (not routed)
```
## Server Components (Default)
```typescript
// No directive needed - async by default
export default async function Page() {
const data = await db.query();
return <Component data={data} />;
}
```
## Server Actions
```typescript
// app/actions.ts
"use server";
import { revalidatePath } from "next/cache";
import { redirect } from "next/navigation";
export async function createUser(formData: FormData) {
const name = formData.get("name") as string;
await db.users.create({ data: { name } });
revalidatePath("/users");
redirect("/users");
}
// Usage
<form action={createUser}>
<input name="name" required />
<button type="submit">Create</button>
</form>
```
## Data Fetching
```typescript
// Parallel
async function Page() {
const [users, posts] = await Promise.all([
getUsers(),
getPosts(),
]);
return <Dashboard users={users} posts={posts} />;
}
// Streaming with Suspense
<Suspense fallback={<Loading />}>
<SlowComponent />
</Suspense>
```
## Route Handlers (API)
```typescript
// app/api/users/route.ts
import { NextRequest, NextResponse } from "next/server";
export async function GET(request: NextRequest) {
const users = await db.users.findMany();
return NextResponse.json(users);
}
export async function POST(request: NextRequest) {
const body = await request.json();
const user = await db.users.create({ data: body });
return NextResponse.json(user, { status: 201 });
}
```
## Middleware
```typescript
// middleware.ts (root level)
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
export function middleware(request: NextRequest) {
const token = request.cookies.get("token");
if (!token && request.nextUrl.pathname.startsWith("/dashboard")) {
return NextResponse.redirect(new URL("/login", request.url));
}
return NextResponse.next();
}
export const config = {
matcher: ["/dashboard/:path*"],
};
```
## Metadata
```typescript
// Static
export const metadata = {
title: "My App",
description: "Description",
};
// Dynamic
export async function generateMetadata({ params }) {
const product = await getProduct(params.id);
return { title: product.name };
}
```
## server-only Package
```typescript
import "server-only";
// This will error if imported in client component
export async function getSecretData() {
return db.secrets.findMany();
}
```
## Keywords
nextjs, next.js, app router, server components, server actions, streaming
© gentleman-programming · Apache-2.0 · Gentleman-Programming/Gentleman-Skills