Agent Skills
› shinpr/claude-code-workflows
› test-implement
test-implement
GitHub指导实现React/TypeScript的前端测试,涵盖单元、集成及E2E测试。遵循AAA结构、独立性及用户视角命名原则,依据类型引用对应文档,利用仓库配置的运行器和Mock环境完成测试骨架生成与实现。
触发场景
创建前端单元测试或集成测试
实现浏览器级E2E测试
补全生成的测试骨架代码
安装
npx skills add shinpr/claude-code-workflows --skill test-implement -g -y
SKILL.md
Frontmatter
{
"name": "test-implement",
"description": "Implements React\/TypeScript unit, integration, and browser E2E tests with the repository's configured runner, mocks, setup, and browser harness. Use when creating or completing frontend tests and generated test skeletons."
}
Test Implementation Patterns
Reference Selection
| Test Type | Reference | When to Use |
|---|---|---|
| Unit / Integration | references/frontend.md | Implementing React component tests with the repository's configured runner and network mocking layer |
| E2E | references/e2e.md | Implementing browser-level E2E tests in the existing harness, or Playwright when the approved work introduces a harness |
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
版本历史
-
56ab6c1
当前 2026-07-19 22:42
优化技能指南使其更贴合具体项目上下文(project-aware),并调整了关于测试运行器和模拟层的描述以增强通用性。
- 66e3b29 2026-07-05 11:58


