Agent skill

react-testing-library

React Testing Library patterns and best practices. User-centric testing, queries, events, and assertions. Trigger: When testing React components with RTL.

Stars 163
Forks 31

Install this agent skill to your Project

npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/react-testing-library

SKILL.md

React Testing Library Skill

When to Use

  • Testing React components
  • Simulating user interactions
  • Writing maintainable tests

Critical Patterns

  • Use screen and queries
  • Prefer user-event over fireEvent
  • Test from user perspective

Decision Tree

  • Render or shallow? → Always render
  • Need async? → Use findBy*
  • Accessibility? → Use role/label queries

Edge Cases

  • Portal/modal testing
  • Async UI updates
  • Custom hook testing

Expand your agent's capabilities with these related and highly-rated skills.

Didn't find tool you were looking for?

Be as detailed as possible for better results