Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Automatically generate unit tests based on source code, supporting multiple languages and testing frameworks.
.claude/skills/bilal140202-unit-test-generator/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 5% | 0% |
| case-02 | ✗→✓ | ▲ Improved | -6% | 0% |
| case-03 | ✗→✓ | ▲ Improved | -4% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 13% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 6% | 0% |
> 根据源代码自动生成单元测试,支持多种语言和测试框架。 > > Automatically generate unit tests based on source code, supporting multiple languages and testing frameworks.
当用户请求以下操作时使用此 skill:
| 语言 | 测试框架 | |------|----------| | Python | pytest, unittest | | JavaScript/TypeScript | Jest, Mocha, Vitest | | Java | JUnit, TestNG | | Go | testing (built-in) | | Rust | cargo test (built-in) |
使用 templates/test-report.md 模板格式化输出。
Use the templates/test-report.md template to format output.
markdown## 单元测试生成报告 / Unit Test Generation Report ### 分析概述 / Analysis Summary [代码分析总结] ### 生成的测试 / Generated Tests [测试代码] ### 测试覆盖说明 / Coverage Notes - 覆盖的场景 - 建议补充的测试
pythondef divide(a: float, b: float) -> float: if b == 0: raise ValueError("Cannot divide by zero") return a / b
divide 函数执行除法运算,包含除零检查。需要测试正常除法、除零异常、边界值等情况。
pythonimport pytest from your_module import divide class TestDivide: """Tests for the divide function.""" def test_divide_positive_numbers(self): """Test division of positive numbers.""" assert divide(10, 2) == 5.0 assert divide(7, 2) == 3.5 def test_divide_negative_numbers(self): """Test division with negative numbers.""" assert divide(-10, 2) == -5.0 assert divide(10, -2) == -5.0 assert divide(-10, -2) == 5.0 def test_divide_by_zero_raises_error(self): """Test that dividing by zero raises ValueError.""" with pytest.raises(ValueError, match="Cannot divide by zero"): divide(10, 0) def test_divide_zero_numerator(self): """Test division when numerator is zero.""" assert divide(0, 5) == 0.0 def test_divide_float_precision(self): """Test division with floating point numbers.""" assert divide(1, 3) == pytest.approx(0.333333, rel=1e-5)
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 16,070 | 13,862 | -14% | 1 | 1 | 0% | 3,755 | 3,948 | +5% | 0 | 0 | — |
case-02 | fail→pass | 19,086 | 17,154 | -10% | 1 | 1 | 0% | 4,777 | 4,484 | -6% | 0 | 0 | — |
case-03 | fail→pass | 17,400 | 14,454 | -17% | 1 | 1 | 0% | 3,934 | 3,784 | -4% | 0 | 0 | — |
case-04 | fail→pass | 11,598 | 8,292 | -29% | 1 | 1 | 0% | 2,546 | 2,888 | +13% | 0 | 0 | — |
case-05 | fail→pass | 14,948 | 9,503 | -36% | 1 | 1 | 0% | 3,040 | 3,227 | +6% | 0 | 0 | — |
case-06 | fail→pass | 11,475 | 8,584 | -25% | 1 | 1 | 0% | 2,617 | 2,715 | +4% | 0 | 0 | — |
case-07 | fail→pass | 13,436 | 9,229 | -31% | 1 | 1 | 0% | 2,813 | 2,750 | -2% | 0 | 0 | — |
case-08 | fail→pass | 14,349 | 9,150 | -36% | 1 | 1 | 0% | 3,174 | 2,893 | -9% | 0 | 0 | — |
case-09 | fail→pass | 12,285 | 7,919 | -36% | 1 | 1 | 0% | 2,928 | 2,509 | -14% | 0 | 0 | — |
case-10 | fail→pass | 13,699 | 10,390 | -24% | 1 | 1 | 0% | 3,593 | 3,250 | -10% | 0 | 0 | — |
case-11 | fail→pass | 9,345 | 7,163 | -23% | 1 | 1 | 0% | 2,028 | 2,428 | +20% | 0 | 0 | — |
case-12 | pass→pass | 12,515 | 9,290 | -26% | 1 | 1 | 0% | 3,002 | 3,055 | +2% | 0 | 0 | — |
case-13 | fail→pass | 15,937 | 8,509 | -47% | 1 | 1 | 0% | 3,310 | 2,620 | -21% | 0 | 0 | — |
case-14 | pass→pass | 12,045 | 9,187 | -24% | 1 | 1 | 0% | 2,800 | 3,289 | +17% | 0 | 0 | — |
case-15 | pass→pass | 17,878 | 9,784 | -45% | 1 | 1 | 0% | 3,914 | 2,728 | -30% | 0 | 0 | — |
case-16 | pass→pass | 12,761 | 6,674 | -48% | 1 | 1 | 0% | 2,645 | 2,340 | -12% | 0 | 0 | — |
case-17 | pass→pass | 14,049 | 9,244 | -34% | 1 | 1 | 0% | 2,811 | 2,718 | -3% | 0 | 0 | — |
case-18 | pass→pass | 13,608 | 8,240 | -39% | 1 | 1 | 0% | 2,836 | 2,557 | -10% | 0 | 0 | — |
case-19 | pass→pass | 12,546 | 7,574 | -40% | 1 | 1 | 0% | 2,737 | 2,464 | -10% | 0 | 0 | — |
case-20 | pass→pass | 2,869 | 5,710 | +99% | 1 | 1 | 0% | 827 | 2,094 | +153% | 0 | 0 | — |
case-21 | pass→fail | 12,998 | 14,667 | +13% | 1 | 1 | 0% | 2,811 | 4,070 | +45% | 0 | 0 | — |
case-22 | pass→fail | 7,339 | 11,454 | +56% | 1 | 1 | 0% | 1,552 | 3,461 | +123% | 0 | 0 | — |
case-23 | pass→pass | 13,588 | 15,809 | +16% | 1 | 1 | 0% | 3,178 | 4,139 | +30% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +43 percentage points is the difference between those two pass rates over the 23 comparable cases. 2 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.