unit-test-starter

unit-test-starter is a skill for Claude Code, Codex from vosslab/vosslab-skills. It costs 50 tokens per session (1,796 once invoked), scanned A, original, MIT.

A starter for Python 3 unit tests using pytest, a Python testing framework. It scans Python files and creates a test module for each source file while following the repository’s testing style.

In plain words
What is it for?
Use it to add deterministic tests for Python functions, including isolated filesystem behavior through pytest’s temporary directories. Complex end-to-end tests belong in a separate tests/e2e/ area.
Why use it?
It gives untested code a maintainable starting point and avoids tests that depend on networks, random values, unstable dates, or fragile output.

Skill for Claude CodeCodex

Written for Claude Code and Codex: shipped in a Claude Code plugin, but also agents/openai.yaml present. Also seen: mentions subagents.

Part of the vosslab-skills plugin — 42 skills, 14 agents shipped together

Good fit Use it to add deterministic tests for Python functions, including isolated filesystem behavior through pytest’s temporary directories. Complex end-to-end tests belong in a separate tests/e2e/ area.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/vosslab/vosslab-skills/unit-test-starter
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 vosslab/vosslab-skills --skill unit-test-starter
Clone the repo
git clone --depth 1 https://github.com/vosslab/vosslab-skills

Made for: Claude Code, Codex.

Or install vosslab-skills, the plugin that ships this one along with the rest of its 42 skills, 14 agents.

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-starter

README.md
[![agentmods](https://agentmods.dev/badge/skills/vosslab/vosslab-skills/unit-test-starter.svg)](https://agentmods.dev/skills/vosslab/vosslab-skills/unit-test-starter)
Your own site
<a href="https://agentmods.dev/skills/vosslab/vosslab-skills/unit-test-starter"><img src="https://agentmods.dev/badge/skills/vosslab/vosslab-skills/unit-test-starter.svg" alt="Measured on agentmods" height="20"></a>
Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,796 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 2 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.00050 $0.01796
Opus 5 $0.00025 $0.00898
Sonnet 5 $0.00010 $0.00359
Haiku 4.5 $0.00005 $0.00180

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

Security

Grade A, and why

unit-test-starter scanned grade A with 2 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 8d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- call network/internet (`requests`, `urllib`, `http.client`, `socket`, etc.)

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

- spawn processes (`subprocess`, `os.system`)
skills/quality/unit-test-starter/SKILL.md · 167 lines

How it starts

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

Unit test starter (Python3 + pytest)

Overview

Generate Python 3 pytest unit tests across a repo, but prefer fewer, durable tests over breadth. Per docs/PYTEST_STYLE.md, delete fragile tests rather than rewriting them, keep individual asserts short, and avoid asserts on dates, collection sizes, required key lists, hardcoded defaults, or function names. Route elaborate end-to-end scenarios to tests/e2e/ instead of packing them into pytest. This skill applies the docs/REPO_STYLE.md "Long-term over short-term" and "Fix the design, not the symptom" philosophies: a fragile test that needs constant rewriting is a design smell, not a maintenance task.

This skill can be slow and may take hours on large repos.

Hard constraints

  • Use tmp_path for filesystem behavior that is part of the function contract. Keep filesystem tests isolated to pytest-managed temporary paths.
  • No network access in tests (no HTTP, sockets, internet APIs).
  • Deterministic tests only (no time/randomness unless fully mocked).
  • Avoid brittle tests that assert unstable logging/printing unless clearly part of the function contract.
  • Avoid fragile assertions on dates, collection sizes, required key lists, hardcoded defaults, function names, or tunable constants.
  • Test files and pytest support files are imported, so they do not get shebangs.

Inputs to request

  • Whether to scan the entire repo or exclude known folders (for example generated code, vendored code, or old/ archives).
  • Whether there are modules that must never be imported during tests (side effects).
  • Any existing pytest config (pytest.ini, pyproject.toml) and whether tests already exist under tests/.

Workflow

  1. Confirm pytest baseline
    • Prefer pytest for Python 3 repos unless the repo clearly uses something else.
    • Check for an existing tests/ folder and any pytest config.
    • If tests/ does not exist, create it.
  2. Determine repo root and discovery command
    • Determine REPO_ROOT with git rev-parse --show-toplevel.
    • Discover Python files with rg --files and iterate in a stable order:
      rg --files -g "*.py" | sort
      
    • Apply reasonable exclusions when needed, for example: .git/, __pycache__/, .venv/, venv/, build/, dist/, node_modules/.
  3. Choose a one-to-one test file mapping
    • Create one pytest file per source file to keep mapping straightforward.
    • Naming rule (repo-relative path to ASCII-safe filename):
      • Source: pkg/sub/mod.py
      • Test: tests/test_pkg__sub__mod.py
    • If a source file is untestable under constraints, still create the test module with a single pytest.skip(..., allow_module_level=True) explaining why.
  4. Make imports work (create tests/conftest.py when needed)
    • Prefer importing modules the same way the repo imports them.
    • If tests cannot import local modules (no installed package, no package layout), create tests/conftest.py to add REPO_ROOT (and optionally tests/) to sys.path:
      """
      Pytest config to ensure local imports work without installation.
      """
      
      from __future__ import annotations
      
      # Standard Library
      import os
      import sys
      
      #============================================
      
      
      REPO_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
      if REPO_ROOT not in sys.path:
      	sys.path.insert(0, REPO_ROOT)
      
      TESTS_DIR = os.path.abspath(os.path.dirname(__file__))
      if TESTS_DIR not in sys.path:
      	sys.path.insert(0, TESTS_DIR)
      
    • Keep conftest.py minimal and repo-wide; do not add per-test hacks.
    • If imports trigger libraries that write caches/config under the user's home directory (for example matplotlib), set environment variables early in conftest.py to redirect them to a temp location (avoid asserting on these side effects in tests; this is only to keep the test environment clean).
  5. For each Python file: decide whether it is safe to import
    • Prefer importable modules over scripts with side effects.
    • If import triggers work (CLI execution, network, file reads, subprocess), avoid importing at module import-time and mark the test module skipped with a reason.
    • When possible, test by importing specific functions/classes from the module rather than executing the script entrypoint.
  6. For each function/method: triage testability
    • Enumerate functions and methods (top-level def, and simple class methods).
    • Skip and document functions that:
      • read/write files through uncontrolled paths or depend on existing machine-specific files
      • call network/internet (requests, urllib, http.client, socket, etc.)
      • spawn processes (subprocess, os.system)
      • depend on real time or randomness and cannot be safely mocked
      • require complex external services or heavyweight frameworks
    • Filesystem functions can be tested when the behavior is clear and all paths are under tmp_path.
  7. Write tests for testable functions (table-driven first)
    • Prefer @pytest.mark.parametrize for input/output grids.
    • Cover, at minimum:
      • 1 to 3 "core" cases (typical inputs)
      • 1 edge case (empty, None, boundary, unusual whitespace, extremes)
      • 1 negative case when the function explicitly rejects inputs or raises
    • Assertions:
      • Use plain assert for values/invariants.
      • Use pytest.raises(ExpectedError) for exceptions.
      • Use match= only when the message is stable and part of the contract.
      • Prefer one or two meaningful assertions per test.
    • Avoid duplicating the full function logic in the test; assert observable results and key branches.
  8. Keep tests deterministic
    • Do not let tests depend on the local machine environment.
    • If the module reads environment variables, use monkeypatch to set them.
    • If a function depends on time.time() or random.*, monkeypatch those calls so results are stable.
  9. Run tests incrementally (long-running allowed)
    • Prefer targeted runs while generating tests:
      source source_me.sh && python -m pytest tests/test_pkg__sub__mod.py
      
    • Expect this process to be long on large repos; keep a simple progress log of: file -> functions tested -> functions skipped (with reasons).
  10. Record changes
  • If files were created or changed, record the change in docs/CHANGELOG.md when the file exists.

Read the full file on GitHub · 167 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. 8d ago First seen · 167 lines · 50 tokens per session scan A 6cd341e99198

Subscribe to this mod's changes

unit-test-starter is a skill published in the GitHub repository vosslab/vosslab-skills (2 stars, last pushed 12d ago), licensed MIT. It adds 50 tokens to every session and 1,796 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 2 findings (makes network calls, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

temporal-python-testing

Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.

wshobson/agents · 45 tokens

python-testing

Guidelines for writing and running tests in the Agent Framework Python codebase. Use this when creating, modifying, or running tests.

microsoft/agent-framework · 29 tokens

adk-verify-snippets

Checks that every Python code block in a Markdown file actually compiles and runs, by extracting each block to a temporary file, executing it in an isolated subprocess, and writing a pass/fail report with per-snippet coverage. Use when the user asks to verify, test, or validate the code samples in a README, a guide…

google/adk-python · 149 tokens

adk-setup

Sets up a local ADK Python development environment in a git clone of the open-source adk-python repository: a uv virtual environment, all dependency extras, pre-commit hooks, and a first unit-test run. Runs only when explicitly requested, never on its own. Use when asked to set up, bootstrap, or repair a development…

google/adk-python · 146 tokens

test-generator

Generate pytest test cases for Python functions and classes.

vstorm-co/pydantic-deepagents · 12 tokens

test-harness

Generates pytest test suites with happy path, edge cases, error conditions, fixture scaffolding, mocks, async patterns. Triggers on: "generate tests", "write tests for", "test this function", "create test suite", "pytest for", "unit tests for", "mock strategy for".

Mathews-Tom/armory · 65 tokens