react-code

Guide building and testing React applications with Vite and Vitest.

3|Updated Jun 10, 2026
One-click install
npx skills add https://github.com/cwijayasundara/claude_harness_eng_v5 --skill react-code
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-code
Source: https://github.com/cwijayasundara/claude_harness_eng_v5/tree/main/.claude/skills/react-code
Command: npx skills add https://github.com/cwijayasundara/claude_harness_eng_v5 --skill react-code

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires vite, vitest, react, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill unit addresses the complexities of building client-side React applications with Vite, providing guidance on best practices, common pitfalls, and efficient development workflows.

Core Features & Use Cases

  • Efficient Development with Vite: Offers insights into Vite's environment variables, configuration, and testing tools.
  • Best Practices for React Hooks: Educates on cleanup functions, stale closures, and dependency array management.
  • Testing with Vitest: Provides guidance on setting up and running tests using Vitest and React Testing Library.
  • Use Case: For a developer looking to implement a new React feature in a Vite project, this skill unit offers a step-by-step guide on how to use Vite's environment variables and how to write effective tests with Vitest.

Quick Start

Use the react-code skill to create a new React component and write tests for it using Vitest.

Frequently Asked Questions about react-code

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure Vite environment variables for a React application?

To configure Vite environment variables in a React application, you must prefix custom variables with VITE_ in a .env file. This ensures they are securely exposed to your client-side code via the import.meta.env object.

What are the best practices for managing React hooks dependency arrays?

Managing React hooks dependency arrays requires including all reactive values used inside the effect to prevent stale closures. You should also utilize cleanup functions to unsubscribe from listeners and reset state during component unmounting.

How do I set up Vitest to test React components with Vite?

Setting up Vitest to test React components in a Vite project involves installing Vitest and React Testing Library. You can then write test suites that render your components and assert their behavior directly within the Vite environment.

Do I need to install Vite and Vitest before testing React components?

Yes, you need Vite and Vitest installed and configured in your project before testing React components. This Skill provides guidance on best practices assuming these foundational development dependencies are already present in your environment.

Why does my React hook keep capturing stale closures during rendering?

Your React hook captures stale closures during rendering because the dependency array omits variables updated in the component scope. Adding the missing reactive state or props to the array ensures the hook executes with current values.

Can I use this Vite and Vitest workflow for implementing new React features?

Yes, you can use this Vite and Vitest workflow for implementing new React features. It provides step-by-step guidance on utilizing Vite environment variables and writing effective tests for newly created client-side components.