Agent skill
component-testing
Enforces project React component testing conventions using Testing Library with proper rendering, user interactions, and accessibility testing.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/component-testing-jasonpaff-head-shakers
SKILL.md
Component Testing Skill
Purpose
This skill provides React component testing conventions using Testing Library. Component tests verify rendering, user interactions, and accessibility of React components.
Activation
This skill activates when:
- Creating or modifying files in
tests/components/ - Testing React components (
.tsxfiles) - Working with Testing Library
- Testing user interactions with
userEvent
File Patterns
tests/components/**/*.test.tsx
Workflow
- Detect component test work (file path contains
tests/components/) - Load
references/Component-Testing-Conventions.md - Also load
testing-baseskill for shared conventions - Apply component test patterns with Testing Library
- Ensure accessibility-first query usage
Key Patterns (REQUIRED)
Custom Render
- ALWAYS use
customRenderfromtests/setup/test-utils.tsx - Returns
{ user, ...renderResult }with pre-configured userEvent - Includes all providers (theme, clerk, etc.)
Testing Library Queries
- Prefer
getByRolefor accessibility - Use
getByTestIdwith namespace pattern (ui-, feature-, form-*) - Use
getByText,getByLabelTextfor content - Use
queryBy*for assertions on missing elements
User Interactions
- Use
userfrom customRender return (pre-configured userEvent) - Always
awaituser interactions - Test real user behaviors, not implementation details
Pre-Mocked Dependencies
- Clerk, Next.js navigation, sonner, next-themes are pre-mocked
- Mock server actions with
vi.mock()
References
references/Component-Testing-Conventions.md- Complete component testing conventions
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?