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

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/ronmkr/promptbook/react-testing
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.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.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,155 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00059 $0.03155
Opus 5 $0.00030 $0.01577
Sonnet 5 $0.00012 $0.00631
Haiku 4.5 $0.00006 $0.00315

Measured yesterday against content hash 5c74a1f3bda3, 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

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. yesterday 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 3mo ago), licensed Apache-2.0. It adds 59 tokens to every session and 3,155 once invoked, about $0.0003 per session on Opus 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

testing

Testing workflow and quality standards for writing and running tests. Use when: (1) Writing new tests, (2) Adding a new feature that needs tests, (3) Modifying logic that has existing tests, (4) Before claiming a task is complete.

iOfficeAI/AionUi · 55 tokens

unlimited-mcp-selftest

Run the unlimited-mcp regression battery (Tier 0 lint+types, Tier A automated, Tier B live end-to-end) and report pass/fail per step. Use when the user says "run the regression suite", "run the battery", "selftest", "test everything", or before a version bump. Requires the unlimited-mcp server connected…

triumsebas/unlimited-mcp · 98 tokens

deploy-release-test

Validate a commit-specific Next.js preview package and manually trigger the entire Next.js deployment test suite through the teste2edeployrelease.yml GitHub Actions workflow. Use only when asked to run the full deploy test suite or this workflow specifically from an internal vercel/next.js PR branch. Do not use for…

vercel/next.js · 115 tokens

tdd-workflow

Use this skill when writing new features, fixing bugs, or refactoring code. Enforces test-driven development with 80%+ coverage including unit, integration, and E2E tests.

affaan-m/ECC · 43 tokens

reskin

Author a NEW skin for the reskinnable-demo app. A skin is a self-contained domain plugin under src/skins/ / that implements the frozen Skin contract (src/shell/skin-contract.ts) to swap the app's entire experience — brand, theme, layout, pages, tools, data, and agent — as a live sales demo. Use when the user says "add…

CopilotKit/CopilotKit · 154 tokens

copilotkit-integrations

Use when wiring an external agent framework (LangGraph, CrewAI, PydanticAI, Mastra, ADK, LlamaIndex, Agno, Strands, Microsoft Agent Framework, or others) into a CopilotKit application via the AG-UI protocol.

CopilotKit/CopilotKit · 61 tokens