cra-to-next-migration
Comprehensive guide for migrating Create React App (CRA) projects to Next.js. Use when migrating a CRA app, converting React Router to file-based routing, or adopting Next.js patterns like Server Components, App Router, or image optimization.
What this skill does
# 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: ```bash 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 | Priority | Category | Impact | Prefix | Rules | | -------- | --------------------- | -------- | --------------- | ----- | | 1 | Project Setup | CRITICAL | `setup-` | 6 | | 2 | Dependencies | CRITICAL | `deps-` | 1 | | 3 | Routing | CRITICAL | `routing-` | 17 | | 4 | Data Fetching | CRITICAL | `data-` | 11 | | 5 | Components | HIGH | `components-` | 9 | | 6 | Environment Variables | HIGH | `env-` | 6 | | 7 | Styling | HIGH | `styling-` | 12 | | 8 | Public Assets | MEDIUM | `assets-` | 5 | | 9 | Images | MEDIUM | `images-` | 8 | | 10 | Fonts | MEDIUM | `fonts-` | 6 | | 11 | SEO & Metadata | MEDIUM | `seo-` | 9 | | 12 | API Routes | MEDIUM | `api-` | 9 | | 13 | State Management | MEDIUM | `state-` | 8 | | 14 | Integrations | MEDIUM | `integrations-` | 1 | | 15 | Testing | LOW | `testing-` | 9 | | 16 | Build & Deploy | LOW | `build-` | 7 | | 17 | Common Gotchas | HIGH | `gotchas-` | 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
Related in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.