test-generator

test-generator is a skill for Claude Code from benshapyro/cadre-devkit-claude. It costs 53 tokens per session (1,660 once invoked), scanned A, original, MIT.

A test-writing guide for Jest, a JavaScript and TypeScript test framework, or Pytest, a Python test framework. It describes how to organize tests, check errors and edge cases, and structure each test.

In plain words
What is it for?
Use it when adding unit tests, test cases, mocks, fixtures, assertions, or coverage for JavaScript, TypeScript, or Python code.
Why use it?
It gives agent-written tests a consistent structure and reminds you to cover invalid inputs and boundary conditions, not just successful cases.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is jest.mock('../api/client');.

Part of the cadre-devkit-claude plugin — 10 skills, 10 commands, 7 agents, 3 hooks shipped together

Good fit Use it when adding unit tests, test cases, mocks, fixtures, assertions, or coverage for JavaScript, TypeScript, or Python code.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/benshapyro/cadre-devkit-claude
agentmods
npx agentmods add skills/benshapyro/cadre-devkit-claude/test-generator

Made for: Claude Code.

Or install cadre-devkit-claude, the plugin that ships this one along with the rest of its 10 skills, 10 commands, 7 agents, 3 hooks.

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 test-generator

README.md
[![agentmods](https://agentmods.dev/badge/skills/benshapyro/cadre-devkit-claude/test-generator.svg)](https://agentmods.dev/skills/benshapyro/cadre-devkit-claude/test-generator)
Your own site
<a href="https://agentmods.dev/skills/benshapyro/cadre-devkit-claude/test-generator"><img src="https://agentmods.dev/badge/skills/benshapyro/cadre-devkit-claude/test-generator.svg" alt="Measured on agentmods" height="20"></a>
Per session 53 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,660 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.
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.00053 $0.01660
Opus 5 $0.00026 $0.00830
Sonnet 5 $0.00011 $0.00332
Haiku 4.5 $0.00005 $0.00166

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

Security

Grade A, and why

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 7d 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.

skills/test-generator/SKILL.md · 299 lines

How it starts

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

Test Generator Skill

Generate high-quality tests using Jest (JavaScript/TypeScript) or Pytest (Python) following established best practices.

Test Frameworks

  • JavaScript/TypeScript: Jest
  • Python: Pytest

Test Directory Structure

  • Place tests in __tests__/ or tests/ directories
  • Mirror source structure in test directories
  • Use clear, descriptive test file names

JavaScript/TypeScript:

src/
  utils/
    validator.ts
__tests__/
  utils/
    validator.test.ts

Python:

src/
  utils/
    validator.py
tests/
  utils/
    test_validator.py

Test Writing Standards

Coverage Requirements

  • Include at least one negative test per feature
  • Test edge cases and boundary conditions
  • Aim for high coverage but prioritize quality over quantity

Test Structure

Follow the Arrange-Act-Assert pattern:

// Jest example
describe('functionName', () => {
  it('should handle valid input correctly', () => {
    // Arrange
    const input = 'valid';

    // Act
    const result = functionName(input);

    // Assert
    expect(result).toBe(expected);
  });

  it('should throw error for invalid input', () => {
    // Negative test case
    expect(() => functionName(null)).toThrow();
  });
});
# Pytest example
class TestFunctionName:
    def test_valid_input(self):
        # Arrange
        input_val = 'valid'

        # Act
        result = function_name(input_val)

        # Assert
        assert result == expected

    def test_invalid_input_raises_error(self):
        # Negative test case
        with pytest.raises(ValueError):
            function_name(None)

Test Naming

  • Use descriptive names that explain what's being tested
  • Format: test_<what>_<condition>_<expected_result>
  • Examples:
    • test_user_login_with_valid_credentials_returns_token
    • test_api_call_with_invalid_auth_raises_401

Test Quality Checklist

  • Tests are independent and can run in any order
  • Each test has a single, clear purpose
  • Mock external dependencies (APIs, databases, file systems)
  • Include both positive and negative test cases
  • Test error handling and edge cases
  • Use meaningful assertion messages
  • Tests are fast and deterministic

Read the full file on GitHub · 299 lines

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. 7d ago First seen · 299 lines · 53 tokens per session scan A 80895425e9f3

Subscribe to this mod's changes

test-generator is a skill published in the GitHub repository benshapyro/cadre-devkit-claude (9 stars, last pushed 9mo ago), licensed MIT. It adds 53 tokens to every session and 1,660 once invoked, about $0.0003 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-31.