nextjs-app-router-patterns
by wshobsonnextjs-app-router-patterns helps developers plan Next.js 14+ App Router architecture, including Server Components, streaming, caching, route handlers, and Server Actions for full-stack development and Pages Router migrations.
This skill scores 78/100, which makes it a solid directory listing: it gives agents a clearly triggerable scope and substantial practical guidance for Next.js 14+ App Router work, though users should expect reference-style patterns more than a tightly operational playbook.
- Strong triggerability from the frontmatter and "When to Use" section covering App Router builds, migration, streaming, routing patterns, caching, and Server Actions.
- Substantial workflow value: the document is long and structured, with concrete file conventions, rendering mode guidance, and code examples that reduce guesswork versus a generic prompt.
- Credible technical scope for real work, including Server Components, parallel/intercepting routes, data fetching, and modern Next.js architecture patterns.
- No install command, support files, or companion resources, so adoption depends entirely on reading and applying the markdown guidance.
- Evidence points to broad pattern coverage, but only modest explicit workflow/decision-rule signaling, so agents may still need judgment for project-specific implementation choices.
Overview of nextjs-app-router-patterns skill
nextjs-app-router-patterns is a focused skill for designing and implementing modern Next.js 14+ App Router applications with better architectural choices than a generic “build me a Next.js app” prompt usually produces. It is best for developers working on full-stack React products, migrations from Pages Router, or teams deciding where to place data fetching, caching, interactivity, and route logic.
What the nextjs-app-router-patterns skill helps you do
The real job-to-be-done is not just generating files. It helps you choose the right App Router pattern for a feature: Server vs Client Components, static vs dynamic rendering, streaming boundaries, nested layouts, route handlers, and Server Actions. That matters because most App Router mistakes come from putting logic in the wrong layer first.
Best fit users
This skill is most useful for:
- Full-stack developers building with Next.js App Router
- Teams migrating from legacy Pages Router code
- Developers adding streaming, parallel routes, or Server Actions
- AI-assisted coding users who want stronger architectural output, not only snippets
Main differentiators from ordinary Next.js prompts
The value of nextjs-app-router-patterns is pattern selection. It centers on:
- App Router file conventions and route structure
- Rendering mode decisions
- Server Component-first thinking
- Data fetching and caching tradeoffs
- Full-stack patterns that combine UI, server logic, and route handlers
What to know before you install
This is a guidance-heavy skill rather than a scaffold generator. There are no helper scripts or extra reference files in the skill folder, so the quality of the result depends on how clearly you describe your feature, data sources, auth needs, and performance constraints. If you need code generation with low ambiguity, give it concrete repository context.
How to Use nextjs-app-router-patterns skill
nextjs-app-router-patterns install context
Install it from the parent skill repository:
npx skills add https://github.com/wshobson/agents --skill nextjs-app-router-patterns
Use it when your request includes App Router architecture decisions, not just isolated UI work. It is especially relevant when the output must align with app/ conventions.
Read this file first
Start with:
plugins/frontend-mobile-development/skills/nextjs-app-router-patterns/SKILL.md
Because this skill only ships a single SKILL.md, you can review the whole source quickly. Read it before first use if you need to confirm supported patterns like streaming, parallel routes, route handlers, and Server Actions.
What input the skill needs to work well
For strong output, provide:
- Your Next.js version if known
- Whether this is a new build or a Pages Router migration
- Feature goal
- Data sources and where secrets live
- Auth/session model
- SEO or caching requirements
- Whether interaction must happen in the browser
- Expected route structure under
app/
A weak request asks for “a dashboard.” A strong request says what data loads on the server, what needs client interactivity, whether pages are public or authenticated, and what should stream first.
Turn a rough goal into a usable prompt
Use this structure:
- Feature: what you are building
- Routes: target paths and nested layouts
- Data: APIs, DB calls, revalidation needs
- Interactivity: forms, filters, optimistic UI, browser APIs
- Constraints: auth, latency, SEO, deployment target
- Desired output: architecture, file tree, and starter code
Example:
“Use the nextjs-app-router-patterns skill to design an authenticated app/dashboard area with nested layout, server-fetched analytics, a client-side date filter, a form using Server Actions, and route-level loading/error states. Recommend which parts should be Server Components vs Client Components, what files to create, and how to handle caching and revalidation.”
Strong prompts for full-stack development
The nextjs-app-router-patterns skill is strongest when you ask it to decide boundaries. Good requests include phrases like:
- “choose rendering mode per route”
- “separate server-only logic from client interactivity”
- “propose
app/file structure” - “explain caching and revalidation choices”
- “show where to use
loading.tsx,error.tsx, androute.ts”
That produces more useful output than asking for a single page component with no context.
Practical workflow for using the skill
A reliable workflow is:
- Ask for an architecture plan first.
- Review the proposed
app/structure and component boundaries. - Ask for implementation of one route segment at a time.
- Validate data fetching, cache behavior, and loading states.
- Only then expand to advanced patterns like parallel or intercepting routes.
This avoids one of the most common App Router failures: generating a large code dump with incorrect server/client boundaries.
Repository topics to focus on
When reading the source, prioritize these sections:
When to Use This SkillCore ConceptsRendering ModesFile Conventions
These are the parts that most directly affect whether the skill improves your result over a generic coding prompt.
What the skill covers especially well
Based on the source, nextjs-app-router-patterns usage is well suited to:
- Server Components and Client Component boundaries
- Static, dynamic, and streaming rendering choices
app/file conventions likelayout.tsx,page.tsx,loading.tsx,error.tsx,not-found.tsx, androute.ts- Full-stack patterns with Server Actions and route handlers
What it does not automatically solve
This skill does not replace:
- Your project-specific auth implementation
- Package-level setup for database, CMS, or state libraries
- Deployment-specific tuning
- End-to-end migration planning for a large existing codebase
If your repo already has strong conventions, ask the model to adapt the skill output to existing folders, lint rules, and data utilities.
Common usage mistakes
Avoid these mistakes when using nextjs-app-router-patterns:
- Asking for only code, with no route or data context
- Marking too many components as client-side by default
- Ignoring loading, error, and not-found states
- Mixing private server logic into client components
- Asking for “SSR” in Pages Router terms instead of describing App Router behavior
Best use cases for nextjs-app-router-patterns for Full-Stack Development
This skill is a strong fit when a feature spans UI, data access, and route behavior together, such as:
- Authenticated dashboards
- Content pages with mixed static and dynamic sections
- Forms handled with Server Actions
- Search or filtering interfaces with streamed server data
- Multi-pane or modal flows using advanced routing patterns
nextjs-app-router-patterns skill FAQ
Is nextjs-app-router-patterns good for beginners?
Yes, if you already know basic React and want help understanding App Router structure. It is less ideal if you need a full beginner tutorial from first principles, because the skill assumes you are ready to make architecture decisions.
When should I use this instead of a normal coding prompt?
Use the nextjs-app-router-patterns skill when the hard part is deciding where logic belongs. Generic prompts often produce working-looking code that violates App Router best practices. This skill is more useful when route structure, rendering mode, and server/client separation matter.
Is it only for new projects?
No. It also fits migrations from Pages Router, especially when you need to rethink data fetching and layouts instead of directly porting old pages/ patterns.
Does the skill help with Server Actions?
Yes. The source explicitly includes Server Actions as part of the intended use. You will get better results if you specify form behavior, validation needs, mutation side effects, and revalidation expectations.
Can I use it for API routes and backend logic?
Yes, within the App Router model. It can guide use of route.ts and server-side logic placement, but you should still provide your runtime, auth, and data-layer constraints.
When is nextjs-app-router-patterns a poor fit?
It is a weaker fit if:
- You are using Pages Router only
- Your task is purely visual styling
- You need library-specific setup not covered by the skill
- You want a production-ready scaffold without giving repository context
Does it cover advanced routing patterns?
Yes. The source indicates support for parallel and intercepting routes. Use those only when your UX genuinely needs them; otherwise they add complexity quickly.
How to Improve nextjs-app-router-patterns skill
Give architecture inputs, not just feature names
The biggest quality jump comes from supplying:
- Route paths
- Data ownership
- Mutation flows
- Cache freshness needs
- Client interactivity requirements
Without that, nextjs-app-router-patterns tends to stay high level because the core pattern choice is under-specified.
Ask for explicit boundary decisions
A high-value prompt asks the model to label each piece as:
- Server Component
- Client Component
- Server Action
- Route Handler
- Static or dynamic route
This reduces vague output and makes the result easier to review.
Request file-by-file output
Instead of “build the whole app,” ask for:
- proposed
app/tree - purpose of each file
- implementation in dependency order
That matches how App Router projects are actually built and reviewed.
Force the model to explain caching and rendering choices
One common failure mode is plausible code with weak cache behavior. Ask:
- why this route is static or dynamic
- whether to stream it
- what should revalidate and when
- what data can stay server-only
Those questions make the nextjs-app-router-patterns guide materially more useful.
Provide your existing repo conventions
If your app already has:
- shared UI folders
- data access helpers
- auth wrappers
- error boundaries
- typed API clients
say so. The skill is stronger when adapting to an existing codebase than when guessing your conventions.
Iterate after the first answer
A good refinement loop is:
- Get the architecture proposal.
- Challenge any server/client boundary you disagree with.
- Ask for missing
loading.tsx,error.tsx, andnot-found.tsxcoverage. - Request implementation for one segment.
- Review and extend.
This produces better output than asking for a single massive response.
Watch for these failure modes
Review the output for:
- unnecessary
'use client' - server secrets leaking into client code
- missing route-level states
- overuse of dynamic rendering
- App Router code written with Pages Router assumptions
These are the most likely reasons a first pass looks correct but becomes expensive to maintain.
Upgrade weak prompts into strong ones
Weak:
“Use nextjs-app-router-patterns to make a product page.”
Stronger:
“Use nextjs-app-router-patterns to design app/products/[slug]/page.tsx for SEO-friendly product detail pages with server-fetched data, static generation for top products, dynamic fallback for long-tail products, a client-side image gallery, loading.tsx, error.tsx, and a Server Action for wishlist toggling. Explain file placement and cache strategy.”
Improve outputs for team use
If the output will be shared with a team, ask the skill to include:
- architectural rationale
- tradeoffs considered
- file structure summary
- upgrade notes for future features
That turns a one-off answer into implementation guidance your team can review and extend.
