bcmyguest/personal-skills/react-ts-setup
Claude Code and agent skill by bcmyguest/personal-skills
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Scaffold a new React + TypeScript frontend repo the right way with Vite — asks the key decisions up front (package manager, Node manager + version, UI framework + theme colours, CI provider, dev Docker), then wires Vite + React Compiler, ESLint (flat) + Prettier, Vitest + Testing Library, husky + lint-staged + pre-commit hooks, .vscode settings, env templates, a dev Dockerfile, CI pipelines, and a README — keeping the Node version in lockstep across every file and leaving lint/typecheck/test/bu…
Install
npx vskill@latest install bcmyguest/personal-skills/react-ts-setupSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as bcmyguest/personal-skills/react-ts-setup.
Setting up a React + TypeScript project
Scaffold every new React SPA with Vite (it owns dev server, build, and pairs natively with Vitest). Work top to bottom; confirm the decisions in step 0 before scaffolding, because they change dependencies, config, and which later steps apply.
The whole point of this skill is a repo where one `git clone` + install gets a contributor to green — lint, typecheck, test, and build all pass, the editor formats on save, and commits are guarded. The recurring failure mode is a Node version that drifts between .nvmrc, CI, and Docker; the steps below keep it in one place on purpose.
Versions move fast in this ecosystem. Don't hard-code dependency versions inpackage.jsonby hand and don't copy version numbers from this skill — letcreate-viteandpnpm addinstall the newest releases, and trust the lockfile.
Steps: (0) ask the decisions → (1) scaffold with Vite → (2) pin Node everywhere → (3) ESLint + Prettier → (4) React Compiler + strict TS → (5) Vitest + Testing Library → (6) UI framework + theme → (7) husky + lint-staged + pre-commit hooks → (8) .vscode settings → (9) env files → (10) .gitignore check → (11) dev Docker (if chosen) → (12) CI (if chosen) → (13) README → (14) verify lint/typecheck/test/build all green. Steps 6, 11, and 12 depend on the step-0 answers.
0. Ask the decisions up front
Don't assume — ask, then use the answers to decide which steps apply:
| Decision | Options | Default | |
|---|---|---|---|
| Package manager | pnpm · npm · bun | pnpm | |
| Node manager | nvm · mise · asdf · Volta | ask; all write a pinned version | |
| Node version | current Active LTS | 24 (2026); 22 if conservative | |
| UI framework | MUI · Tailwind · Chakra · Mantine · none | ask | |
| Theme colours | primary / secondary / error / background | ask for the basic set | |
| Test framework | Vitest | Vitest (fixed) | |
| CI provider | none · GitHub · GitLab · Bitbucket | ask | |
| Dev Docker image | yes · no | ask |
The canonical path below is pnpm + Vite + MUI. Package-manager and UI-framework substitutions are called out inline and in the reference files.
1. Scaffold with Vite
Package-manager variants: npm create vite@latest <app> -- --template react-ts · bun create vite <app> --template react-ts. The rest of this skill uses pnpm; swap the prefix (npm run / bun run) for the others.
Then record the toolchain in package.json so CI and contributors match:
2. Pin Node and keep every file in lockstep
The Node version is the thing most likely to drift. It appears in up to four places — make them agree, and prefer a single source of truth so they can't diverge:
- Node-manager file (the real pin) — one of, matching the user's choice:
- nvm:
.nvmrc→24 - mise / asdf:
.tool-versions→nodejs 24(mise also readsmise.toml) - Volta: a
voltablock inpackage.json - `engines.node` in
package.json— a floor (>=22), not the exact pin. - CI — read the pin instead of repeating it:
node-version-file: .nvmrc
(step 12). This is the trick that keeps CI from drifting.
- Dockerfile —
FROM node:24-alpine, the same major (step 11). The one place
that can't auto-read the pin, so bump it deliberately when you bump .nvmrc.
Commit the node-manager file. Default to the current Active LTS (Node 24 in 2026; 22 is the conservative choice and engines covers both).
3. ESLint (flat) + Prettier — set up so they never fight
create-vite ships a flat-config eslint.config.js. Add Prettier as the formatter, eslint-config-prettier to switch off every ESLint rule that overlaps with formatting (that's what stops the two tools from undoing each other), and eslint-plugin-perfectionist to sort imports:
Edit eslint.config.js: put eslintConfigPrettier last in extends, and add a second config object for import ordering:
.prettierrc.json — match create-vite's style (no semicolons, single quotes) so the first format pass doesn't churn every file:
.prettierignore:
Add scripts (full set in step 5): "lint": "eslint .", "lint:fix": "eslint . --fix", "format": "prettier --write .", "format:check": "prettier --check .".
4. React Compiler + incremental TypeScript
React Compiler auto-memoizes components, so you rarely hand-write useMemo/useCallback. In Vite 8, @vitejs/plugin-react transforms with oxc, so the compiler (a Babel plugin) is opted in via the plugin's reactCompilerPreset helper plus @rolldown/plugin-babel:
vite.config.ts:
Import defineConfig from vitest/config (not vite) so the test block is typed without a /// <reference types="vitest/config" /> directive — the import sorter (step 3) would move that directive below the imports and silently disable it, breaking the typecheck. The compiler's lint rule ships inside eslint-plugin-react-hooks, which the flat config above extends. Confirm it's active after build via React DevTools (components show a "Memo ✨" badge).
Incremental TypeScript: create-vite already uses project-references build mode (tsc -b) with a tsBuildInfoFile in each tsconfig.*.json, so rebuilds only recheck what changed. Keep tsc -b in the build and typecheck scripts:
5. Testing with Vitest + Testing Library
Add the test block to vite.config.ts (shares Vite's transform pipeline):
src/test/setup.ts — register jest-dom matchers and clean up between tests:
Write one real sample test (src/App.test.tsx) that renders through the app's provider and asserts behavior, so pnpm test proves the wiring end to end:
Scripts: "test": "vitest run", "test:watch": "vitest", "test:coverage": "vitest run --coverage".
6. UI framework + theme
Ask the user for a basic colour set first — at least primary and secondary/accent; ideally error and background too. Put them in one theme module so a rebrand is a one-file change.
Canonical path (MUI):
src/theme.ts — barebones, colours from the user:
Wrap the app once in src/main.tsx:
Not MUI? Read only the one file for the chosen framework — each is self-contained, so you never load the other frameworks' context:
- Tailwind → `references/ui-frameworks/tailwind.md`
- Chakra → `references/ui-frameworks/chakra.md`
- Mantine → `references/ui-frameworks/mantine.md`
- none (plain CSS) → `references/ui-frameworks/none.md`
7. Pre-commit hooks — two layers, husky owns the git hook
The repo gets both baseline file-hygiene hooks (the language-agnostic pre-commit framework) and husky + lint-staged for ESLint/Prettier. The trap: the pre-commit framework and husky both want to own .git/hooks/pre-commit. Resolve it by letting husky own the hook and calling the pre-commit framework from inside it — so never run `pre-commit install` (that would clobber husky's hook).
Add the prepare script (husky v9 sets this up): "prepare": "husky".
lint-staged config in package.json — order matters: ESLint autofix first (it may reorder imports, etc.), then Prettier as the final formatting authority:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/react-ts-setup/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/bcmyguest/personal-skills/react-ts-setup)