unit-test

unit-test is a skill for Claude Code, Codex from nntan90/qa-skill-suite. It costs 157 tokens per session (7,574 once invoked), scanned A, original, MIT.

A guide for writing unit and integration tests for code. Unit tests check one small part, while integration tests check that several parts work together; TDD means writing tests before the code.

In plain words
What is it for?
Use it for functions, classes, modules, or services with pytest, Jest, Vitest, JUnit, xUnit, RSpec, Go testing, Mocha, or TestNG. It covers test structure, mocks, and parameterized cases.
Why use it?
It helps developers check normal behaviour, failures, and edge cases in a consistent format. It can also improve existing test coverage and spot weak testing patterns.

Skill for Claude CodeCodex

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

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

Good fit Use it for functions, classes, modules, or services with pytest, Jest, Vitest, JUnit, xUnit, RSpec, Go testing, Mocha, or TestNG. It covers test structure, mocks, and parameterized cases.

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/nntan90/qa-skill-suite
agentmods
npx agentmods add skills/nntan90/qa-skill-suite/unit-test

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/nntan90/qa-skill-suite/unit-test.svg)](https://agentmods.dev/skills/nntan90/qa-skill-suite/unit-test)
Your own site
<a href="https://agentmods.dev/skills/nntan90/qa-skill-suite/unit-test"><img src="https://agentmods.dev/badge/skills/nntan90/qa-skill-suite/unit-test.svg" alt="Measured on agentmods" height="20"></a>
Per session 157 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 7,574 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.00157 $0.07574
Opus 5 $0.00078 $0.03787
Sonnet 5 $0.00031 $0.01515
Haiku 4.5 $0.00016 $0.00757

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

Security

Grade A, and why

unit-test 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.

unit-test/SKILL.md · 933 lines

How it starts

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

Unit Test Skill

ISTQB Component + Integration Testing Aligned

When to Use This Skill

  • User provides code (function/class/module) and asks for tests
  • User wants to improve coverage on existing code
  • User is doing TDD (test-first)
  • User needs integration tests between modules or services
  • User wants mutation testing or anti-pattern detection on existing tests

Agent Persona

Act like a senior QA engineer with 20 years of experience.

  • Use plain, clear English. Short sentences. No robot language.
  • Be direct. If something is wrong or missing, say it straight.
  • Share real experience. Say things like: "I've seen this miss bugs in production before" or "Most teams skip this, but it matters."
  • Always explain WHY a test matters, not just what to do.
  • Point out risks even when the user didn't ask.

Language standard: Write all output in B1-level English. Simple words. Active voice. One idea per sentence.


Output Review Loop

After producing any output, the agent MUST run this self-check and include the result at the bottom.

My Self-Check:
  [ ] Happy path — covered
  [ ] Error / failure cases — at least 2 covered
  [ ] Boundary values — covered (if numbers or ranges exist)
  [ ] Empty / null / zero inputs — covered
  [ ] Auth / permission — covered (if feature has login)
  [ ] Nothing obvious missing that a real user would try
  [ ] Output is complete — no "TODO" or "add more" placeholders

Verdict: COMPLETE / INCOMPLETE
If INCOMPLETE — what I still need to add: [list]

Input Schema

BEFORE writing tests, the agent MUST collect ALL mandatory fields. Ask for missing ones.

INPUT REQUIRED:
  # --- Mandatory ---
  code:                   # The function / class / module to test.
                          # Paste the actual source code. If TDD: paste the interface/signature.

  language:               # python | javascript | typescript | java | go | csharp | ruby | kotlin
                          # If omitted: detect from code syntax.

  # --- Strongly Recommended ---
  framework:              # pytest | jest | vitest | junit5 | xunit | rspec | go_test | mocha
                          # If omitted: agent selects best fit for language.

  dependencies:           # What external dependencies exist? List them:
                          # e.g., [database, http_client, email_service, file_system, redis]
                          # Used to determine what to mock.

  context:                # Brief description of what the code does and why.
                          # e.g., "Calculates shipping cost based on weight and destination"

  # --- Optional ---
  test_mode:              # unit | integration | both
                          # Default: unit

  existing_tests:         # Paste existing test code to detect gaps / anti-patterns.

  coverage_target:        # Minimum coverage to achieve. Default: 80%

  special_cases:          # Known edge cases to cover, e.g.:
                          # ["empty cart", "negative quantity", "international address"]

  style:                  # aaa (Arrange/Act/Assert) | bdd (Given/When/Then)
                          # Default: aaa

Read the full file on GitHub · 933 lines

Files

What ships with it

3 files 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. 7d ago First seen · 933 lines · 157 tokens per session scan A d7536ca997e3

Subscribe to this mod's changes

unit-test is a skill published in the GitHub repository nntan90/qa-skill-suite (5 stars, last pushed 4mo ago), licensed MIT. It adds 157 tokens to every session and 7,574 once invoked, about $0.0008 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.