home / skills / madappgang / claude-code / tooling-setup

This skill helps you set up React 19 projects with Vite, TypeScript, Biome, and Vitest for fast, consistent tooling.

npx playbooks add skill madappgang/claude-code --skill tooling-setup

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
4.7 KB
---
name: tooling-setup
description: Use when setting up new projects or updating tool configurations. Configures Vite, TypeScript, Biome, and Vitest for React 19 projects. Covers build configuration, strict TypeScript setup, linting/formatting, and testing infrastructure.
updated: 2026-01-20
keywords: vite, typescript, biome, vitest, build-config, tooling, react-compiler, testing
---

# Tooling Setup for React 19 Projects

Production-ready configuration for modern frontend tooling with Vite, TypeScript, Biome, and Vitest.

## 1. Vite + React 19 + React Compiler

```typescript
// vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  plugins: [
    react({
      babel: {
        // React Compiler must run first:
        plugins: ['babel-plugin-react-compiler'],
      },
    }),
  ],
})
```

**Verify:** Check DevTools for "Memo ✨" badge on optimized components.

## 2. TypeScript (strict + bundler mode)

```json
// tsconfig.json
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "jsx": "react-jsx",
    "verbatimModuleSyntax": true,
    "isolatedModules": true,
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "exactOptionalPropertyTypes": true,
    "noFallthroughCasesInSwitch": true,
    "types": ["vite/client", "vitest"]
  },
  "include": ["src", "vitest-setup.ts"]
}
```

**Key Settings:**
- `moduleResolution: "bundler"` - Optimized for Vite
- `strict: true` - Enable all strict type checks
- `noUncheckedIndexedAccess: true` - Safer array/object access
- `verbatimModuleSyntax: true` - Explicit import/export

## 3. Biome (formatter + linter)

```bash
npx @biomejs/biome init
npx @biomejs/biome check --write .
```

```json
// biome.json
{
  "formatter": { "enabled": true, "lineWidth": 100 },
  "linter": {
    "enabled": true,
    "rules": {
      "style": { "noUnusedVariables": "error" }
    }
  }
}
```

**Usage:**
- `npx biome check .` - Check for issues
- `npx biome check --write .` - Auto-fix issues
- Replaces ESLint + Prettier with one fast tool

## 4. Environment Variables

- Read via `import.meta.env`
- Prefix all app-exposed vars with `VITE_`
- Never place secrets in the client bundle

```typescript
// Access environment variables
const apiUrl = import.meta.env.VITE_API_URL
const isDev = import.meta.env.DEV
const isProd = import.meta.env.PROD

// .env.local (not committed)
VITE_API_URL=https://api.example.com
VITE_ANALYTICS_ID=UA-12345-1
```

## 5. Testing Setup (Vitest)

```typescript
// vitest-setup.ts
import '@testing-library/jest-dom/vitest'

// vitest.config.ts
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'

export default defineConfig({
  plugins: [react()],
  test: {
    environment: 'jsdom',
    setupFiles: ['./vitest-setup.ts'],
    coverage: { reporter: ['text', 'html'] }
  }
})
```

**Setup Notes:**
- Use React Testing Library for DOM assertions
- Use MSW for API mocks (see **tanstack-query** skill for MSW patterns)
- Add `types: ["vitest", "vitest/jsdom"]` for jsdom globals in tsconfig.json

**Run Tests:**
```bash
npx vitest                    # Run in watch mode
npx vitest run               # Run once
npx vitest --coverage        # Generate coverage report
```

## Package Installation

```bash
# Core
pnpm add react@rc react-dom@rc
pnpm add -D vite @vitejs/plugin-react typescript

# Biome (replaces ESLint + Prettier)
pnpm add -D @biomejs/biome

# React Compiler
pnpm add -D babel-plugin-react-compiler

# Testing
pnpm add -D vitest @testing-library/react @testing-library/jest-dom
pnpm add -D @testing-library/user-event jsdom
pnpm add -D msw

# TanStack
pnpm add @tanstack/react-query @tanstack/react-router
pnpm add -D @tanstack/router-plugin @tanstack/react-query-devtools

# Utilities
pnpm add axios zod
```

## Project Scripts

```json
{
  "scripts": {
    "dev": "vite",
    "build": "tsc --noEmit && vite build",
    "preview": "vite preview",
    "test": "vitest",
    "test:run": "vitest run",
    "test:coverage": "vitest --coverage",
    "lint": "biome check .",
    "lint:fix": "biome check --write .",
    "format": "biome format --write ."
  }
}
```

## IDE Setup

**VSCode Extensions:**
- Biome (biomejs.biome)
- TypeScript (built-in)
- Vite (antfu.vite)

**VSCode Settings:**
```json
{
  "editor.defaultFormatter": "biomejs.biome",
  "editor.formatOnSave": true,
  "[typescript]": {
    "editor.defaultFormatter": "biomejs.biome"
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "biomejs.biome"
  }
}
```

## Related Skills

- **core-principles** - Project structure and best practices
- **react-patterns** - React 19 specific features
- **testing-strategy** - Advanced testing patterns with MSW

Overview

This skill configures a production-ready frontend toolchain for React 19 projects using Vite, TypeScript, Biome, and Vitest. It provides strict TypeScript settings, Vite + React Compiler setup, Biome for linting/formatting, environment variable guidance, and a Vitest testing scaffold. The goal is a fast, safe, and opinionated baseline you can apply to new or existing React apps.

How this skill works

It wires Vite with the React plugin and the React Compiler to enable React 19 optimizations during build and dev. It enforces strict TypeScript and bundler module resolution to catch issues early and align with Vite. Biome replaces ESLint and Prettier for formatting and linting in one tool. Vitest is configured with jsdom and Testing Library setup files for reliable component tests and coverage reporting.

When to use it

  • Starting a new React 19 project and needing a production-ready toolchain.
  • Upgrading an existing app to React 19 and replacing legacy tooling.
  • Standardizing build, lint, format, and test configs across multiple repos.
  • Enforcing strict typing and safer runtime behavior for frontend code.
  • Adding lightweight, fast test infrastructure for component and integration tests.

Best practices

  • Enable TypeScript strict mode and noUncheckedIndexedAccess for safer code and early errors.
  • Use moduleResolution: 'bundler' to align TypeScript with Vite’s resolution behavior.
  • Prefix browser-exposed env vars with VITE_ and keep secrets out of client bundles.
  • Run Biome checks as part of CI and use biome check --write for automatic fixes.
  • Add vitest setup files and types in tsconfig for jsdom globals and Testing Library helpers.

Example use cases

  • Scaffold a new React 19 app with Vite, strict TypeScript, and Biome as the single formatter/linter.
  • Migrate a project from ESLint + Prettier to Biome to simplify toolchain and speed up CI.
  • Add Vitest with Testing Library and coverage to an existing repo for component tests.
  • Configure environment variable access and runtime flags using import.meta.env.
  • Integrate React Compiler via vite.config to get optimized memoization and component transforms.

FAQ

Do I need both Biome and ESLint/Prettier?

No. Biome replaces ESLint and Prettier, combining formatting and lint rules into a single fast tool.

How do I keep secrets out of the client bundle?

Never commit secrets in .env files and only expose client-safe vars prefixed with VITE_. Use server-side environment variables for secrets.

How do I run tests and see coverage?

Use npx vitest for watch mode, npx vitest run for single runs, and npx vitest --coverage to generate coverage reports.