Agent skill
generate-tests
Create test cases for functions and modules. Use when implementing TDD or improving coverage.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/testing/generate-tests-mvillmow-projectodyssey
SKILL.md
Generate Tests
Create comprehensive test cases for functions and modules to ensure correctness and improve code coverage.
When to Use
- Following test-driven development (TDD) approach
- Adding tests to increase coverage
- Testing edge cases and error conditions
- Validating refactoring doesn't break functionality
Quick Reference
# Test generation pattern
def generate_tests(function, test_cases: List[Tuple]):
"""Create test cases for a function"""
for inputs, expected_output in test_cases:
result = function(*inputs)
assert result == expected_output, f"Failed for {inputs}"
# Example: test matrix multiply
test_cases = [
(([[1, 2], [3, 4]], [[1, 0], [0, 1]]), [[1, 2], [3, 4]]), # Identity
(([], []), []), # Empty
]
Workflow
- Analyze function: Understand inputs, outputs, side effects
- Identify test cases: Normal cases, edge cases, error cases
- Write assertions: Create expected output for each case
- Implement tests: Create test functions in test file
- Verify coverage: Check that tests exercise all code paths
Output Format
Test suite:
- Test class/module with clear naming
- Test methods (test_normal_case, test_edge_case, test_error_case)
- Setup/teardown if needed
- Clear assertions with error messages
- Coverage report showing lines tested
References
- See
run-testsskill for executing tests - See
calculate-coverageskill for coverage analysis - See CLAUDE.md > TDD in Key Development Principles
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?