agent-creator
Use when creating expert agents. Generates agent.md with frontmatter, hooks, required sections, and skill references.
Testing Library for React 19 - render, screen, userEvent, waitFor, Suspense. Use when writing tests for React components with Vitest.
$ npx -y skills add fusengine/agents --skill react-testing --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/react-testingContext preview
The summary Claude sees to decide when to auto-load this skill.
Testing Library for React 19 - render, screen, userEvent, waitFor, Suspense. Use when writing tests for React components with Vitest.
name: react-testing description: Testing Library for React 19 - render, screen, userEvent, waitFor, Suspense. Use when writing tests for React components with Vitest. versions: "@testing-library/react": 16.1.0 "@testing-library/user-event": 14.5.2 vitest: 2.1.8 msw: 2.7.0 react: 19 user-invocable: true references: references/installation.md, references/queries.md, references/user-events.md, references/async-testing.md, references/msw-setup.md, references/react-19-hooks.md, references/accessibility-testing.md, references/hooks-testing.md, references/vitest-config.md, references/mocking-patterns.md, references/templates/basic-setup.md, references/templates/component-basic.md, references/templates/component-async.md, references/templates/form-testing.md, references/templates/hook-basic.md, references/templates/api-integration.md, references/templates/suspense-testing.md, references/templates/error-boundary.md, references/templates/accessibility-audit.md related-skills: react-19, solid-react, react-state, react-forms
<objective> Tests React 19 components with Testing Library and Vitest: user-centric queries prioritized by accessibility (`getByRole` first, `getByTestId` last resort), `userEvent` for realistic interactions (never `fireEvent`), `findBy`/`waitFor` for async assertions (never `setTimeout`), and MSW for API mocking (never direct fetch mocking).
Also covers testing React 19 features (`useActionState`, `use()`), custom hooks, Suspense boundaries, error boundaries, and accessibility audits with axe-core. Provides Vitest configuration and 9 ready-to-copy test templates. This is a testing-methodology skill layered on top of the React skills (react-19, react-state, react-forms) — it doesn't teach those APIs themselves, only how to test components that use them. </objective>
Test React components the way users interact with them.
Before ANY implementation, spawn 3 agents in parallel, one `Agent` call each with a `name`:
1. **fuse-ai-pilot:explore-codebase** - Analyze existing test patterns 2. **fuse-ai-pilot:research-expert** - Verify latest Testing Library docs via Context7/Exa 3. **mcp__context7__query-docs** - Check userEvent, waitFor patterns
After implementation, run **fuse-ai-pilot:sniper** for validation.
---
| Feature | Benefit | |---------|---------| | User-centric | Tests what users see | | Accessible queries | Encourages a11y markup | | No implementation details | Resilient to refactoring | | Vitest integration | 10-20x faster than Jest |
---
1. **Query by role first** - `getByRole` is most accessible 2. **Use userEvent, not fireEvent** - Realistic interactions 3. **waitFor for async** - Never `setTimeout` 4. **MSW for API mocking** - Don't mock fetch 5. **Test behavior, not implementation** - No internal state testing
---
| Topic | Reference | |-------|-----------| | Setup & installation | `references/installation.md` | | Query priority | `references/queries.md` | | User interactions | `references/user-events.md` | | Async patterns | `references/async-testing.md` | | API mocking | `references/msw-setup.md` | | React 19 hooks | `references/react-19-hooks.md` | | Accessibility | `references/accessibility-testing.md` | | Custom hooks | `references/hooks-testing.md` | | Vitest config | `references/vitest-config.md` | | Mocking patterns | `references/mocking-patterns.md` |
| Template | Use Case | |----------|----------| | `templates/basic-setup.md` | Vitest + RTL + MSW config | | `templates/component-basic.md` | Simple component tests | | `templates/component-async.md` | Loading/error/success | | `templates/form-testing.md` | Forms + useActionState | | `templates/hook-basic.md` | Custom hook tests | | `templates/api-integration.md` | MSW integration tests | | `templates/suspense-testing.md` | Suspense + use() | | `templates/error-boundary.md` | Error boundary tests | | `templates/accessibility-audit.md` | axe-core a11y audit |
---
| Pattern | Reason | Alternative | |---------|--------|-------------| | `fireEvent` | Not realistic | `userEvent` | | `setTimeout` | Flaky | `waitFor`, `findBy` | | `getByTestId` first | Not accessible | `getByRole` | | Direct fetch mocking | Hard to maintain | MSW | | Empty `waitFor` | No assertion | Add `expect()` |
---
npm install -D vitest @testing-library/react \ @testing-library/user-event @testing-library/jest-dom \ jsdom msw
→ See `templates/basic-setup.md` for complete configuration
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
test('button click works', async () => {
const user = userEvent.setup()
render(<Button onClick={fn}>Click</Button>)
await user.click(screen.getByRole('button'))
expect(fn).toHaveBeenCalled()
})→ See `templates/component-basic.md` for more examples
---
1. `getByRole` - Buttons, headings, inputs 2. `getByLabelText` - Form inputs 3. `getByText` - Static text 4. `getByTestId` - Last resort
// Preferred: findBy
await screen.findByText('Loaded')
// Alternative: waitFor
await waitFor(() => expect(...).toBeInTheDocument())→ See `templates/component-async.md`
const user = userEvent.setup() await user.click(button) await user.type(input, 'text')
→ See `references/user-events.md`
A plugin ecosystem that turns Claude Code into a supervised, multi-agent development environment.
Repo: fusengine/agents
Use when creating expert agents. Generates agent.md with frontmatter, hooks, required sections, and skill references.
Use when starting ANY development task -- feature, bug fix, refactor, hotfix (triggers: implement, create, build, fix, add feature, refactor, develop).
Use when creating a feature/component or adding functionality. Fires BEFORE APEX Analyze to refine requirements via structured questioning.
Use before a root-cause, done/verified claim, irreversible action, or 2nd-time fix reaches the owner (APEX or plain conversation); also fires at every…
Use when validating code quality after modifications -- SOLID compliance, DRY duplication, linter errors, architecture violations. Do NOT use for functional…
Use when an expert agent self-reviews and self-corrects code after the Execute phase, before sniper validation (BMAD-METHOD elicitation techniques).