jest-rtl-testing

jest-rtl-testing is a skill for Claude Code, Codex from lanamaysu/agent-skills. It costs 28 tokens per session (828 once invoked), scanned A, original, MIT.

Guidance for writing and debugging Jest tests with React Testing Library, tools for checking React interfaces from a user's point of view.

In plain words
What is it for?
Use it when creating, reviewing, refactoring, or debugging tests for React components and their user interactions.
Why use it?
It helps tests focus on visible behaviour instead of fragile implementation details, and helps identify common test failures or misuse of the tools.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions AGENTS.md.

Good fit Use it when creating, reviewing, refactoring, or debugging tests for React components and their user interactions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lanamaysu/agent-skills/jest-rtl-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 lanamaysu/agent-skills --skill jest-rtl-testing
Clone the repo
git clone --depth 1 https://github.com/lanamaysu/agent-skills

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 jest-rtl-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/lanamaysu/agent-skills/jest-rtl-testing/github.svg)](https://agentmods.dev/skills/lanamaysu/agent-skills/jest-rtl-testing)
Your own site
<a href="https://agentmods.dev/skills/lanamaysu/agent-skills/jest-rtl-testing"><img src="https://agentmods.dev/badge/skills/lanamaysu/agent-skills/jest-rtl-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 jest-rtl-testing

Your own site · 80×15
<a href="https://agentmods.dev/skills/lanamaysu/agent-skills/jest-rtl-testing"><img src="https://agentmods.dev/badge/skills/lanamaysu/agent-skills/jest-rtl-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 828 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 original No closer match found 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.00028 $0.00828
Opus 5 $0.00014 $0.00414
Sonnet 5 $0.00006 $0.00166
Haiku 4.5 $0.00003 $0.00083

Measured 9d ago against content hash 4fdc9cae2392, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

jest-rtl-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 9d 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.

skills/jest-rtl-testing/SKILL.md · 93 lines

How it starts

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

Jest + React Testing Library Best Practices

Overview

Based on Testing Library's core principles and Kent C. Dodds' best practices guidance for writing user-centric tests.

Core Principle: Tests should interact with your application the same way users do, not test implementation details.

🔴 MANDATORY PRE-CHECK

Before writing any test, you MUST:

  1. ✅ Check if project has AGENTS.md and read its Testing section
  2. ✅ Follow AGENTS.md rules with highest priority when they exist
  3. ✅ Use this skill's principles as baseline guidance and supplementary best practices

When to Use

Use this skill when:

  • Writing new tests, especially React component tests
  • Reviewing or refactoring existing tests
  • Debugging test failures to determine if API is misused
  • Optimizing test readability and maintainability

Don't use when:

  • Unit testing pure functions (no DOM or React)
  • E2E testing (use Playwright, Cypress, etc.)
  • Performance testing or visual regression testing

Quick Reference

Query Priority (Context-Aware)

⚠️ Performance Warning: getByRole can be slow on large views (ref). For complex UIs with many elements, prefer getByLabelText or getByText first.

Priority Order:

  1. 🥇 getByLabelText - Form fields, best performance
  2. 🥇 getByText - Non-interactive content
  3. 🥇 getByRole - Small components only, great for a11y validation
  4. 🥉 getByPlaceholderText / getByDisplayValue
  5. 🚫 getByTestId - Last resort (document why in AGENTS.md)

Query types:

  • getBy* - element must exist (throws if not found)
  • queryBy* - expect absence (returns null)
  • findBy* - async wait (returns Promise)

Details: references/query-cheatsheet.md


Core Principles (Short)

  1. Project rules first - Read AGENTS.md and follow testing rules with highest priority.
  2. User-centric behavior - Assert what users see and do, not internal state.
  3. Async aware - Use findBy* for appearance, waitForElementToBeRemoved for disappearance.
  4. Real interactions - Prefer @testing-library/user-event over fireEvent.
  5. MSW first for HTTP - Use MSW to mock network requests; avoid manual fetch/axios mocks.

Read the full file on GitHub · 93 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 9d ago First seen · 93 lines · 28 tokens per session scan A 4fdc9cae2392

Subscribe to this mod's changes

jest-rtl-testing is a skill published in the GitHub repository lanamaysu/agent-skills (2 stars, last pushed 29d ago), licensed MIT. It adds 28 tokens to every session and 828 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

angular-testing

Write Angular component tests using TestBed, ComponentHarness, and HttpTestingController with proper signal input handling. Use when writing component tests, mocking HTTP calls, or testing signal inputs.

HoangNguyen0403/agent-skills-standard · 39 tokens

appbuilder-testing

Generate and run tests for Adobe App Builder actions and UI components. Scaffolds Jest unit tests, integration tests against deployed actions, contract tests for Adobe API interactions, and React component tests using Testing Library. Provides mock helpers for State, Files, Events SDKs, @adobe/aio-lib- clients, ExC…

adobe/skills · 201 tokens

testing

Skill "testing" from udecode/plate-playground-template, covering testing goal, core rules, seam selection, fixtures and assertions and quick reference.

udecode/plate-playground-template · 5 tokens

sfnext-testing

Write tests for Storefront Next using Vitest unit tests, Storybook stories, interaction tests, snapshot tests, and accessibility tests. Use when writing component tests, creating Storybook stories, running test coverage, or setting up test utilities. Covers testing-library patterns, play functions, and coverage…

SalesforceCommerceCloud/b2c-developer-tooling · 63 tokens

testing-react

Writes React/TypeScript tests using Vitest and React Testing Library. Use when "write react tests", "vitest", "component test", "hook test", "RTL", "testing library", "snapshot test", or testing React components, hooks, and utilities.

iliaal/whetstone · 57 tokens

react-testing-library

React Testing Library best practices for writing maintainable, user-centric tests. Use when writing, reviewing, or refactoring RTL tests. Triggers on test files, testing patterns, getBy/queryBy queries, userEvent, waitFor, and component testing.

pproenca/dot-skills · 55 tokens