Agent skill
unit-testing
Unit testing patterns and best practices for frontend and backend. Test isolation, mocks, coverage, and structure. Trigger: When writing or reviewing unit tests for any layer.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/unit-testing
SKILL.md
Unit Testing Skill
When to Use
- Writing unit tests for frontend or backend
- Reviewing test coverage and isolation
- Refactoring test structure
Critical Patterns
Frontend
- Use RTL for user-centric tests
- Mock dependencies and hooks
- Test UI logic in isolation
Backend
- Use Jest for logic isolation
- Mock I/O and external services
- Test pure functions and modules
Decision Tree
- UI or logic? → Use RTL or Jest
- Need mocks? → Use jest.mock or manual mocks
- Async code? → Use async/await in tests
Edge Cases
- Flaky async tests
- Mocking native modules
- Coverage gaps
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?