unit-test-generator

unit-test-generator is a skill for Claude Code, Codex from JackyST0/awesome-agent-skills. It costs 20 tokens per session (897 once invoked), scanned A, original, CC0-1.0.

A tool that creates unit tests—small automated checks for individual functions or classes—from existing source code. It supports Python, JavaScript, TypeScript, Java, Go, and Rust with common testing frameworks.

In plain words
What is it for?
It helps developers create tests for functions and classes, expand test coverage, and produce a report containing the generated test code and coverage notes.
Why use it?
It reduces the time needed to identify normal cases, edge cases, empty inputs, and error handling that should be tested. It also explains which situations the generated tests cover and what may still be missing.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps developers create tests for functions and classes, expand test coverage, and produce a report containing the generated test code and coverage notes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jackyst0/awesome-agent-skills/unit-test-generator
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add JackyST0/awesome-agent-skills --skill unit-test-generator
Clone the repo
git clone --depth 1 https://github.com/JackyST0/awesome-agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for unit-test-generator

README.md
[![agentmods](https://agentmods.dev/badge/skills/jackyst0/awesome-agent-skills/unit-test-generator/github.svg)](https://agentmods.dev/skills/jackyst0/awesome-agent-skills/unit-test-generator)
Your own site
<a href="https://agentmods.dev/skills/jackyst0/awesome-agent-skills/unit-test-generator"><img src="https://agentmods.dev/badge/skills/jackyst0/awesome-agent-skills/unit-test-generator/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for unit-test-generator

Your own site · 80×15
<a href="https://agentmods.dev/skills/jackyst0/awesome-agent-skills/unit-test-generator"><img src="https://agentmods.dev/badge/skills/jackyst0/awesome-agent-skills/unit-test-generator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 20 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 897 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00020 $0.00897
Opus 5 $0.00010 $0.00449
Sonnet 5 $0.00004 $0.00179
Haiku 4.5 $0.00002 $0.00090

Measured 10d ago against content hash e4a47f93cf61, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

unit-test-generator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

examples/unit-test-generator/SKILL.md · 126 lines

How it starts

The opening of the file, as written. The whole thing — 126 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Unit Test Generator

根据源代码自动生成单元测试,支持多种语言和测试框架。

Automatically generate unit tests based on source code, supporting multiple languages and testing frameworks.

When to Use

当用户请求以下操作时使用此 skill:

  • 生成单元测试 / Generate unit tests
  • 为函数/类编写测试 / Write tests for functions/classes
  • 创建测试用例 / Create test cases
  • 提高代码覆盖率 / Improve code coverage

Instructions

分析步骤 / Analysis Steps

  1. 识别代码 - 确定编程语言和代码结构
  2. 分析功能 - 理解函数/方法的输入、输出和行为
  3. 确定边界 - 识别边界条件和边缘情况
  4. 选择框架 - 根据语言选择合适的测试框架
  5. 生成测试 - 编写全面的测试用例

支持的语言和框架 / Supported Languages

语言 测试框架
Python pytest, unittest
JavaScript/TypeScript Jest, Mocha, Vitest
Java JUnit, TestNG
Go testing (built-in)
Rust cargo test (built-in)

测试类型 / Test Types

  • 正常路径测试 - 验证预期行为
  • 边界条件测试 - 测试边界值
  • 异常处理测试 - 验证错误处理
  • 空值/空输入测试 - 处理空值情况

输出格式 / Output Format

使用 templates/test-report.md 模板格式化输出。

Use the templates/test-report.md template to format output.

## 单元测试生成报告 / Unit Test Generation Report

### 分析概述 / Analysis Summary
[代码分析总结]

### 生成的测试 / Generated Tests
[测试代码]

### 测试覆盖说明 / Coverage Notes
- 覆盖的场景
- 建议补充的测试

Examples

输入 / Input

def divide(a: float, b: float) -> float:
    if b == 0:
        raise ValueError("Cannot divide by zero")
    return a / b

输出 / Output

单元测试生成报告

分析概述

divide 函数执行除法运算,包含除零检查。需要测试正常除法、除零异常、边界值等情况。

生成的测试

import 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)

Read the full file on GitHub · 126 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 126 lines · 20 tokens per session scan A e4a47f93cf61

Subscribe to this mod's changes

unit-test-generator is a skill published in the GitHub repository JackyST0/awesome-agent-skills (633 stars, last pushed yesterday), licensed CC0-1.0. It adds 20 tokens to every session and 897 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

go-testing

Trigger: Go tests, go test coverage, Bubbletea teatest, golden files. Apply focused Go testing patterns.

Gentleman-Programming/gentle-ai · 26 tokens

testing

To write thorough, isolated, idempotent tests — 80%+ coverage, external-only mocking, scenario-driven.

griddynamics/rosetta · 26 tokens

coverage

Compute code coverage for active track or module. Targets 95%+ coverage with report and justification for uncovered lines. Complements TDD workflow.

drafthq/draft · 31 tokens

code-testing-agent

Generates and writes new unit tests for any programming language using a Research-Plan-Implement pipeline. Use when asked to generate tests, write unit tests, add tests, improve test coverage, create test project, achieve high coverage, comprehensive tests, or asked to scaffold a new test project for an app, service…

aboalrejal-ai/skills · 190 tokens

godot-testing-patterns

Expert blueprint for testing patterns using GUT (Godot Unit Test), integration tests, mock/stub patterns, async testing, and validation techniques. Covers assert patterns, signal testing, and CI/CD integration. Use when implementing tests OR validating game logic. Keywords GUT, unit test, integration test, assert…

bgrenat/godot-game-dev-studio · 82 tokens

web3-testing

Test smart contracts comprehensively using Hardhat and Foundry with unit tests, integration tests, and mainnet forking. Use when testing Solidity contracts, setting up blockchain test suites, or validating DeFi protocols.

wshobson/agents · 46 tokens