
nextjs
Next.js development including App Router, Server Components, API routes, and deployment. Activate for Next.js apps, SSR, SSG, and React Server Components.
- Installs
- 50
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/thelobbi/claude --skill nextjs- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads nextjs automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Next.js Skill
Provides comprehensive Next.js development capabilities for modern web applications.
When to Use This Skill
Activate this skill when working with:
- Next.js App Router
- Server Components and Client Components
- API Routes and Server Actions
- Static Site Generation (SSG)
- Server-Side Rendering (SSR)
Project Structure (App Router)
``` app/ ├── layout.tsx # Root layout ├── page.tsx # Home page ├── loading.tsx # Loading UI ├── error.tsx # Error handling ├── not-found.tsx # 404 page ├── globals.css ├── agents/ │ ├── page.tsx # /agents │ ├── [id]/ │ │ ├── page.tsx # /agents/[id] │ │ └── edit/ │ │ └── page.tsx # /agents/[id]/edit │ └── new/ │ └── page.tsx # /agents/new ├── api/ │ └── agents/ │ ├── route.ts # /api/agents │ └── [id]/ │ └── route.ts # /api/agents/[id] └── (dashboard)/ # Route group ├── layout.tsx └── settings/ └── page.tsx ```
Server Components (Default)
```tsx // app/agents/page.tsx - Server Component async function AgentsPage() { // Direct database access (no API needed) const agents = await db.query('SELECT * FROM agents');
return ( <div> <h1>Agents</h1> <ul> {agents.map(agent => ( <li key={agent.id}>{agent.name}</li> ))} </ul> </div> ); }
export default AgentsPage; ```
Client Components
```tsx // components/AgentSelector.tsx 'use client';
import { useState } from 'react';
export function AgentSelector({ agents }: { agents: Agent[] }) { const [selected, setSelected] = useState<string | null>(null);
return ( <select value={selected || ''} onChange={(e) => setSelected(e.target.value)} > <option value="">Select an agent</option> {agents.map(agent => ( <option key={agent.id} value={agent.id}> {agent.name} </option> ))} </select> ); } ```
Data Fetching
Server Component Data Fetching
```tsx
// Automatic request deduplication
async function getAgent(id: string) {
const res = await fetch(${process.env.API_URL}/agents/${id}, {
cache: 'force-cache', // Default: cache forever
// cache: 'no-store', // Never cache
// next: { revalidate: 60 } // Revalidate every 60s
});
return res.json();
}
export default async function AgentPage({ params }: { params: { id: string } }) { const agent = await getAgent(params.id); return <AgentDetails agent={agent} />; } ```
Revalidation
```tsx // Time-based revalidation export const revalidate = 60; // Revalidate every 60 seconds
// On-demand revalidation import { revalidatePath, revalidateTag } from 'next/cache';
async function updateAgent(id: string, data: FormData) { 'use server'; await db.update('agents', id, data); revalidatePath('/agents'); revalidateTag('agents'); } ```
Server Actions
```tsx // app/agents/new/page.tsx import { redirect } from 'next/navigation';
async function createAgent(formData: FormData) { 'use server';
const name = formData.get('name') as string; const type = formData.get('type') as string;
await db.insert('agents', { name, type });
revalidatePath('/agents'); redirect('/agents'); }
export default function NewAgentPage() { return ( <form action={createAgent}> <input name="name" placeholder="Agent name" required /> <select name="type"> <option value="claude">Claude</option> <option value="gpt">GPT</option> </select> <button type="submit">Create Agent</button> </form> ); } ```
API Routes
```tsx // app/api/agents/route.ts import { NextRequest, NextResponse } from 'next/server';
export async function GET(request: NextRequest) { const searchParams = request.nextUrl.searchParams; const type = searchParams.get('type');
const agents = await db.query( 'SELECT * FROM agents WHERE type = $1', [type] );
return NextResponse.json(agents); }
export async function POST(request: NextRequest) { const body = await request.json();
const agent = await db.insert('agents', body);
return NextResponse.json(agent, { status: 201 }); }
// app/api/agents/[id]/route.ts export async function GET( request: NextRequest, { params }: { params: { id: string } } ) { const agent = await db.query('SELECT * FROM agents WHERE id = $1', [params.id]);
if (!agent) { return NextResponse.json({ error: 'Not found' }, { status: 404 }); }
return NextResponse.json(agent); } ```
Layouts and Loading States
```tsx // app/layout.tsx export default function RootLayout({ children, }: { children: React.ReactNode; }) { return ( <html lang="en"> <body> <nav>Navigation</nav> <main>{children}</main> <footer>Footer</footer> </body> </html> ); }
// app/agents/loading.tsx export default function Loading() { return <div className="spinner">Loading agents...</div>; }
// app/agents/error.tsx 'use client';
export default function Error({ error, reset, }: { error: Error; reset: () => void; }) { return ( <div> <h2>Something went wrong!</h2> <button onClick={() => reset()}>Try again</button> </div> ); } ```
Middleware
```tsx // middleware.ts import { NextResponse } from 'next/server'; import type { NextRequest } from 'next/server';
export function middleware(request: NextRequest) { // Authentication check const token = request.cookies.get('token');
if (!token && request.nextUrl.pathname.startsWith('/dashboard')) { return NextResponse.redirect(new URL('/login', request.url)); }
// Add headers const response = NextResponse.next(); response.headers.set('x-custom-header', 'value');
return response; }
export const config = { matcher: ['/dashboard/:path*', '/api/:path*'], }; ```
Environment Variables
```bash
.env.local
DATABASE_URL=postgresql://... API_URL=http://localhost:8000
Public (exposed to browser)
NEXT_PUBLIC_APP_URL=http://localhost:3000 ```
```tsx // Server-only const dbUrl = process.env.DATABASE_URL;
// Client-accessible const appUrl = process.env.NEXT_PUBLIC_APP_URL; ```
Build Commands
```bash
Development
npm run dev
Production build
npm run build npm start
Static export
npm run build
next.config.js: output: 'export'
```
FAQ
What does the nextjs skill do?
Next.js development including App Router, Server Components, API routes, and deployment. Activate for Next.js apps, SSR, SSG, and React Server Components.
How do I install nextjs?
Run npx skills add https://github.com/thelobbi/claude --skill nextjs in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/nextjs/ (personal) or .claude/skills/nextjs/ (project).
Which AI agents can use nextjs?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is nextjs safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains nextjs?
It is published by thelobbi in thelobbi/claude. It has 50 recorded installs.
More from thelobbi/claude
vision-multimodal
thelobbi/claude
Vision and multimodal capabilities for Claude including image analysis, PDF processing, and document understanding. Activate for image input, base64 encoding, multiple images, and visual analysis.
design-system
thelobbi/claude
Open the skill to read its SKILL.md instructions.
authentication
thelobbi/claude
Authentication and authorization including JWT, OAuth2, OIDC, sessions, RBAC, and security analysis. Activate for login, auth flows, security audits, threat modeling, access control, and identity management.
Popular frontend & design skills
setup-matt-pocock-skills
mattpocock/skills
Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
frontend-design
anthropics/skills
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
hyperframes-animation
heygen-com/hyperframes
All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.
prototype
mattpocock/skills
Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
hyperframes-core
heygen-com/hyperframes
The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.
vercel-react-best-practices
vercel-labs/agent-skills
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.