Skip to content
OpenSmartRoute
Skillv1.0.0

react-testing-library

React Testing Library mechanics for testing React components and hooks — query selection, async handling, user interaction, assertions, provider setup, and the anti-patterns that make tests brittle. U

by shipshitdev(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from shipshitdev/skills (skills/react-testing-library/SKILL.md). Install upstream with npx skills add shipshitdev/skills --skill react-testing-library. Copyright stays with the author.

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

Priority Category Impact Prefix
1 Query Selection CRITICAL query-
2 Async Handling CRITICAL async-
3 Common Anti-Patterns CRITICAL anti-
4 User Interaction HIGH user-
5 Assertions HIGH assert-
6 Component Setup MEDIUM setup-
7 Test Structure MEDIUM struct-
8 Debugging LOW-MEDIUM debug-
9 Accessibility Testing LOW a11y-

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

File Description
references/_sections.md Category definitions and ordering
assets/templates/_template.md Template for new rules

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/shipshitdev-skills-react-testing-library/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

shipshitdev-skills-react-testing-library.ocm.jsonjson
{
  "ocm": "1",
  "id": "shipshitdev-skills-react-testing-library",
  "kind": "skill",
  "name": "react-testing-library",
  "description": "React Testing Library mechanics for testing React components and hooks — query selection, async handling, user interaction, assertions, provider setup, and the anti-patterns that make tests brittle. Use for any test that renders a React component or a hook, including choosing between getBy/queryBy/findBy, userEvent flows, waitFor usage, renderHook, custom render wrappers, and reviewing RTL tests for implementation-detail assertions.",
  "publisher": "shipshitdev",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding",
      "data_analysis"
    ],
    "tags": [
      "skill-md",
      "react",
      "testing",
      "rtl",
      "components",
      "hooks",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "React Testing Library mechanics for testing React components and hooks — query selection, async handling, user interaction, assertions, provider setup, and the anti-patterns that make tests brittle. Use for any test that renders a React component or a hook, including choosing between getBy/queryBy/findBy, userEvent flows, waitFor usage, renderHook, custom render wrappers, and reviewing RTL tests for implementation-detail assertions."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/shipshitdev/skills",
      "path": "skills/react-testing-library/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/shipshitdev/skills/blob/HEAD/skills/react-testing-library/SKILL.md",
      "key": "shipshitdev/skills/skills/react-testing-library/SKILL.md"
    }
  },
  "instructions": "# React Testing Library Best Practices\n\n43 rules across 9 categories for testing React components with Testing Library, prioritized by impact to guide test writing and code review.\n\n## Scope\n\nThis skill owns React component and hook testing mechanics. For\nframework-agnostic questions — which level a behavior belongs at, what a coverage\nnumber means, how to choose test data, how to kill a flake — use\n`testing-expert`.\n\n## When to Apply\n\n- Writing new component tests with React Testing Library\n- Selecting queries (getByRole, getByLabelText, etc.)\n- Handling async operations in tests (findBy, wai",
  "cost": {
    "context_tokens": 1599
  }
}

Fetch it by URL: GET /api/v1/registry/shipshitdev-skills-react-testing-library/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.