unit-test-generator
Skill37 starsChanged 13 months agoApache-2.0View on GitHub
Generates comprehensive unit tests for functions and classes in multiple languages
3 other projects use a version of this.
Adopted by
Most recently taken up by
- cvsz/zomegatheir own version, first seen Sep 2, 2026
- wangbinquan/skillstheir own version, first seen Apr 26, 2026
- santosomar/general-secure-coding-agent-skillstheir own version, first seen Mar 10, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- wangbinquan/skills★ 2same name
- cvsz/zomega★ 1same name
- santosomar/general-secure-coding-agent-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository22 other files it gives its agents.
- backend-architectSkill
- data-engineerSkill
- devops-specialistSkill
- frontend-specialistSkill
- qa-engineerSkill
- changelog-generatorSkill
- git-hooks-managerSkill
- workflow-composerSkill
- code-migratorSkill
- performance-optimizerSkill
- cicd-pipeline-builderSkill
- deployment-managerSkill
- docker-wizardSkill
- environment-managerSkill
- k8s-generatorSkill
- pr-reviewerSkill
- readme-generatorSkill
- tech-writerSkill
- aident-skillSkill
- api-connectorSkill
- database-querySkill
- security-scannerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 13 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 30
When asked to generate tests:
- Distinctive: line 33
Use Read to examine the source file
- Distinctive: line 126
Follow AAA pattern (Arrange, Act, Assert)
- Distinctive: line 198
Read the class definition
- Distinctive: line 202
Create comprehensive test suite
- Distinctive: line 208
Write: Create test files
- Distinctive: line 209
Bash: Run tests to verify they work (optional)
- Distinctive: line 221
When using this skill:
- Distinctive: line 223
Start with one function: Don't try to test entire file at once
- Distinctive: line 224
Review generated tests: Ensure they make sense for your use case
- Distinctive: line 226
Run the tests: Verify they pass before committing
- Distinctive: line 227
Maintain test quality: Keep tests updated as code changes
- Distinctive: line 233
No clear test path: Ask user for expected behavior
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Unit Test Generator
Automatically generates comprehensive unit tests for your code, supporting multiple programming languages and testing frameworks.
What This Skill Does
This skill creates high-quality unit tests by:
- Analyzing function/method signatures and logic
- Generating test cases for happy paths
- Creating edge case tests
- Adding error condition tests
- Following language-specific best practices
- Using appropriate testing frameworks
- Including setup/teardown when needed
Instructions
1. Code Analysis
When asked to generate tests:
- Identify target code:
- Use Read to examine the source file
- Parse function/class signatures
- Understand parameters, return types, and dependencies
- Detect language and framework:
- Python: pytest, unittest
- JavaScript/TypeScript: Jest, Mocha, Vitest
- Go: testing package
- Rust: built-in test framework
- Java: JUnit
- Analyze logic:
- Identify all code paths
- Find conditionals and branches
- Locate error handling
- Determine edge cases
2. Test Generation Strategy
Create tests covering:
Happy Path Tests:
- Normal input → expected output
- Valid use cases
- Common scenarios
Edge Cases:
- Empty inputs
- Boundary values (min, max)
- Special characters
- Large datasets
- Zero/null values
Error Conditions:
- Invalid inputs
- Type mismatches
- Missing required parameters
- Exception scenarios
Integration Points:
- Mock external dependencies
- Stub API calls
- Fake database interactions
3. Test Structure
Follow framework-specific conventions:
Python (pytest):
import pytest
from module import function_to_test
class TestFunctionName:
def test_happy_path(self):
# Arrange
input_data = "valid input"
# Act
result = function_to_test(input_data)
# Assert
assert result == expected_value
def test_edge_case_empty_input(self):
with pytest.raises(ValueError):
function_to_test("")JavaScript (Jest):
describe('functionName', () => {
test('should handle valid input', () => {
// Arrange
const input = 'test';
// Act
const result = functionName(input);
// Assert
expect(result).toBe(expected);
});
test('should throw error on invalid input', () => {
expect(() => functionName(null)).toThrow();
});
});4. Test Quality
Ensure generated tests:
- Have descriptive names (test_should_do_x_when_y)
- Follow AAA pattern (Arrange, Act, Assert)
- Are independent and isolated
- Run deterministically
- Have clear assertions
- Include comments explaining complex scenarios
5. Output
Present the generated tests and:
- Explain coverage achieved
- Note any uncovered scenarios
- Suggest where to place test file
- Offer to write tests to appropriate test directory
Examples
Example 1: Python Function
User Request: "Generate tests for the calculate_discount function"
Source Code:
def calculate_discount(price: float, discount_percent: int) -> float:
if discount_percent < 0 or discount_percent > 100:
raise ValueError("Discount must be between 0 and 100")
return price * (1 - discount_percent / 100)Generated Tests:
import pytest
from shopping import calculate_discount
class TestCalculateDiscount:
def test_valid_discount(self):
"""Test normal discount calculation"""
result = calculate_discount(100.0, 20)
assert result == 80.0
def test_zero_discount(self):
"""Test with no discount"""
result = calculate_discount(100.0, 0)
assert result == 100.0
def test_full_discount(self):
"""Test with 100% discount"""
result = calculate_discount(100.0, 100)
assert result == 0.0
def test_negative_discount_raises_error(self):
"""Test that negative discount raises ValueError"""
with pytest.raises(ValueError, match="between 0 and 100"):
calculate_discount(100.0, -10)
def test_discount_over_100_raises_error(self):
"""Test that discount > 100 raises ValueError"""
with pytest.raises(ValueError, match="between 0 and 100"):
calculate_discount(100.0, 150)
def test_zero_price(self):
"""Test with price of 0"""
result = calculate_discount(0.0, 50)
assert result == 0.0Example 2: JavaScript Class
User Request: "Create unit tests for the UserValidator class"
Generated Approach:
- Read the class definition
- Identify all methods
- Generate tests for each method
- Mock dependencies (if any)
- Create comprehensive test suite
Tool Requirements
- Read: Examine source code files
- Grep: Find existing tests, check coverage
- Write: Create test files
- Bash: Run tests to verify they work (optional)
Limitations
- Cannot test private implementation details (by design)
- May not cover all business logic edge cases without context
- Generated tests should be reviewed and customized
- Cannot generate integration/E2E tests (use specific skills for those)
- Works best with pure functions and well-structured code
Best Practices
When using this skill:
- Start with one function: Don't try to test entire file at once
- Review generated tests: Ensure they make sense for your use case
- Add domain knowledge: Include business-specific edge cases
- Run the tests: Verify they pass before committing
- Maintain test quality: Keep tests updated as code changes
Error Handling
- Complex code: Break down into smaller testable units first
- Heavy dependencies: Suggest refactoring for testability
- No clear test path: Ask user for expected behavior
- Existing tests found: Offer to extend rather than replace
Configuration
Adapts to detected setup:
| Language | Framework | Test File Location |
| Python | pytest | tests/test_*.py |
| Python | unittest | tests/test_*.py |
| JavaScript | Jest | __tests__/*.test.js |
| TypeScript | Jest | __tests__/*.test.ts |
| Go | testing | *_test.go (same dir) |
| Rust | built-in | tests/ or inline |
Related Skills
- tdd-workflow - Test-driven development process
- coverage-analyzer - Analyze test coverage
- test-refactorer - Improve existing tests
Changelog
Version 1.0.0 (2025-01-13)
- Initial release
- Support for Python, JavaScript, TypeScript
- pytest and Jest framework support
- AAA pattern enforcement
- Edge case generation
Contributing
Want to add support for a new language or framework?
- Open an issue with the language/framework name
- Submit a PR with examples
- Follow Contributing Guidelines
License
Apache License 2.0 - See LICENSE
Author
GLINCKER Team
- GitHub: @GLINCKER
- Repository: claude-code-marketplace
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

