react-testing

react-testing is a skill for Claude Code, Codex from ronmkr/PromptBook. It costs 59 tokens per session (3,155 once invoked), scanned A, a copy of react-testing, Apache-2.0.

A guide for testing React components, hooks, and pages with tools such as React Testing Library, Vitest or Jest, and network mocks. It focuses on checking what users see and do, including accessibility behavior.

In plain words
What is it for?
Use it to add or repair React tests, mock HTTP requests, check accessibility, and choose between component and end-to-end testing.
Why use it?
It helps separate useful component tests from implementation details and clarifies when a full browser test is more suitable.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to add or repair React tests, mock HTTP requests, check accessibility, and choose between component and end-to-end testing.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ronmkr/promptbook/react-testing
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.

Any agent
npx skills add ronmkr/PromptBook --skill react-testing
Clone the repo
git clone --depth 1 https://github.com/ronmkr/PromptBook

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/ronmkr/promptbook/react-testing/github.svg)](https://agentmods.dev/skills/ronmkr/promptbook/react-testing)
Your own site
<a href="https://agentmods.dev/skills/ronmkr/promptbook/react-testing"><img src="https://agentmods.dev/badge/skills/ronmkr/promptbook/react-testing/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.

agentmods 80×15 button for react-testing

Your own site · 80×15
<a href="https://agentmods.dev/skills/ronmkr/promptbook/react-testing"><img src="https://agentmods.dev/badge/skills/ronmkr/promptbook/react-testing.svg" alt="Reviewed on agentmods" width="80" 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,155 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 98% 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.1 $0.00059 $0.03155
Opus 5.5 $0.00024 $0.01262
Sonnet 5.5 $0.00012 $0.00631
Haiku 4.5 $0.00006 $0.00315

Measured 1mo ago against content hash 5c74a1f3bda3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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.

Origin

This is a copy

98% identical to react-testing — 2 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.

skills/technical/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. 1mo ago First seen · 424 lines · 59 tokens per session scan A 5c74a1f3bda3

Subscribe to this mod's changes

react-testing is a skill published in the GitHub repository ronmkr/PromptBook (2 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 59 tokens to every session and 3,155 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 98% identical to react-testing, differing in 2 lines, and is treated as a copy.

Related

Other skills, from other repositories

storybook-testing

Storybook 10 testing patterns with Vitest integration, ESM-only distribution, CSF3 typesafe factories, play() interaction tests, Chromatic TurboSnap visual regression, module automocking, accessibility addon testing, and autodocs generation. Use when writing component stories, setting up visual regression testing…

yonatangross/orchestkit · 77 tokens

browser-qa

Testing web apps through a real browser: reconnaissance before acting, selector discovery, state capture, console errors and screenshot evidence. Use on a web surface end to end, or to reproduce a front-end bug.

damianvtran/local-operator · 45 tokens

knowledge-engineering-quality-and-delivery-real-api-qualification-and-e2e

A guide to tests that call real AI providers and verify complete user flows across the CLI, web interface, terminals, and ACP hosts.

echoVic/blade-code · 182 tokens

knowledge-engineering-quality-and-delivery-unit-integration-and-shared-test-harnesses

A testing guide for the CLI and web interfaces, covering unit, integration, end-to-end, and real-process test setup with shared fixtures and cleanup.

echoVic/blade-code · 184 tokens

webapp-testing

Browser-based UI verification using Playwright. Page Object Model, selector best practices, visual regression, network interception, and MCP integration. Trigger: When writing E2E tests, verifying UI changes, or setting up Playwright.

JNZader/repoforge · 49 tokens

react-test-engineer

Expert guidance for testing React applications using React Testing Library and Vitest. Focuses on user-centric testing, accessibility, and best practices for unit and integration tests to ensure robust and maintainable code.

GrishaAngelovGH/gemini-cli-agent-skills · 44 tokens