react-testing

react-testing is a skill for Claude Code, Codex from KunanonJ/ai-skills-hub. It costs 59 tokens per session (3,154 once invoked), scanned A, a copy of react-testing, MIT.

A guide to testing React components, custom hooks, and pages with tools such as React Testing Library, Vitest, Jest, and Playwright. It focuses on checking what users see and do, including accessibility.

In plain words
What is it for?
Use it to write or fix component tests, test hooks, add coverage to older code, mock HTTP requests, and decide between component tests and full end-to-end tests.
Why use it?
It helps choose the right kind of test and avoids tests that depend on internal implementation details. It also provides approaches for mocking network requests and checking accessibility problems.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/kunanonj/ai-skills-hub/react-testing
Any agent
npx skills add KunanonJ/ai-skills-hub --skill react-testing
Clone the repo
git clone --depth 1 https://github.com/KunanonJ/ai-skills-hub

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for react-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/kunanonj/ai-skills-hub/react-testing.svg)](https://agentmods.dev/skills/kunanonj/ai-skills-hub/react-testing)
Your own site
<a href="https://agentmods.dev/skills/kunanonj/ai-skills-hub/react-testing"><img src="https://agentmods.dev/badge/skills/kunanonj/ai-skills-hub/react-testing.svg" alt="Measured on agentmods" height="20"></a>
Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,154 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00059 $0.03154
Opus 5 $0.00030 $0.01577
Sonnet 5 $0.00012 $0.00631
Haiku 4.5 $0.00006 $0.00315

Measured yesterday against content hash 82ecdce94f7f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

react-testing 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 yesterday.

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.

Origin

This is a copy

100% identical to react-testing — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.agents/skills/react-testing/SKILL.md · 424 lines

How it starts

The opening of the file, as written. The whole thing — 424 lines — stays where its author put it; the contents beside it link to each section on GitHub.

React Testing

Comprehensive React testing patterns for behavior-focused component tests, custom hook tests, accessibility assertions, and network-level mocking.

When to Activate

  • Writing tests for React components, custom hooks, or pages
  • Adding test coverage to legacy untested components
  • Migrating from Enzyme or class-component-era patterns to React Testing Library
  • Setting up Vitest or Jest for a new React project
  • Mocking HTTP requests in tests
  • Asserting accessibility violations
  • Deciding which tests belong in RTL vs Playwright Component Testing vs full E2E

Core Principle

Test what the user sees and does, not implementation details.

A test should:

  • Render the component with the same providers it has in production
  • Interact with it via accessible queries (role, label) and userEvent
  • Assert visible output and observable side effects (callback fired, request sent)

A test should NOT:

  • Inspect component state, props passed to children, or which hooks were called
  • Mock React itself or framework hooks
  • Assert on the number of renders or DOM structure beyond what affects users

Library Choice

Runner When Note
Vitest Vite, Remix, modern setups Faster, native ESM, Jest-compatible API
Jest Next.js, CRA, established repos Default for many React projects
Playwright Component Testing Real browser engine needed Use when JSDOM lacks the required feature
Cypress Component Testing Real browser, Cypress already in use Alternative to Playwright CT

Pick one. Do not run RTL + Vitest AND Playwright CT in the same repo unless you have a clear lane separation.

Query Priority

React Testing Library exposes queries in three tiers — use top-down:

  1. Accessible to everyone: getByRole, getByLabelText, getByPlaceholderText, getByText, getByDisplayValue
  2. Semantic: getByAltText, getByTitle
  3. Test IDs (escape hatch): getByTestId
// Best
screen.getByRole("button", { name: /save/i });

// OK for inputs
screen.getByLabelText("Email");

// Last resort
screen.getByTestId("save-btn");

Read the full file on GitHub · 424 lines

Changes

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.

  1. yesterday First seen · 424 lines · 59 tokens per session scan A 82ecdce94f7f

Subscribe to this mod's changes

react-testing is a skill published in the GitHub repository KunanonJ/ai-skills-hub (4 stars, last pushed 1mo ago), licensed MIT. It adds 59 tokens to every session and 3,154 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to react-testing, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

doncheli-tea

Run the full autonomous test suite end-to-end and report results. Activate when user mentions "test end to end", "autonomous testing", "run all tests", "full test run", "E2E tests", "test suite".

doncheli/don-cheli-sdd · 54 tokens

doncheli-visual-test

Run visual regression tests by comparing UI screenshots against baselines. Activate when user mentions "visual test", "screenshot", "UI regression", "visual diff", "pixel diff", "visual snapshot".

doncheli/don-cheli-sdd · 47 tokens

design-ship

One-shot pipeline turning a claude.ai/design link into a pull request: scaffold via /ork:design-import, stories and specs via /ork:cover, browser verification via /ork:expect, then open the PR. Use when a design link should come back as a PR with no intermediate steps; if all you need is the components written to…

yonatangross/orchestkit · 84 tokens

bmad-qa-generate-e2e-tests

Generate end to end automated tests for existing features. Use when the user says "create qa automated tests for [feature]".

LarsCowe/bmalph · 35 tokens

generate

Generate Playwright tests. Use when user says "write tests", "generate tests", "add tests for", "test this component", "e2e test", "create test for", "test this page", or "test this feature".

adriannoes/awesome-agentic-ai · 51 tokens

playwright-pro

Production-grade Playwright testing toolkit. Use when the user mentions Playwright tests, end-to-end testing, browser automation, fixing flaky tests, test migration, CI/CD testing, or test suites. Generate tests, fix flaky failures, migrate from Cypress/Selenium, sync with TestRail, run on BrowserStack. 55 templates…

adriannoes/awesome-agentic-ai · 77 tokens