Agent skill
test-infrastructure
Enforces project test infrastructure conventions for factories, MSW handlers, mock data, Page Objects, and shared test utilities.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/test-infrastructure
SKILL.md
Test Infrastructure Skill
Purpose
This skill provides test infrastructure conventions for creating reusable testing foundations including factories, MSW handlers, mock data, and Page Object Model classes.
Activation
This skill activates when:
- Creating or modifying files in
tests/fixtures/ - Creating or modifying files in
tests/mocks/ - Creating or modifying files in
tests/helpers/ - Creating or modifying Page Objects in
tests/e2e/pages/ - Creating or modifying E2E helpers in
tests/e2e/helpers/
File Patterns
tests/fixtures/**/*.factory.tstests/mocks/**/*.handlers.tstests/mocks/**/*.mock.tstests/mocks/data/**/*.mock.tstests/e2e/pages/**/*.page.tstests/e2e/helpers/**/*.tstests/helpers/**/*.ts
Workflow
- Detect infrastructure work (file path matches patterns above)
- Load
references/Test-Infrastructure-Conventions.md - Also load
testing-baseskill for shared conventions - Apply infrastructure patterns for the specific type
- Ensure consistent naming and export patterns
Key Patterns (REQUIRED)
Factories
- Async functions returning database entities
- Accept
overridesparameter for customization - Generate unique IDs using timestamps
- Export named factory functions
MSW Handlers
- Use
httpfrom MSW for route handlers - Return
HttpResponse.json()for JSON responses - Export handlers array for server setup
Page Objects
- Extend
BasePageclass - Define abstract
urlproperty - Use
byTestIdhelper for element location
Mock Data
- Export typed mock objects
- Use realistic data patterns
- Include edge case variations
References
references/Test-Infrastructure-Conventions.md- Complete infrastructure 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?