Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Gentleman-Programming/Gentleman-Skills --skill nextjs-15 -a claude-code
Open on GitHub

What 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 POST route handler in app/api/users/route.ts
  • Write a middleware.ts redirecting unauthenticated traffic from /dashboard

How to install nextjs-15

1Skills CLI (Vercel)

npx skills add Gentleman-Programming/Gentleman-Skills --skill nextjs-15 -a claude-code

2Manually: put the files in place

~/.claude/skills/nextjs-15/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/nextjs-15/

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

Similar skills

All skills for Frontend and UI →

From the same set20

The whole set →
jira-task Generates structured Jira tasks following Prowler's format. Handles bug reports, feature requests, and refactoring work with proper titles, acceptance criteria, and component-based splitting. CX Codex +1 217installs github-pr github-pr guides AI agents to format pull requests using Conventional Commits and GitHub CLI commands. CX Codex +1 205installs playwright Skill for writing E2E tests on Playwright using the Page Objects pattern. Guides you through exploring real UI with MCP tools first, then writing selectors and assertions based on actual page structure. CX Codex +1 194installs elixir-antipatterns elixir-antipatterns is a Claude Code skill that guides code reviews, Ecto query tuning, and Phoenix refactoring with a catalog of 8 anti-patterns. CX Codex +1 194installs electron Guides desktop app development in Electron with secure IPC patterns, typed channels, and clear separation between main and renderer processes. CX Codex +1 175installs skill-creator skill-creator builds new AI agent skills against the Agent Skills spec. Use it for recurring patterns, project rules, and workflows that need explicit steps. CX Codex +1 171installs django-drf django-drf is a Claude Code skill with patterns for Django REST APIs: ViewSets, serializers, filters, permissions, and tests. The patterns cover starting or extending an API. CX Codex +1 162installs angular-forms A skill for building Angular forms: covers Signal Forms (experimental, Angular 21+) and production-ready Reactive Forms. Activates when you work with form validation, state management, or form creation. CX Codex +1 150installs

Project sponsors

Companies that keep this analytics open