giuseppe-trisciuoglio/developer-kit/nextjs-app-router
- community
Checking that the SKILL.md file is still in the repository.
Provides patterns and code examples for building Next.js 16+ applications with App Router architecture. Use when creating projects with App Router, implementing Server Components and Client Components ("use client"), creating Server Actions for forms, building Route Handlers (route.ts), configuring caching with "use cache" directive (cacheLife, cacheTag), setting up parallel routes (`@slot`) or intercepting routes, migrating to proxy.ts, or working with App Router file conventions (layout.tsx, page.tsx, loading.tsx, error.tsx).
Install
npx vskill@latest install giuseppe-trisciuoglio/developer-kit/nextjs-app-routerSKILL.md
Next.js App Router (Next.js 16+)
Build modern React applications using Next.js 16+ with App Router architecture.
Overview
This skill provides patterns for Server Components (default) and Client Components ("use client"), Server Actions for mutations and form handling, Route Handlers for API endpoints, explicit caching with "use cache" directive, parallel and intercepting routes, and Next.js 16 async APIs and proxy.ts.
When to Use
Activate when user requests involve:
- "Create a Next.js 16 project", "Set up App Router"
- "Server Component", "Client Component", "use client"
- "Server Action", "form submission", "mutation"
- "Route Handler", "API endpoint", "route.ts"
- "use cache", "cacheLife", "cacheTag", "revalidation"
- "parallel routes", "
@slot", "intercepting routes" - "proxy.ts", "migrate from middleware.ts"
- "layout.tsx", "page.tsx", "loading.tsx", "error.tsx", "not-found.tsx"
- "generateMetadata", "next/image", "next/font"
Quick Reference
| File | Purpose | Directive | Purpose | |
|---|---|---|---|---|
page.tsx | Route page | "use server" | Server Action function | |
layout.tsx | Shared layout | "use client" | Client Component boundary | |
loading.tsx | Suspense loading | "use cache" | Explicit caching (Next.js 16) | |
error.tsx | Error boundary | |||
not-found.tsx | 404 page | |||
route.ts | API Route Handler | |||
proxy.ts | Routing boundary |
Instructions
Create New Project
Server Component
Server Components are the default in App Router. They run on the server and can use async/await.
Client Component
Add "use client" when using hooks, browser APIs, or event handlers.
Server Action
Define actions in separate files with "use server" directive.
Use with forms in Client Components:
See references/server-actions.md for Zod validation, optimistic updates, and advanced patterns.
Configure Caching
Use "use cache" directive for explicit caching (Next.js 16+).
See references/caching-strategies.md for cache profiles, on-demand revalidation, and advanced patterns.
Route Handler
Dynamic segments use [param]:
Next.js 16 Async APIs
All Next.js APIs are async in version 16.
Params and searchParams are also Promise-based:
See references/nextjs16-migration.md for migration guide and proxy.ts configuration.
Parallel Routes
Use @folder convention for parallel route slots.
See references/routing-patterns.md for intercepting routes, route groups, and dynamic routes.
Best Practices
Server vs Client Decision:
- Start with Server Component (default)
- Use Client Component only for: React hooks (useState, useEffect), browser APIs (window, document), event handlers (onClick, onSubmit), or client-only libraries
Data Fetching:
- Fetch in Server Components when possible
- Use React's
cache()for deduplication - Parallelize independent fetches
- Add Suspense boundaries with
loading.tsx
Performance Checklist:
- Use
loading.tsxfor Suspense boundaries - Use
next/imagefor optimized images - Use
next/fontfor font optimization - Add
error.tsxandnot-found.tsxfor error handling
Examples
Example 1: Blog Post Form with Server Action
Input: Create a form to submit blog posts with Zod validation
Output:
Example 2: Cached Product Page
Input: Create a cached product page with on-demand revalidation
Output:
Example 3: Dashboard with Parallel Routes
Input: Create a dashboard with sidebar and stats areas
Output:
Constraints and Warnings
Constraints:
- Server Components cannot use browser APIs or React hooks
- Client Components cannot be async (no direct data fetching)
cookies(),headers(),draftMode()are async in Next.js 16paramsandsearchParamsare Promise-based in Next.js 16- Server Actions must be defined with
"use server"directive
Warnings:
- Using
awaitin a Client Component causes a build error - Accessing
windowordocumentin Server Components throws an error - Forgetting to
awaitcookies() or headers() in Next.js 16 returns a Promise instead of the value - Server Actions without proper validation can expose the database to unauthorized access
- External Data Fetching: Server Components that
fetch()third-party URLs process untrusted content — always validate, sanitize, and type-check responses; use environment variables for API URLs rather than hardcoding them
References
- [references/app-router-fundamentals.md](references/app-router-fundamentals.md) — Server/Client Components, file conventions, navigation
- [references/routing-patterns.md](references/routing-patterns.md) — Parallel routes, intercepting routes, route groups
- [references/caching-strategies.md](references/caching-strategies.md) — "use cache", cacheLife, cacheTag, revalidation
- [references/server-actions.md](references/server-actions.md) — Server Actions, useActionState, validation, optimistic updates
- [references/nextjs16-migration.md](references/nextjs16-migration.md) — Async APIs, proxy.ts, Turbopack, config
- [references/data-fetching.md](references/data-fetching.md) — Data patterns, Suspense, streaming
- [references/metadata-api.md](references/metadata-api.md) — generateMetadata, OpenGraph, sitemap
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/developer-kit-typescript/skills/nextjs-app-router/SKILL.md
Popularity
- Repository stars
- 249
- Repository forks
- 27
- 7-day trend score
- 28
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 20 May 2026, 5 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/giuseppe-trisciuoglio/developer-kit/nextjs-app-router)