All skills
Skillintermediate
generate tests
Generate comprehensive unit tests for a specified function, class, or module.
Claude Code Knowledge Pack7/10/2026
Overview
Generate comprehensive unit tests for a specified function, class, or module.
Steps
- Read the target function or module to understand its behavior:
- Identify test cases by category:
- Identify dependencies that need mocking:
- Write tests using the project's testing framework:
- Add setup and teardown for shared test state.
- Run the tests to verify they pass.
- Check coverage: does the new test cover all branches?
Format
Target: <function/class name>
Tests Generated: <count>
Coverage: <lines/branches covered>
Framework: <jest|pytest|cargo test|etc>
Rules
- Follow the existing test conventions in the project.
- Test behavior, not implementation details.
- Mock external dependencies, never make real network calls.