nextjs

Next.js React framework with SSR, App Router, and server components. Use for full-stack React.

7 stars

Best use case

nextjs is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Next.js React framework with SSR, App Router, and server components. Use for full-stack React.

Teams using nextjs should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/nextjs/SKILL.md --create-dirs "https://raw.githubusercontent.com/G1Joshi/Agent-Skills/main/skills/frameworks/nextjs/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/nextjs/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How nextjs Compares

Feature / AgentnextjsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Next.js React framework with SSR, App Router, and server components. Use for full-stack React.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Next.js

Next.js is the leading full-stack framework for React. Next.js 15 (2025) stabilizes the App Router and Server Actions, making it a robust platform for modern web apps.

## When to Use

- **Full-Stack React**: You need API routes, DB access, and UI in one codebase.
- **SEO Critical**: Server-Side Rendering (SSR) is first-class.
- **Vercel Ecosystem**: seamless deployment to Vercel's edge network.

## Quick Start (App Router)

```tsx
// app/page.tsx (Server Component by default)
import { db } from "@/lib/db";

export default async function Page() {
  const posts = await db.post.findMany(); // Direct DB access!

  return (
    <main>
      <h1>Blog</h1>
      {posts.map((post) => (
        <p key={post.id}>{post.title}</p>
      ))}
    </main>
  );
}
```

## Core Concepts

### App Router (`app/` dir)

File-system based routing where `page.tsx` is the UI, `layout.tsx` wraps children, and `loading.tsx` defines Suspense boundaries.

### Server Components (RSC)

Components in `app/` are Server Components by default. They can't use `useState` or `useEffect`. To add interactivity, add `'use client'` to the top of a file.

### Server Actions

Functions that run on the server, callable from the client (forms, buttons).

```tsx
// actions.ts
'use server'
export async function create(formData) {
  await db.post.create({ data: ... });
}
```

## Best Practices (2025)

**Do**:

- **Fetch in Server Components**: Fetch data directly in your content (async components). No `useEffect`.
- **Use `revalidatePath`**: Revalidate cache on-demand after mutations (Server Actions).
- **Partial Prerendering (PPR)**: (Experimental in '24, Stable in '25) Mix static shell with dynamic holes.

**Don't**:

- **Don't leak secrets**: Ensure `'use server'` files don't export sensitive data.
- **Don't `use client` everything**: Only put `'use client'` at the leaves of your tree (buttons, inputs). Keep high-level layouts as Server Components.

## References

- [Next.js Documentation](https://nextjs.org/docs)