nextjs-app-router-patterns
Comprehensive patterns for Next.js 14+ App Router, Server Components, and modern full-stack React development.
Works with
1
total installs
1
this week
33.1K
GitHub stars
0
upvotes
Install Skill
Run in your terminal
1
installs
1
this week
33.1K
stars
What it does
Covers rendering modes (Server Components, Client Components, static, dynamic, streaming), file conventions, and core architectural patterns with practical TypeScript examples
Includes eight key patterns: Server Components with data fetching, Client Components, Server Actions, parallel routes, intercepting routes for modals, streaming with Suspense, Route Handlers, and metadata
Installation Guide
How to use nextjs-app-router-patterns on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your machine
- ›Node.js 16+ with npm — verify with
node --version - ›Active project directory where you want to add
nextjs-app-router-patterns
Run the install command
Execute the skills CLI command in your project's root directory to begin installation:
Fetches nextjs-app-router-patterns from wshobson/agents and configures it for Cursor.
Select Cursor when prompted
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate nextjs-app-router-patterns. Access via /nextjs-app-router-patterns in your agent's command palette.
Security Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Documentation
Next.js App Router Patterns
Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.
When to Use This Skill
- Building new Next.js applications with App Router
- Migrating from Pages Router to App Router
- Implementing Server Components and streaming
- Setting up parallel and intercepting routes
- Optimizing data fetching and caching
- Building full-stack features with Server Actions
Core Concepts
1. Rendering Modes
| Mode | Where | When to Use |
|---|---|---|
| Server Components | Server only | Data fetching, heavy computation, secrets |
| Client Components | Browser | Interactivity, hooks, browser APIs |
| Static | Build time | Content that rarely changes |
| Dynamic | Request time | Personalized or real-time data |
| Streaming | Progressive | Large pages, slow data sources |
2. File Conventions
app/
├── layout.tsx # Shared UI wrapper
├── page.tsx # Route UI
├── loading.tsx # Loading UI (Suspense)
├── error.tsx # Error boundary
├── not-found.tsx # 404 UI
├── route.ts # API endpoint
├── template.tsx # Re-mounted layout
├── default.tsx # Parallel route fallback
└── opengraph-image.tsx # OG image generation
Quick Start
// app/layout.tsx
import { Inter } from 'next/font/google'
import { Providers } from './providers'
const inter = Inter({ subsets: ['latin'] })
export const metadata = {
title: { default: 'My App', template: '%s | My App' },
description: 'Built with Next.js App Router',
}
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en" suppressHydrationWarning>
<body className={inter.className}>
<Providers>{children}</Providers>
</body>
</html>
)
}
// app/page.tsx - Server Component by default
async function getProducts() {
const res = await fetch('https://api.example.com/products', {
next: { revalidate: 3600 }, // ISR: revalidate every hour
})
return res.json()
}
export default async function HomePage() {
const products = await getProducts()
return (
<main>
<h1>Products</h1>
<ProductGrid products={products} />
</main>
)
}
Patterns
Pattern 1: Server Components with Data Fetching
// app/products/page.tsx
import { Suspense } from 'react'
import { ProductList, ProductListSkeleton } from '@/components/products'
import { FilterSidebar } from '@/components/filters'
interface SearchParams {
category?: string
sort?: 'price' | 'name' | 'date'
page?: string
}
export default async function ProductsPage({
searchParams,
}: {
searchParams: Promise<SearchParams>
}) {
const params = await searchParams
return (
<div className="flex gap-8">
<FilterSidebar />
<Suspense
key={JSON.stringify(params)}
fallback={<ProductListSkeleton />}
>
<ProductList
category={params.category}
sort={params.sort}
page={Number(params.page) || 1}
/>
</Suspense>
</div>
)
}
// components/products/ProductList.tsx - Server Component
async function getProducts(filters: ProductFilters) {
const res = await fetch(
`${process.env.API_URL}/products?${new URLSearchParams(filters)}`,
{ next: { tags: ['products'] } }
)
if (!res.ok) throw new Error('Failed to fetch products')
return res.json()
}
export async function ProductList({ category, sort, page }: ProductFilters) {
const { products, totalPages } = await getProducts({ category, sort, page })
return (
<div>
<div className="grid grid-cols-3 gap-4">
{products.map((product) => (
<ProductCard key={product.id} product={product} />
))}
</div>
<Pagination currentPage={page} totalPages={totalPages} />
</div>
)
}
Pattern 2: Client Components with 'use client'
// components/products/AddToCartButton.tsx
'use client'
import { useState, useTransition } from 'react'
import { addToCart } from '@/app/actions/cart'
export function AddToCartButton({ productId }: { productId: string }) {
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Steps
- 1Install skill using provided installation command
- 2Test with simple use case relevant to your work
- 3Evaluate output quality and relevance
- 4Iterate on prompts to improve results
- 5Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Related Skills
nextjs-seo
35laguagu/claude-code-nextjs-skills
frontend-design
457anthropics/claude-code
premium-frontend-ui
178github/awesome-copilot
ui-animation
175mblode/agent-skills
high-end-visual-design
141leonxlnx/taste-skill
antigravity-design-expert
88sickn33/antigravity-awesome-skills
Reviews
- CChinedu Zhang★★★★★Dec 16, 2024
We added nextjs-app-router-patterns from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- CChaitanya Patil★★★★★Dec 12, 2024
nextjs-app-router-patterns fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- EEvelyn Kapoor★★★★★Dec 4, 2024
nextjs-app-router-patterns fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- HHarper Martinez★★★★★Dec 4, 2024
Keeps context tight: nextjs-app-router-patterns is the kind of skill you can hand to a new teammate without a long onboarding doc.
- AAmina Park★★★★★Nov 23, 2024
nextjs-app-router-patterns is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- HHarper Anderson★★★★★Nov 23, 2024
We added nextjs-app-router-patterns from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- AAma Diallo★★★★★Nov 7, 2024
Keeps context tight: nextjs-app-router-patterns is the kind of skill you can hand to a new teammate without a long onboarding doc.
- HHarper Jain★★★★★Nov 7, 2024
Solid pick for teams standardizing on skills: nextjs-app-router-patterns is focused, and the summary matches what you get after install.
- PPiyush G★★★★★Nov 3, 2024
nextjs-app-router-patterns is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- HHarper Iyer★★★★★Oct 26, 2024
nextjs-app-router-patterns is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
showing 1-10 of 51
Discussion
Comments — not star reviews- No comments yet — start the thread.