react-testing

react-testing is a skill for Claude Code, Codex from JunMystery/Agent-Guidance-Python. It costs 59 tokens per session (3,160 once invoked), scanned A, a copy of react-testing, MIT.

A guide to testing React components, hooks, and pages based on what users see and do. It covers component test tools, network mocking, accessibility checks, and when to use end-to-end tests that exercise a complete browser flow.

In plain words
What is it for?
Use it when adding or fixing React tests, migrating from Enzyme, setting up Vitest or Jest, mocking HTTP requests, checking accessibility, or deciding between component and end-to-end tests.
Why use it?
It helps choose the right test level and avoid brittle tests that inspect internal implementation details instead of observable behavior.

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/junmystery/agent-guidance-python/react-testing
Any agent
npx skills add JunMystery/Agent-Guidance-Python --skill react-testing
Clone the repo
git clone --depth 1 https://github.com/JunMystery/Agent-Guidance-Python

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/junmystery/agent-guidance-python/react-testing.svg)](https://agentmods.dev/skills/junmystery/agent-guidance-python/react-testing)
Your own site
<a href="https://agentmods.dev/skills/junmystery/agent-guidance-python/react-testing"><img src="https://agentmods.dev/badge/skills/junmystery/agent-guidance-python/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,160 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 91% 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.03160
Opus 5 $0.00030 $0.01580
Sonnet 5 $0.00012 $0.00632
Haiku 4.5 $0.00006 $0.00316

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

91% identical to react-testing — 5 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/react-testing/SKILL.md · 425 lines

How it starts

The opening of the file, as written. The whole thing — 425 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 · 425 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 · 425 lines · 59 tokens per session scan A a11c1a5ff8da

Subscribe to this mod's changes

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

Related

Other skills, from other repositories

tests-run

Execute Unity tests (EditMode or PlayMode) and return per-test results. Supports filtering by test assembly, namespace, class, and method. Refreshes the AssetDatabase first; defers execution across domain reloads if scripts changed. Precondition: every open scene must be saved — dirty scenes abort the run.

IvanMurzak/Unity-MCP · 68 tokens

myco:runtime-bootstrap-and-test-isolation

Activate this skill when adding a new manager, adding a new tool category, writing or debugging tool unit tests, diagnosing tool-visibility failures, investigating startup performance, or extending/maintaining/debugging the two-tier tool discovery system (toolindex) — even if the user doesn't explicitly ask about the…

sirkirby/unifi-mcp · 224 tokens

verify-work

Verify feature, bug, UI, API, mobile, security, or deployment work against acceptance criteria.

HoangNguyen0403/agent-skills-standard · 23 tokens

frontend-testing

Generate Vitest + React Testing Library tests for frontend components, hooks, and utilities. Triggers on testing, spec files, coverage, Vitest, RTL, unit tests, integration tests, or write/review test requests.

PageAI-Pro/ralph-loop · 48 tokens

authoring-data-quality-checks

Adds and runs data quality checks (dbt-test style assertions) on a project's warehouse tables and saved-query views: not-null, uniqueness, accepted values, referential integrity, row-count bounds, freshness, and custom HogQL. Use when asked to test a model, validate a view, check for nulls or duplicates, add data…

PostHog/posthog · 161 tokens

frontmcp-auth-ui

Use when customizing, branding, or replacing the built-in FrontMCP OAuth pages (the login, consent, federated-select, incremental-authorization, and error pages) with your own React components. Covers the auth.ui slot-to-file map and auth.extras name-to-handler map on the auth config (no decorator, no class); the…

agentfront/frontmcp · 184 tokens