Our review
This skill migrates Next.js components or pages from the Pages Router to the App Router following a defined architecture.
Strengths
- Automates conversion of page files and API routes
- Transforms server-side data methods (getServerSideProps, getStaticProps) into async server components
- Handles separation of server and client components
- Automatically creates loading.tsx and error.tsx files
Limitations
- Requires files to already be compliant with Next.js Pages Router
- Does not handle complex nested dynamic routing cases
- Requires manual execution of validation commands
When a Next.js project using the Pages Router needs to be migrated to the App Router.
For partial migrations or when the target architecture is not yet clearly defined.
Security analysis
SafeThe skill only performs code analysis, file editing, and runs standard build/lint/test commands (tsc, next build, vitest) for validation. No destructive, exfiltrating, or obfuscated actions are involved.
No concerns found
Examples
Migrate the file pages/products/[id].tsx to the App Router following the architecture documentation.Convert getServerSideProps in components/UserProfile.tsx to async server component pattern.I need to migrate my component MyComponent from Pages Router to App Router. The file is at src/components/MyComponent.tsx.name: migration-migrate-component description: "Use when a component needs migration to the target architecture or framework version." user-invocable: true argument-hint: "[component-file]" allowed-tools: Read, Write, Edit, Bash, Glob, Grep
Migrate a Pages Router component/page to App Router following docs/ARCHITECTURE.md sections 5 and 6.
Component: $ARGUMENTS
Steps
-
Read
docs/ARCHITECTURE.mdsections 5 and 6. -
Analyze the component/page:
- Count lines (JSX, logic)
- List: props, state, effects, data fetching methods
- Check for
getServerSideProps,getStaticProps,getStaticPaths - Check for
useRouterfromnext/router - Check for
Headcomponent usage - Map who imports this component
-
Convert routing:
pages/xxx.tsx->app/xxx/page.tsxpages/xxx/[id].tsx->app/xxx/[id]/page.tsxpages/api/xxx.ts->app/api/xxx/route.ts(or Server Action)
-
Convert data fetching:
getServerSideProps-> async Server Component (service + adapter)getStaticProps-> async Server Component + revalidategetStaticPaths->generateStaticParams()- Client-side
useEffect+ fetch -> React Query hook
-
Determine Server vs Client:
- Data fetching only? -> Server Component
- Has hooks, events, browser APIs? -> Client Component
- Mixed? -> Split into Server page + Client component
-
Convert imports:
useRouterfromnext/router->useRouter+usePathname+useSearchParamsfromnext/navigationHead->metadataexport orgenerateMetadata()
-
Create siblings:
loading.tsx-- skeleton matching page structureerror.tsx-- error boundary ('use client'required)
-
Type all props.
-
Decompose if > 200 lines.
-
Validate:
npx tsc --noEmit
npx next build
npx vitest run --passWithNoTests
Next.js App Router Expert
Development
A skill that turns Claude into a Next.js App Router expert.
README Generator
Development
Creates professional and comprehensive README.md files for your projects.
API Documentation Writer
Development
Generates comprehensive API documentation in OpenAPI/Swagger format.