Agent Skills
› shinpr/claude-code-workflows
› test-implement
test-implement
GitHub指导如何编写单元测试、集成测试及E2E测试。涵盖React组件测试(RTL+Vitest+MSW)和Playwright E2E测试,遵循AAA结构、独立性及规范命名原则。
Trigger Scenarios
需要实现单元测试时
需要实现集成测试时
需要实现E2E测试时
进行React组件测试时
使用Playwright进行浏览器级测试时
Install
npx skills add shinpr/claude-code-workflows --skill test-implement -g -y
SKILL.md
Frontmatter
{
"name": "test-implement",
"description": "Test implementation patterns and conventions. Use when implementing unit tests, integration tests, or E2E tests, including RTL+Vitest+MSW component testing and Playwright E2E testing."
}
Test Implementation Patterns
Reference Selection
| Test Type | Reference | When to Use |
|---|---|---|
| Unit / Integration | references/frontend.md | Implementing React component tests with RTL + Vitest + MSW |
| E2E | references/e2e.md | Implementing browser-level E2E tests with Playwright |
Common Principles
AAA Structure
All tests follow Arrange-Act-Assert:
- Arrange: Set up preconditions and inputs
- Act: Execute the behavior under test
- Assert: Verify the expected outcome
Test Independence
- Each test runs independently without depending on other tests
- No shared mutable state between tests
- Deterministic execution — no random or time dependencies without mocking
Naming
- Test names describe expected behavior from user perspective
- One test verifies one behavior
Version History
- 66e3b29 Current 2026-07-05 12:02


