Token导航 LogoToken导航

Agent Skill · 研究检索

cra-to-next-migration(CRA TO Next.js 迁移)

cra-to-next-migration 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

cra-to-next-migration 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 15,804。

总安装 7,589周安装 307GitHub Stars 11下载 2,382核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cra-to-next-migration(CRA TO Next.js 迁移)
来源仓库:https://github.com/vercel-labs/migration-skills
仓库路径:skills/cra-to-next-migration
安装命令:
npx skills add https://github.com/vercel-labs/migration-skills --skill cra-to-next-migration
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/vercel-labs/migration-skills --skill cra-to-next-migration

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

cra-to-next-migration 提供 Create React App 到 Next.js 的完整迁移指南,含路由、数据获取和组件转换规则。适用于将 CRA 应用升级至 Next.js、采用文件路由或切换 SSR/SSG 渲染模式。

包含 148 条规则,覆盖 17 个类别,按影响优先级排序,确保迁移后行为一致。使用前应备份原项目,确认迁移范围与构建链兼容性,避免破坏现有功能。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/cra-to-next-migration

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/vercel-labs/migration-skills --skill cra-to-ne…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

cra-to-next-migration 怎么安装?

在终端执行 npx skills add https://github.com/vercel-labs/migration-skills --skill cra-to-next-migrati…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

cra-to-next-migration 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

cra-to-next-migration 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

cra-to-next-migration 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

cra-to-next-migration 用的人多吗?

公开数据是累计安装 7,589 次,近一周安装 307 次,下载 2,382 次,GitHub 11 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

cra-to-next-migration 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
cra-to-next-migration

CRA TO Next.js 迁移 · 本页

7,58911接触敏感数据未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

CRA to Next.js Migration Guide

Comprehensive migration guide for converting Create React App projects to Next.js, covering routing, data fetching, components, styling, and deployment. Contains 148 rules across 17 categories, prioritized by migration impact. After a successful migration the application should work the same as it did before the migration.

When to Apply

Reference these guidelines when:

  • Migrating an existing CRA application to Next.js
  • Converting React Router routes to file-based routing
  • Adopting Server Components in a client-heavy app
  • Moving from client-side rendering to SSR/SSG
  • Updating environment variables for Next.js
  • Optimizing images and fonts with Next.js built-ins

Version Policy

Use Next.js 16.x or later. Do NOT use Next.js 14.x or 15.x.

Before starting migration, check the current latest version:

npm info next version

Use the latest version in your package.json with a caret for minor/patch updates. The minimum supported version for this migration guide is ^16.0.0.

Rule Categories by Priority

PriorityCategoryImpactPrefixRules
1Project SetupCRITICALsetup-6
2DependenciesCRITICALdeps-1
3RoutingCRITICALrouting-17
4Data FetchingCRITICALdata-11
5ComponentsHIGHcomponents-9
6Environment VariablesHIGHenv-6
7StylingHIGHstyling-12
8Public AssetsMEDIUMassets-5
9ImagesMEDIUMimages-8
10FontsMEDIUMfonts-6
11SEO & MetadataMEDIUMseo-9
12API RoutesMEDIUMapi-9
13State ManagementMEDIUMstate-8
14IntegrationsMEDIUMintegrations-1
15TestingLOWtesting-9
16Build & DeployLOWbuild-7
17Common GotchasHIGHgotchas-24

Quick Reference

1. Project Setup (CRITICAL)

  • setup-initial-structure - Convert CRA folder structure to Next.js App Router
  • setup-package-json - Update dependencies and scripts
  • setup-next-config - Create and configure next.config.js
  • setup-typescript - Migrate TypeScript configuration
  • setup-eslint - Update ESLint for Next.js
  • setup-gitignore - Update.gitignore for Next.js

2. Dependencies (CRITICAL)

  • deps-react19-compatibility - Upgrade dependencies for React 19 compatibility

3. Routing (CRITICAL)

  • routing-basic-pages - Convert components to file-based routes
  • routing-dynamic-routes - Use [param] syntax for dynamic segments
  • routing-catch-all-routes - Use [...slug] for catch-all routes
  • routing-optional-catch-all - Use [[...slug]] for optional catch-all
  • routing-route-groups - Use (group) folders for organization
  • routing-parallel-routes - Use @slot for parallel routes
  • routing-intercepting-routes - Use (..) for intercepting routes
  • routing-link-component - Replace react-router Link with next/link
  • routing-programmatic-navigation - Replace useNavigate with useRouter
  • routing-use-params - Replace useParams with Next.js params
  • routing-use-search-params - Replace useSearchParams properly
  • routing-nested-layouts - Convert nested routes to layouts
  • routing-loading-states - Add loading.tsx for suspense
  • routing-error-boundaries - Add error.tsx for error handling
  • routing-not-found - Add not-found.tsx for 404 pages
  • routing-hash-based - Handle hash-based routing for client-only apps
  • routing-protected-routes - Implement protected route patterns

4. Data Fetching (CRITICAL)

  • data-useeffect-to-rsc - Convert useEffect fetches to Server Components
  • data-useeffect-to-ssr - Convert useEffect to getServerSideProps
  • data-useeffect-to-ssg - Convert useEffect to getStaticProps
  • data-client-fetch - Keep client fetches with proper patterns
  • data-server-actions - Use Server Actions for mutations
  • data-revalidation - Configure data revalidation strategies
  • data-streaming - Use Suspense for streaming data
  • data-parallel-fetching - Fetch data in parallel on server
  • data-sequential-fetching - Handle sequential data dependencies
  • data-caching - Configure fetch caching behavior
  • data-client-library-init - Initialize client-only libraries in useEffect

5. Components (HIGH)

  • components-use-client - Add 'use client' directive for client components
  • components-server-default - Understand server components are default
  • components-boundary-placement - Place client boundaries strategically
  • components-composition - Use composition to minimize client JS
  • components-interleaving - Interleave server and client components
  • components-props-serialization - Ensure props are serializable
  • components-children-pattern - Pass server components as children
  • components-context-providers - Handle Context providers properly
  • components-third-party - Wrap third-party client components

6. Environment Variables (HIGH)

  • env-prefix-change - Change REACT*APP* to NEXT*PUBLIC*
  • env-server-only - Use non-prefixed vars for server-only
  • env-runtime-config - Use runtime configuration when needed
  • env-local-files - Understand.env file loading order
  • env-build-time - Understand build-time vs runtime env vars
  • env-validation - Validate required environment variables

7. Styling (HIGH)

  • styling-global-css - Move global CSS to app/layout.tsx
  • styling-css-modules - CSS Modules work with minor changes
  • styling-sass - Configure Sass support
  • styling-tailwind - Configure Tailwind CSS
  • styling-css-in-js - Handle CSS-in-JS libraries
  • styling-styled-components - Configure styled-components for SSR
  • styling-emotion - Configure Emotion for SSR
  • styling-component-styles - Import component styles properly
  • styling-postcss - Configure PostCSS
  • styling-scss-global-syntax - Use:global only in CSS Modules
  • styling-css-import-order - Control CSS import order in layouts
  • styling-dark-mode-hydration - Handle dark mode without hydration mismatch

8. Public Assets (MEDIUM)

  • assets-public-folder - Public folder works the same way
  • assets-static-imports - Use static imports for assets
  • assets-absolute-urls - Reference assets without public prefix
  • assets-favicon - Place favicon in app directory
  • assets-manifest - Configure web app manifest

9. Images (MEDIUM)

  • images-next-image - Replace img with next/image
  • images-required-dimensions - Provide width and height
  • images-fill-prop - Use fill for responsive images
  • images-priority - Use priority for LCP images
  • images-placeholder - Configure blur placeholders
  • images-remote-patterns - Configure remote image domains
  • images-loader - Configure custom image loaders
  • images-optimization - Understand automatic optimization

10. Fonts (MEDIUM)

  • fonts-next-font - Use next/font for optimization
  • fonts-google-fonts - Load Google Fonts properly
  • fonts-local-fonts - Load local font files
  • fonts-variable-fonts - Configure variable fonts
  • fonts-font-display - Configure font-display strategy
  • fonts-preload - Understand automatic font preloading

11. SEO & Metadata (MEDIUM)

  • seo-metadata-api - Use Metadata API instead of react-helmet
  • seo-dynamic-metadata - Generate dynamic metadata
  • seo-opengraph - Configure Open Graph metadata
  • seo-twitter-cards - Configure Twitter Card metadata
  • seo-json-ld - Add structured data (JSON-LD)
  • seo-canonical - Set canonical URLs
  • seo-robots - Configure robots meta tags
  • seo-sitemap - Generate sitemap.xml
  • seo-head-component - Migrate from next/head to Metadata

12. API Routes (MEDIUM)

  • api-route-handlers - Create Route Handlers in app/api
  • api-http-methods - Export named functions for HTTP methods
  • api-request-body - Parse request body properly
  • api-query-params - Access query parameters
  • api-headers-cookies - Access headers and cookies
  • api-response-types - Return proper response types
  • api-middleware - Implement middleware patterns
  • api-cors - Configure CORS properly
  • api-rate-limiting - Implement rate limiting

13. State Management (MEDIUM)

  • state-context-client - Context requires 'use client'
  • state-zustand - Zustand works with hydration care
  • state-redux - Configure Redux with Next.js
  • state-jotai - Configure Jotai properly
  • state-recoil - Configure Recoil properly
  • state-url-state - Use URL for shareable state
  • state-server-state - Minimize client state with RSC
  • state-persistence - Handle state persistence

14. Integrations (MEDIUM)

  • integrations-sentry - Migrate Sentry error monitoring

15. Testing (LOW)

  • testing-jest-config - Update Jest configuration
  • testing-react-testing-library - RTL works the same
  • testing-server-components - Test Server Components
  • testing-client-components - Test Client Components
  • testing-async-components - Test async components
  • testing-mocking - Mock Next.js modules
  • testing-e2e-cypress - Configure Cypress for Next.js
  • testing-e2e-playwright - Configure Playwright for Next.js
  • testing-api-routes - Test API Route Handlers

16. Build & Deployment (LOW)

  • build-scripts - Update build scripts
  • build-output - Understand build output
  • build-standalone - Configure standalone output
  • build-static-export - Configure static export
  • build-bundle-analysis - Analyze bundle size
  • build-vercel - Deploy to Vercel
  • build-docker - Configure Docker deployment

17. Common Gotchas (HIGH)

  • gotchas-window-undefined - Handle window/document in SSR
  • gotchas-hydration-mismatch - Fix hydration mismatches
  • gotchas-use-effect-timing - Understand useEffect in Next.js
  • gotchas-router-ready - Check router.isReady for query params
  • gotchas-dynamic-imports - Use next/dynamic properly
  • gotchas-api-routes-edge - Edge vs Node.js runtime
  • gotchas-middleware - Middleware runs on edge
  • gotchas-static-generation - Static vs dynamic rendering
  • gotchas-redirect - Handle redirects properly
  • gotchas-headers - Set response headers
  • gotchas-cookies - Handle cookies in RSC
  • gotchas-turbopack - Handle Turbopack compatibility issues
  • gotchas-empty-modules - Fix empty module exports for isolatedModules
  • gotchas-nullish-coalescing - Fix nullish coalescing runtime errors
  • gotchas-react19-class-components - Fix React 19 class component this binding
  • gotchas-react19-ref-prop - Handle React 19 ref prop changes
  • gotchas-websocket-optional-deps - Handle WebSocket native dependency bundling
  • gotchas-auth-race-conditions - Guard against auth/API race conditions
  • gotchas-auth-state-gating - Wait for auth state before checking roles
  • gotchas-configuration-idempotency - Ensure configuration idempotency with useRef
  • gotchas-hydration-nested-interactive - Avoid nested interactive elements
  • gotchas-router-push-timing - Never call router.push during render
  • gotchas-infinite-rerender - Prevent infinite re-render loops
  • gotchas-provider-hierarchy - Configure provider hierarchy correctly

Pre-Migration Checklist

Before starting migration, scan the codebase for patterns that need special handling:

# Check for WebSocket libraries (needs webpack fallback config)
grep -E "(socket\.io|\"ws\")" package.json

# Check for SCSS :export syntax (may need --webpack flag)
grep -r ":export" --include="*.scss" src/

# Check for SVG ReactComponent imports (needs SVGR config)
grep -r "ReactComponent" --include="*.ts" --include="*.tsx" src/

# List all REACT_APP_ environment variables
grep -roh "REACT_APP_[A-Z_]*" --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" src/ | sort -u

# Check for Redux extraReducers using object notation (must convert to builder pattern for RTK v2)
grep -r "extraReducers:" --include="*.js" --include="*.jsx" --include="*.ts" --include="*.tsx" src/

# Check for /app/ paths that need updating if using (app) route group
grep -rE "(href|to|push|replace|redirect).*['\"]\/app\/" --include="*.js" --include="*.jsx" --include="*.ts" --include="*.tsx" src/

Scan Results to Rule Mapping:

Scan ResultRules to Read
socket.io or ws in package.jsongotchas-websocket-optional-deps, setup-next-config
:export in SCSS filesgotchas-turbopack
ReactComponent SVG importsassets-static-imports
REACT_APP_ variables foundenv-prefix-change
extraReducers: foundstate-redux (RTK v2 builder callback required)
/app/ paths in navigationrouting-route-groups (update paths for route groups)

How to Use

Read individual rule files for detailed explanations and code examples:

rules/setup-initial-structure.md
rules/routing-basic-pages.md
rules/data-useeffect-to-rsc.md

Each rule file contains:

  • Brief explanation of the migration step
  • CRA "before" code example
  • Next.js "after" code example
  • Additional context and gotchas

Migration Order

For best results, migrate in this order:

  1. Setup - Initialize Next.js project structure
  2. Routing - Convert React Router to file-based routing
  3. Environment Variables - Update env var prefixes
  4. Components - Add 'use client' directives where needed
  5. Data Fetching - Convert useEffect to server patterns
  6. Styling - Move global CSS, configure CSS-in-JS
  7. Images & Fonts - Adopt Next.js optimizations
  8. SEO - Migrate to Metadata API
  9. API Routes - Create Route Handlers
  10. Testing - Update test configuration

Post-Migration Verification Checklist

After migration, verify the application works correctly:

Core Functionality:

  • npm run dev starts Next.js dev server without errors
  • npm run build completes successfully
  • npm start runs the production build
  • Main application renders correctly
  • All routes are accessible

Client-Side Features:

  • localStorage/sessionStorage persistence works
  • Dark mode or theme toggles work and persist
  • Client-side interactivity (forms, buttons, modals) works
  • Browser back/forward navigation works correctly

Routing (if applicable):

  • Hash-based routing works (e.g., #room=abc,key=xyz)
  • Query parameters are read correctly
  • Dynamic routes render with correct params
  • 404 pages show for invalid routes

Real-Time Features (if applicable):

  • WebSocket connections establish successfully
  • Real-time collaboration or updates work
  • Reconnection after disconnect works

Integrations (if applicable):

  • Error monitoring (Sentry) captures errors
  • Analytics tracking fires correctly
  • Third-party auth (OAuth, Firebase) works
  • File uploads work

PWA (if applicable):

  • Service worker registers (production build)
  • App is installable
  • Offline functionality works as expected

Performance:

  • No hydration mismatch warnings in console
  • Images load and are optimized
  • Fonts load without FOUT/FOIT issues
  • No unexpected console errors or warnings

平台分布

Codex

39.95%
按下载量换算952

Claude

29.38%
按下载量换算700

Cursor

18.79%
按下载量换算448

Gemini CLI

8.97%
按下载量换算214

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills