migrate-to-app-router

Migrate Next.js Pages Router routes to the App Router with server components.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/PeterCowling/base-shop --skill migrate-to-app-router
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-to-app-router
Source: https://github.com/PeterCowling/base-shop/tree/main/.claude/skills/migrate-to-app-router
Command: npx skills add https://github.com/PeterCowling/base-shop --skill migrate-to-app-router

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams migrate Next.js Pages Router routes to the App Router, unifying routing patterns and improving data fetching discipline across the app.

Core Features & Use Cases

  • Guided migration: step-by-step conversion of routes from pages to app structure, including page.tsx, loading.tsx, and error.tsx.
  • Data fetching modernization: move data fetches into server components and adopt file-based routing conventions with layout and route-level components.
  • Auth and navigation updates: update guards and navigations to use next/navigation for client/server boundaries.
  • Use Case: retrofit a large Next.js application to App Router to enable server components and reduce client-side code.

Quick Start

Begin by creating apps/<app>/src/app/<route>/page.tsx (server component) and move relevant data fetching, then implement loading.tsx and error.tsx for UX resilience.

Frequently Asked Questions about migrate-to-app-router

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate Next.js Pages Router routes to the App Router?

To migrate Next.js Pages Router routes to the App Router, create an app directory structure with page.tsx for server components, then move data fetching logic server-side and update navigation using next/navigation.

How does data fetching work when migrating to Next.js App Router server components?

Data fetching in the Next.js App Router defaults to server components, allowing you to move fetches directly into page.tsx files. This reduces client-side code and modernizes data fetching discipline across the application.

What is the best way to handle loading and error states during a Next.js App Router migration?

Handle loading and error states during a Next.js App Router migration by implementing dedicated loading.tsx and error.tsx files alongside your page.tsx, ensuring UX resilience and granular route-level fallbacks.

Do I need to update auth guards when migrating Next.js routes to the App Router?

Yes, you need to update auth guards when migrating Next.js routes to the App Router by adapting them to respect server and client boundaries, utilizing next/navigation for updated guard logic and route protection.

Can I retrofit a large Next.js application to use App Router without breaking existing routing patterns?

Yes, you can retrofit a large Next.js application using step-by-step conversion to move legacy pages to the app structure, unifying routing patterns while enforcing server components by default to reduce client-side code.

What are the limitations of migrating legacy Next.js routes to server components?

Limitations include strictly enforcing server components by default, which requires carefully managing client and server boundaries, updating metadata conventions, and restructuring route files to avoid breaking existing navigation.