mcpField
R
react-testing-library

react-testing-library

github.com/shipshitdevTesting & quality3890 installsUpdated today
Repository

About react-testing-library

A skill for developers writing and reviewing React Testing Library component tests. It organizes 43 rules across nine categories by impact, from query selection and async handling to accessibility.

Key features

  1. 0143 rules ranked by impact
  2. 02Guidance on semantic queries
  3. 03Async test handling practices
  4. 04User interaction simulation guidance
  5. 05Assertions and accessibility checks

Use cases

  1. 01Writing React component tests
  2. 02Choosing suitable DOM queries
  3. 03Reviewing tests for anti-patterns
  4. 04Testing components and hooks

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/shipshitdev/skills --skill react-testing-library

After installing, type/react-testing-libraryin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

plugin.json
README.md
assets/templates/
_template.md
references/
_sections.md
a11y-role-queries-verify.md
a11y-test-aria-states.md
a11y-verify-focus.md
anti-container-queries.md
anti-empty-waitfor.md
anti-implementation-details.md
anti-manual-cleanup.md
anti-redundant-roles.md
anti-unnecessary-act.md
assert-accessible-description.md
assert-dom-matchers.md
assert-have-value.md
assert-text-content.md
assert-visible-over-in-document.md
async-await-findby.md
async-findby-over-waitfor.md
async-no-side-effects-waitfor.md
async-single-assertion-waitfor.md
async-waitfor-disappear.md
debug-logroles.md
debug-screen-debug.md
debug-testing-playground.md
query-avoid-testid.md
query-get-vs-query.md
query-label-text-forms.md
query-prefer-role.md

Details

From the project README

React Testing Library Best Practices

43 rules across 9 categories for testing React components with Testing Library, prioritized by impact to guide test writing and code review.

Scope

This skill owns React component and hook testing mechanics. For framework-agnostic questions — which level a behavior belongs at, what a coverage number means, how to choose test data, how to kill a flake — use testing-expert.

When to Apply

  • Writing new component tests with React Testing Library
  • Selecting queries (getByRole, getByLabelText, etc.)
  • Handling async operations in tests (findBy, waitFor)
  • Simulating user interactions (userEvent)
  • Reviewing tests for anti-patterns and implementation detail testing

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Query SelectionCRITICALquery-
2Async HandlingCRITICALasync-
3Common Anti-PatternsCRITICALanti-
4User InteractionHIGHuser-
5AssertionsHIGHassert-
6Component SetupMEDIUMsetup-
7Test StructureMEDIUMstruct-
8DebuggingLOW-MEDIUMdebug-
9Accessibility TestingLOWa11y-

Quick Reference

1. Query Selection (CRITICAL)
2. Async Handling (CRITICAL)
3. Common Anti-Patterns (CRITICAL)
4. User Interaction (HIGH)
5. Assertions (HIGH)
6. Component Setup (MEDIUM)
7. Test Structure (MEDIUM)
8. Debugging (LOW-MEDIUM)
9. Accessibility Testing (LOW)

How to Use

Read individual reference files for detailed explanations and code examples:

Reference Files

FileDescription
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules

Comments

Markdown supported