React Testing
citypaul/.dotfiles
React component testing patterns including components, hooks, context, and forms.
Write tests using Vitest and React Testing Library. An agent skill from curiositech/some_claude_skills.
$ npx skills add curiositech/some_claude_skills --skill vitest-testing-patterns -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install curiositech/some_claude_skills vitest-testing-patterns --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/curiositech/some_claude_skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/vitest-testing-patterns .claude/skills/vitest-testing-patterns && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "vitest-testing-patterns" agent skill from https://github.com/curiositech/some_claude_skills/tree/main/.claude/skills/vitest-testing-patterns into .claude/skills/vitest-testing-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "vitest-testing-patterns", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/curiositech/some_claude_skills/tree/main/.claude/skills/vitest-testing-patternsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add curiositech/some_claude_skills --skill vitest-testing-patterns -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install curiositech/some_claude_skills vitest-testing-patterns --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/curiositech/some_claude_skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.claude/skills/vitest-testing-patterns .agents/skills/vitest-testing-patterns && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "vitest-testing-patterns" agent skill from https://github.com/curiositech/some_claude_skills/tree/main/.claude/skills/vitest-testing-patterns into .agents/skills/vitest-testing-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "vitest-testing-patterns", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add curiositech/some_claude_skills --skill vitest-testing-patterns -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install curiositech/some_claude_skills vitest-testing-patterns --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/curiositech/some_claude_skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.claude/skills/vitest-testing-patterns .cursor/skills/vitest-testing-patterns && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "vitest-testing-patterns" agent skill from https://github.com/curiositech/some_claude_skills/tree/main/.claude/skills/vitest-testing-patterns into .cursor/skills/vitest-testing-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "vitest-testing-patterns", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/curiositech/some_claude_skills.git --path .claude/skills/vitest-testing-patterns--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add curiositech/some_claude_skills --skill vitest-testing-patterns -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install curiositech/some_claude_skills vitest-testing-patterns --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/curiositech/some_claude_skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.claude/skills/vitest-testing-patterns .gemini/skills/vitest-testing-patterns && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "vitest-testing-patterns" agent skill from https://github.com/curiositech/some_claude_skills/tree/main/.claude/skills/vitest-testing-patterns into .gemini/skills/vitest-testing-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "vitest-testing-patterns", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install curiositech/some_claude_skills vitest-testing-patternsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add curiositech/some_claude_skills --skill vitest-testing-patterns -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/curiositech/some_claude_skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/.claude/skills/vitest-testing-patterns .github/skills/vitest-testing-patterns && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "vitest-testing-patterns" agent skill from https://github.com/curiositech/some_claude_skills/tree/main/.claude/skills/vitest-testing-patterns into .github/skills/vitest-testing-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "vitest-testing-patterns", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add curiositech/some_claude_skills --skill vitest-testing-patterns -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install curiositech/some_claude_skills vitest-testing-patterns --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/curiositech/some_claude_skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.claude/skills/vitest-testing-patterns .opencode/skills/vitest-testing-patterns && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "vitest-testing-patterns" agent skill from https://github.com/curiositech/some_claude_skills/tree/main/.claude/skills/vitest-testing-patterns into .opencode/skills/vitest-testing-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "vitest-testing-patterns", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
vitest-testing-patternsWrite tests using Vitest and React Testing Library. An agent skill from curiositech/some_claude_skills.
Vitest Testing Patterns is an agent skill from curiositech/some_claude_skills. Write tests using Vitest and React Testing Library. Use when creating unit tests, component tests, integration tests, or mocking dependencies. Activates for test file creation, mock patterns, coverage, and testing best practices.
Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `.claude-plugin/plugin.json`).
It sits in Testing & QA, covering Unit testing and Test strategy. It works with Vitest and Testing Library. The repository describes itself as: Claude skills that make my life easier. The licence is MIT.
3 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 6713fc7. It shows what the files ask for, not the result of running them.
Pre-approves these tools, so the agent can use them without asking each time:
ReadWriteEditBash(npm:*npx:*)From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
npmFrom the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
testing-library.comvitest.devFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Vitest Testing Patterns loads about 2.5k tokens when it runs. Until then it costs about 63 tokens; SKILL.md has 194 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from curiositech/some_claude_skills at commit 6713fc7, republished under its MIT licence (© curiositech). 194 words, ~2,547 tokens.
.claude/skills/vitest-testing-patterns/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.This skill helps you write effective tests using Vitest and React Testing Library following project conventions.
✅ USE this skill for:
❌ DO NOT use for:
Configuration: vitest.config.ts
src/test/setup.tsCommands:
npm test # Watch mode
npm run test:run # Single run
npm run test:coverage # With coveragesrc/
├── app/api/__tests__/ # API route tests
├── components/__tests__/ # Component tests
├── lib/__tests__/ # Library/utility tests
└── lib/{feature}/__tests__/ # Feature-specific testsName tests as {name}.test.ts or {name}.test.tsx.
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { GET, POST } from '../route';
import { NextRequest } from 'next/server';
// Mock dependencies
vi.mock('@/lib/auth', () => ({
getSession: vi.fn(),
}));
vi.mock('@/db', () => ({
db: {
select: vi.fn().mockReturnThis(),
from: vi.fn().mockReturnThis(),
where: vi.fn().mockResolvedValue([]),
},
}));
describe('GET /api/feature', () => {
beforeEach(() => {
vi.clearAllMocks();
});
it('returns 401 when not authenticated', async () => {
vi.mocked(getSession).mockResolvedValue(null);
const request = new NextRequest('http://localhost/api/feature');
const response = await GET(request);
expect(response.status).toBe(401);
});
it('returns data when authenticated', async () => {
vi.mocked(getSession).mockResolvedValue({ userId: 'user-123' });
vi.mocked(db.select).mockReturnValue({
from: vi.fn().mockReturnValue({
where: vi.fn().mockResolvedValue([{ id: '1', name: 'Test' }]),
}),
});
const request = new NextRequest('http://localhost/api/feature');
const response = await GET(request);
const data = await response.json();
expect(response.status).toBe(200);
expect(data).toHaveLength(1);
});
});import { describe, it, expect, vi } from 'vitest';
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { FeatureComponent } from '../FeatureComponent';
// Mock hooks
vi.mock('@/hooks/useAuth', () => ({
useAuth: vi.fn().mockReturnValue({
user: { id: 'user-123', name: 'Test User' },
isLoading: false,
}),
}));
describe('FeatureComponent', () => {
it('renders loading state', () => {
vi.mocked(useAuth).mockReturnValueOnce({
user: null,
isLoading: true,
});
render(<FeatureComponent />);
expect(screen.getByText(/loading/i)).toBeInTheDocument();
});
it('handles user interaction', async () => {
const user = userEvent.setup();
const onSubmit = vi.fn();
render(<FeatureComponent onSubmit={onSubmit} />);
await user.type(screen.getByRole('textbox'), 'Test input');
await user.click(screen.getByRole('button', { name: /submit/i }));
expect(onSubmit).toHaveBeenCalledWith('Test input');
});
it('displays error state', async () => {
vi.mocked(fetch).mockRejectedValueOnce(new Error('Network error'));
render(<FeatureComponent />);
await waitFor(() => {
expect(screen.getByRole('alert')).toHaveTextContent(/error/i);
});
});
});import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { processData, formatDate } from '../utils';
describe('processData', () => {
it('transforms input correctly', () => {
const input = { raw: 'data' };
const result = processData(input);
expect(result).toEqual({
processed: true,
data: 'DATA',
});
});
it('throws on invalid input', () => {
expect(() => processData(null)).toThrow('Invalid input');
});
});
describe('formatDate', () => {
beforeEach(() => {
vi.useFakeTimers();
vi.setSystemTime(new Date('2025-01-15T10:00:00Z'));
});
afterEach(() => {
vi.useRealTimers();
});
it('formats relative dates', () => {
const yesterday = new Date('2025-01-14T10:00:00Z');
expect(formatDate(yesterday)).toBe('yesterday');
});
});// Mock entire module
vi.mock('@/lib/auth', () => ({
getSession: vi.fn(),
requireAuth: vi.fn(),
}));
// Mock with partial implementation
vi.mock('date-fns', async () => {
const actual = await vi.importActual('date-fns');
return {
...actual,
format: vi.fn(() => '2025-01-15'),
};
});
// Mock default export (like Anthropic SDK)
vi.mock('@anthropic-ai/sdk', () => ({
default: class MockAnthropic {
messages = {
create: vi.fn().mockResolvedValue({
content: [{ type: 'text', text: 'Mock response' }],
usage: { input_tokens: 10, output_tokens: 20 },
}),
};
},
}));// Create mock function
const mockFn = vi.fn();
// Set return values
mockFn.mockReturnValue('sync value');
mockFn.mockResolvedValue('async value');
mockFn.mockRejectedValue(new Error('Failed'));
// One-time behavior
mockFn.mockReturnValueOnce('first call only');
// Custom implementation
mockFn.mockImplementation((arg) => arg.toUpperCase());
// Verify calls
expect(mockFn).toHaveBeenCalled();
expect(mockFn).toHaveBeenCalledTimes(2);
expect(mockFn).toHaveBeenCalledWith('expected', 'args');vi.mock('@/db', () => ({
db: {
select: vi.fn().mockReturnValue({
from: vi.fn().mockReturnValue({
where: vi.fn().mockReturnValue({
orderBy: vi.fn().mockReturnValue({
limit: vi.fn().mockResolvedValue([{ id: '1' }]),
}),
}),
}),
}),
insert: vi.fn().mockReturnValue({
values: vi.fn().mockReturnValue({
returning: vi.fn().mockResolvedValue([{ id: 'new-1' }]),
}),
}),
},
}));describe('debounced function', () => {
beforeEach(() => {
vi.useFakeTimers();
});
afterEach(() => {
vi.useRealTimers();
});
it('debounces calls', async () => {
const callback = vi.fn();
const debounced = debounce(callback, 300);
debounced();
debounced();
debounced();
expect(callback).not.toHaveBeenCalled();
vi.advanceTimersByTime(300);
expect(callback).toHaveBeenCalledTimes(1);
});
});Use queries in this order (most to least preferred):
// Preferred
screen.getByRole('button', { name: /submit/i });
screen.getByRole('heading', { level: 1 });
screen.getByLabelText(/email/i);
// Avoid unless necessary
screen.getByTestId('submit-button');// Wait for element to appear
await waitFor(() => {
expect(screen.getByText('Loaded')).toBeInTheDocument();
});
// Find (built-in waitFor)
const element = await screen.findByText('Loaded');
// Wait for element to disappear
await waitFor(() => {
expect(screen.queryByText('Loading')).not.toBeInTheDocument();
});import { cleanup } from '@testing-library/react';
afterEach(() => {
cleanup(); // React cleanup (automatic with setup.ts)
vi.clearAllMocks(); // Reset mock call counts
vi.resetAllMocks(); // Reset mocks to initial state
vi.restoreAllMocks(); // Restore original implementations
});import { axe, toHaveNoViolations } from 'jest-axe';
expect.extend(toHaveNoViolations);
it('has no accessibility violations', async () => {
const { container } = render(<Component />);
const results = await axe(container);
expect(results).toHaveNoViolations();
});// jest-dom matchers (from setup.ts)
expect(element).toBeInTheDocument();
expect(element).toBeVisible();
expect(element).toBeDisabled();
expect(element).toHaveTextContent('text');
expect(element).toHaveAttribute('href', '/path');
expect(element).toHaveClass('active');
expect(input).toHaveValue('input value');© curiositech, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 1 other file in .claude/skills/vitest-testing-patterns of curiositech/some_claude_skills.
Open the folder on GitHubat commit 6713fc7
Vitest Testing Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Vitest Testing Patterns this skillcuriositech/some_claude_skills | 243 | — | ~2.5k | Automated safety check: Pass | MIT | |
| React Testingcitypaul/.dotfiles | 739 | — | ~3.6k | Automated safety check: Pass | Custom licence | |
| Front End Testingcitypaul/.dotfiles | 739 | — | ~6.2k | Automated safety check: Pass | Custom licence | |
| Dify Frontend Testinglanggenius/dify | 158k | — | ~242 | Automated safety check: Pass | Custom licence | |
| Designing TestsCloudAI-X/claude-workflow-v2 | 1.4k | 1 repos | ~1.5k | Automated safety check: Pass | MIT | |
| Frontend TestingOhh-889/skyroc | 795 | 1 repos | ~2.5k | Automated safety check: Pass | MIT |
citypaul/.dotfiles
React component testing patterns including components, hooks, context, and forms.
citypaul/.dotfiles
Behavior-driven UI testing patterns across Vitest Browser Mode, Playwright E2E evidence boundaries, and DOM Testing Library.
langgenius/dify
Use when writing or changing Vitest or React Testing Library tests under `web/` or `packages/dify-ui/`, or when the user explicitly requests frontend test…
CloudAI-X/claude-workflow-v2
Designs and implements testing strategies for any codebase. An agent skill from CloudAI-X/claude-workflow-v2.
Ohh-889/skyroc
Generate Vitest + React Testing Library tests for Dify frontend components, hooks, and utilities.
chongdashu/vibejam-starter-pack
Plan, implement, and debug frontend tests: unit/integration/E2E/visual/a11y.
curiositech/some_claude_skills
Detect crisis signals in user content using NLP, mental health sentiment analysis, and safe intervention protocols.
curiositech/some_claude_skills
End-to-end form handling with react-hook-form, Zod schemas, validation patterns, error messaging, field arrays, and multi-step wizards.
curiositech/some_claude_skills
Strategic analyst that maps competitive landscapes, identifies white space opportunities, and provides positioning recommendations.
curiositech/some_claude_skills
Build production CI/CD pipelines with GitHub Actions. An agent skill from curiositech/some_claude_skills.
curiositech/some_claude_skills
Build production computer vision pipelines for object detection, tracking, and video analysis.
curiositech/some_claude_skills
Long-running design anthropologist that builds comprehensive visual databases from 500-1000 real-world examples, extracting color palettes, typography patterns, layout systems, and interaction…
Works with
Categories
Write tests using Vitest and React Testing Library. An agent skill from curiositech/some_claude_skills. Vitest Testing Patterns is an agent skill from curiositech/some_claude_skills. Write tests using Vitest and React Testing Library.
Vitest Testing Patterns fits situations like: creating unit tests; component tests; integration tests; mocking dependencies.
Run `npx skills add curiositech/some_claude_skills --skill vitest-testing-patterns -a claude-code`. Or copy the skill folder (.claude/skills/vitest-testing-patterns in curiositech/some_claude_skills) into .claude/skills/vitest-testing-patterns in your project. Claude Code loads it when a task matches its description.
Run `npx skills add curiositech/some_claude_skills --skill vitest-testing-patterns -a codex`. Or copy the skill folder (.claude/skills/vitest-testing-patterns in curiositech/some_claude_skills) into .agents/skills/vitest-testing-patterns in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add curiositech/some_claude_skills --skill vitest-testing-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/vitest-testing-patterns, .gemini/skills/vitest-testing-patterns, .github/skills/vitest-testing-patterns and .opencode/skills/vitest-testing-patterns in your project.
Going by SKILL.md and its folder, Vitest Testing Patterns needs the command-line tools its instructions call (npm). Its frontmatter pre-approves these tools: Read, Write, Edit, Bash(npm:*,npx:*).
SKILL.md names 2 domains. As links in the text: testing-library.com and vitest.dev. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Vitest Testing Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.5k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Vitest Testing Patterns: React Testing (citypaul/.dotfiles, 739 stars), Front End Testing (citypaul/.dotfiles, 739 stars), Dify Frontend Testing (langgenius/dify, 158k stars) and Designing Tests (CloudAI-X/claude-workflow-v2, 1.4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
curiositech (a GitHub organization) maintains it in curiositech/some_claude_skills, which has 243 GitHub stars. The repository holds 108 skills in this directory. The repository was last updated on September 6, 2026.
Source: curiositech/some_claude_skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.