unit-testing-expert
Unit testing expert for Vitest and Jest. Use when writing unit tests, implementing mocking, or setting up test coverage.
Why use this skill?
Master unit testing with our Vitest and Jest expert skill. Generate tests, configure mocks, and implement TDD workflows for reliable, bug-free JavaScript and TypeScript code.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/anton-abyzov/sw-unit-testing-expertWhat This Skill Does
The unit-testing-expert skill provides comprehensive assistance for developers working with Vitest and Jest. It acts as an interactive pair programmer that helps you write robust, maintainable tests for your TypeScript and JavaScript projects. Whether you are adopting a Test-Driven Development (TDD) workflow, debugging complex async logic, or setting up mocking for external dependencies, this skill provides real-time architectural guidance and code generation. It covers the full lifecycle of testing, including unit, integration, and snapshot testing strategies, ensuring your codebase remains reliable and easy to refactor.
Installation
To integrate this skill into your environment, run the following command in your terminal:
clawhub install openclaw/skills/skills/anton-abyzov/sw-unit-testing-expert
Use Cases
- TDD Implementation: Use the agent to guide you through the Red-Green-Refactor cycle for new features.
- Mocking Strategy: Quickly generate mock implementations for databases, API clients, or complex object dependencies using
vi.fn()orvi.mock(). - Refactoring Support: Run tests against legacy code to ensure regression-free refactoring.
- Async Testing: Solve complex challenges with promises, timers, or event loops within your test suite.
- Code Coverage Improvement: Analyze existing test suites to identify untested branches or missing edge cases.
Example Prompts
- "I have a UserService that calls an external API. Can you help me write a Vitest suite that mocks the API response using
vi.mock?" - "I am getting a 'TypeError' in my Jest test when trying to mock a static method. How should I use
vi.spyOnto intercept this call properly?" - "Follow the TDD approach to help me build a simple URL validator function. Start by writing the failing test for the edge case of an empty string."
Tips & Limitations
- Context is Key: Always provide the snippet of the code you are testing so the agent can understand the dependency injection patterns.
- Environment Compatibility: Ensure your project is configured for Vitest or Jest. If you are switching frameworks, let the agent know immediately so it can adapt its syntax suggestions.
- Avoid Over-Mocking: The agent will assist with mocks, but be careful not to mock your entire application logic, which can lead to 'false green' tests that do not actually verify system behavior.
- Isolation: Remember that each test file should be independent. If your tests share state, the agent can help you set up
beforeEachhooks to reset mocks and cleanup variables between runs.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-anton-abyzov-sw-unit-testing-expert": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Related Skills
network-engineer
Cloud network architect for VPC design, service mesh, zero-trust networking, load balancers, and CDN optimization. Use for network troubleshooting or connectivity issues.
jira-multi-project-mapper
Expert in mapping SpecWeave specs to multiple JIRA projects with intelligent project detection and cross-project coordination. Use when syncing to multiple JIRA projects (project-per-team, component-based), or managing bidirectional sync across team boundaries.
helm-chart-scaffolding
Design, organize, and manage Helm charts for templating and packaging Kubernetes applications with reusable configurations. Use when creating Helm charts, packaging Kubernetes applications, or implementing templated deployments.
performance-optimization
React Native performance with Hermes V1, FlashList, expo-image v2, concurrent rendering. Use for slow app, memory leaks, or FPS issues.
release-strategy-advisor
Release strategy advisor - detects brownfield patterns (tags, CI/CD, changelogs), recommends versioning strategy based on architecture. Creates release-strategy.md.