migrate-cra-to-vite

migrate-cra-to-vite is a skill for Claude Code, Codex from Phaedra-Solutions/cursor-rules. It costs 118 tokens per session (1,412 once invoked), scanned A, original, MIT.

A migration guide for moving a React single-page app from Create React App, an older build setup, to Vite, a newer development and build tool.

In plain words
What is it for?
Use it to convert the project configuration, update application code that depends on Create React App, and verify builds, tests, and key pages.
Why use it?
It replaces the deprecated Create React App setup while checking environment variables, HTML loading, imports, aliases, proxies, ports, tests, and deployment settings that can otherwise break.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to convert the project configuration, update application code that depends on Create React App, and verify builds, tests, and key pages.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/phaedra-solutions/cursor-rules/migrate-cra-to-vite
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Phaedra-Solutions/cursor-rules --skill migrate-cra-to-vite
Clone the repo
git clone --depth 1 https://github.com/Phaedra-Solutions/cursor-rules

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for migrate-cra-to-vite

README.md
[![agentmods](https://agentmods.dev/badge/skills/phaedra-solutions/cursor-rules/migrate-cra-to-vite/github.svg)](https://agentmods.dev/skills/phaedra-solutions/cursor-rules/migrate-cra-to-vite)
Your own site
<a href="https://agentmods.dev/skills/phaedra-solutions/cursor-rules/migrate-cra-to-vite"><img src="https://agentmods.dev/badge/skills/phaedra-solutions/cursor-rules/migrate-cra-to-vite/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for migrate-cra-to-vite

Your own site · 80×15
<a href="https://agentmods.dev/skills/phaedra-solutions/cursor-rules/migrate-cra-to-vite"><img src="https://agentmods.dev/badge/skills/phaedra-solutions/cursor-rules/migrate-cra-to-vite.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 118 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,412 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00118 $0.01412
Opus 5.5 $0.00047 $0.00565
Sonnet 5.5 $0.00024 $0.00282
Haiku 4.5 $0.00012 $0.00141

Measured 3d ago against content hash d83567273f46, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

migrate-cra-to-vite scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/migrate-cra-to-vite/SKILL.md · 75 lines

How it starts

The opening of the file, as written. The whole thing — 75 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Migrate Create React App → Vite

When to use

  • The project uses react-scripts (CRA, deprecated since 14 Feb 2025) and the user wants a supported build.
  • If the user wants a framework instead (Next.js, React Router framework mode), follow that framework's CRA guide; this skill covers a client-only SPA on Vite (see frontend/react-vite-spa).

Before you start

  • Read react-scripts, React, TypeScript, CRACO/react-app-rewired config, src/setupProxy.js, .env* files, public/index.html, Jest config in package.json, and how SVGs, CSS modules and images are imported.
  • Working tree clean; new branch (chore/vite); record the current build output size and a list of pages to smoke-test.
  • Ask the user:
    • whether to switch tests to Vitest now or keep Jest for this change;
    • the deployment base path (homepage in package.json) and the hosting setup;
    • whether network installs are approved (core/supply-chain cooldown applies).

Steps

  1. Baseline: npm test -- --watchAll=false, npm run build, and a smoke test of key pages.

  2. Install: npm install -D vite @vitejs/plugin-react (and vite-plugin-svgr if the app imports SVGs as React components, vite-tsconfig-paths if it uses baseUrl/paths). Remove react-scripts, CRACO or react-app-rewired after the build works.

  3. Config: add vite.config.ts:

    import { defineConfig } from 'vite'
    import react from '@vitejs/plugin-react'
    
    export default defineConfig({
      plugins: [react()],
      server: { port: 3000 },          // keep CRA's port if scripts or docs depend on it
      build: { outDir: 'build' },      // keep CRA's output folder if deploys expect it
    })
    

    Set base if the app is served from a sub-path (CRA's homepage).

  4. index.html: move public/index.html to the project root, remove %PUBLIC_URL% (use / paths), and add <script type="module" src="/src/index.tsx"></script> (the entry file). Assets in public/ keep working at /.

  5. Environment variables: rename REACT_APP_* to VITE_* in .env*, CI and hosting settings; replace process.env.REACT_APP_X with import.meta.env.VITE_X and process.env.NODE_ENV with import.meta.env.MODE/DEV/PROD. Add src/vite-env.d.ts (/// <reference types="vite/client" />). Everything prefixed VITE_ is public; keep secrets out.

  6. Imports: SVG components via vite-plugin-svgr (import Logo from './logo.svg?react'); files with JSX must use .jsx/.tsx extensions (rename .js files that contain JSX); replace require() calls with imports.

  7. Proxy: move setupProxy.js or the proxy field to server.proxy in vite.config.ts.

  8. Scripts: "dev": "vite", "build": "tsc -b && vite build" (or vite build), "preview": "vite preview"; update CI and Dockerfiles that call react-scripts.

  9. Tests: either move to Vitest (vitest, jsdom, @testing-library/jest-dom; test.environment = 'jsdom', setupFiles; replace jest.fn with vi.fn, jest.mock with vi.mock), or keep Jest with an explicit jest.config and Babel/ts-jest since react-scripts test is gone. See testing/unit-js.

  10. Lint: replace eslint-config-react-app with the project's flat ESLint config (eslint-plugin-react-hooks, typescript-eslint).

  11. Verify (next section); show the diff and results; commit only when asked (git-commit skill). Then use frontend/react-vite-spa.

Read the full file on GitHub · 75 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 75 lines · 118 tokens per session scan A d83567273f46

Subscribe to this mod's changes

migrate-cra-to-vite is a skill published in the GitHub repository Phaedra-Solutions/cursor-rules (4 stars, last pushed 2d ago), licensed MIT. It adds 118 tokens to every session and 1,412 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-01.