Borrowing it
Nothing to install: this file belongs to erezcohen/react-vite2. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/erezcohen/react-vite2/master/.claude/commands/create_unit_tests.mdgit clone --depth 1 https://github.com/erezcohen/react-vite2Wrote 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.
[](https://agentmods.dev/commands/erezcohen/react-vite2/create_unit_tests)<a href="https://agentmods.dev/commands/erezcohen/react-vite2/create_unit_tests"><img src="https://agentmods.dev/badge/commands/erezcohen/react-vite2/create_unit_tests/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.
<a href="https://agentmods.dev/commands/erezcohen/react-vite2/create_unit_tests"><img src="https://agentmods.dev/badge/commands/erezcohen/react-vite2/create_unit_tests.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.02565 |
| Opus 5.5 | $0.00000 | $0.01026 |
| Sonnet 5.5 | $0.00000 | $0.00513 |
| Haiku 4.5 | $0.00000 | $0.00257 |
Grade A, and why
create_unit_tests 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 25d 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.
How it starts
The opening of the file, as written. The whole thing — 393 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Writing Unit Tests with Vitest and React Testing Library
You are an expert frontend developer with extensive experience in unit testing React components using Vitest and React Testing Library. Your expertise includes writing maintainable, reliable tests that follow industry best practices and focus on user behavior rather than implementation details.
Command Usage
This command helps you create comprehensive unit tests for React components. You can optionally specify:
--componentor-c: The specific component to test (e.g., "Button", "Header", "UserProfile")--pageor-p: The page component to test (e.g., "Dashboard", "Login", "Settings")--hookor-h: Custom React hook to test (e.g., "useAuth", "useTheme", "useLocalStorage")--utilor-u: Utility function to test (e.g., "formatDate", "validateEmail", "calculateTotal")
Examples:
create_unit_tests --component Buttoncreate_unit_tests --page Dashboardcreate_unit_tests --hook useAuthcreate_unit_tests --util formatCurrency
Best Practices
Follow these best practices when creating unit tests with Vitest and React Testing Library:
1. Test Organization
- Place test files in
__tests__/directories next to the source files - Use
.test.tsor.test.tsxextension for test files - Group related tests using
describe()blocks - Use descriptive test names that explain user behavior
2. Import Structure
import { render, screen, fireEvent, waitFor } from '@/test/test-utils';
import userEvent from '@testing-library/user-event';
import { vi } from 'vitest';
import { ComponentName } from '../ComponentName';
3. Test Utilities
Always use the custom test utilities from @/test/test-utils which includes:
- Router provider for components that use navigation
- Theme provider for components that use theme context
- Other global providers your app requires
4. Query Priority
Use React Testing Library queries in this order of preference:
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.
- 25d ago First seen · 393 lines · 0 tokens per session scan A e43a317dd523
create_unit_tests is a command published in the GitHub repository erezcohen/react-vite2 (0 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,565 tokens. 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-10-02.
Other commands, from other repositories
implement-from-plan
You are in implementation-only mode.
story-and-test
For the component(s) in scope.
ui-component-create
Create a UI Component in /components/ui with variants, tests, and preview.
add-tests
Add comprehensive tests for React components or functions using React Testing Library and Jest.
component-scaffold
You are a React component architecture expert specializing in scaffolding production-ready, accessible, and performant components. Generate complete component implementations with TypeScript, tests, styles, and documentation following modern best practices.
state-management
Implement state management solution for $ARGUMENTS following project conventions.