writing-unit-tests

writing-unit-tests is a skill for Claude Code from jaktestowac/awesome-copilot-for-testers. It costs 99 tokens per session (4,365 once invoked), scanned A, original, MIT.

Focused unit tests for one function, class, or module, checking behavior through its public interface. Unit tests are small tests that isolate one part of a program.

In plain words
What is it for?
It helps add tests for existing code, cover edge cases and errors, review flaky tests, and choose between unit and integration tests.
Why use it?
They are less brittle than tests tied to internal implementation details and are easier to keep working during refactoring.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Good fit It helps add tests for existing code, cover edge cases and errors, review flaky tests, and choose between unit and integration tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jaktestowac/awesome-copilot-for-testers/writing-unit-tests
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 jaktestowac/awesome-copilot-for-testers --skill writing-unit-tests
Clone the repo
git clone --depth 1 https://github.com/jaktestowac/awesome-copilot-for-testers

Made for: Claude Code.

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 writing-unit-tests

README.md
[![agentmods](https://agentmods.dev/badge/skills/jaktestowac/awesome-copilot-for-testers/writing-unit-tests/github.svg)](https://agentmods.dev/skills/jaktestowac/awesome-copilot-for-testers/writing-unit-tests)
Your own site
<a href="https://agentmods.dev/skills/jaktestowac/awesome-copilot-for-testers/writing-unit-tests"><img src="https://agentmods.dev/badge/skills/jaktestowac/awesome-copilot-for-testers/writing-unit-tests/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 writing-unit-tests

Your own site · 80×15
<a href="https://agentmods.dev/skills/jaktestowac/awesome-copilot-for-testers/writing-unit-tests"><img src="https://agentmods.dev/badge/skills/jaktestowac/awesome-copilot-for-testers/writing-unit-tests.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 99 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,365 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 warn 7 Sept 2026
SkillSpector: 3 findings, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Excessive Agency · line 133
    Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
    Fix: Add human-in-the-loop confirmation for destructive, irreversible, or high-impact operations. Never auto-execute commands that modify files, send data, or alter system state.
  • medium Prompt Injection · line 169
    Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
    Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
  • medium Prompt Injection · line 172
    Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
    Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
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.00099 $0.04365
Opus 5 $0.00049 $0.02183
Sonnet 5 $0.00020 $0.00873
Haiku 4.5 $0.00010 $0.00436

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

Security

Grade A, and why

writing-unit-tests 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.

plugins/writing-unit-tests/skills/writing-unit-tests/SKILL.md · 289 lines

How it starts

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

Writing Unit Tests

Use this skill when the goal is a small, fast test that proves one behavior of one unit. It helps produce tests that read like a specification and survive refactors, instead of tests that mirror the code and break whenever it moves.

This skill is framework-agnostic. It does not assume a runner, an assertion library, or a mocking tool. Detect what the project already uses before writing anything; if nothing exists yet, ask which runner to target and describe the tests in neutral terms until you know.

When to Use

Trigger phrases: "unit tests", "add tests for this", "cover this function", "test coverage", "edge cases", "mock this", "these tests are flaky", "this test breaks on every refactor", "are these tests any good?".

Typical situations:

  • add unit tests for an existing function, class, or module
  • backfill tests for untested legacy code
  • review an existing suite that is brittle, slow, or flaky
  • expand coverage of edge cases and error paths
  • decide what deserves a unit test versus an integration test

Reach for this skill when the code already exists. If the tests should come first and drive the implementation, use test-driven-development instead - then return here for the standard each test it produces must meet.

What a Unit Test Is Here

A unit test exercises one unit of behavior in isolation, with no real I/O.

  • In scope - pure functions, business rules, validators, mappers, reducers, state machines, error handling
  • Out of scope - database queries, HTTP calls, file system access, real timers, cross-module workflows

Pick the narrowest test that gives real confidence

The behavior lives in Test level Why
A calculation, rule, or transformation Unit Fast, exhaustive on edge cases, no setup cost
Collaboration between two owned modules Unit at the outer module's interface Keeps the seam public without mocking internals
A query, schema, or serialization contract Integration Only the real dependency can prove it
The shape of an external provider's responses Contract test Stubs encode an assumption; a contract test is what notices when it rots
A user-visible workflow across layers End-to-end / functional Unit tests cannot observe it

Read the full file on GitHub · 289 lines

Files

What ships with it

4 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 · 289 lines · 99 tokens per session scan A f0479b37e55a

Subscribe to this mod's changes

writing-unit-tests is a skill published in the GitHub repository jaktestowac/awesome-copilot-for-testers (113 stars, last pushed 15d ago), licensed MIT. It adds 99 tokens to every session and 4,365 once invoked, about $0.0005 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-09-03.

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

unit-test-generator

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

JackyST0/awesome-agent-skills · 20 tokens

migrate-xunit-to-xunit-v3

Migrate .NET test projects from xUnit.net v2 to xunit.v3 and fix v3 breaks. Use for package/CPM conversion, OutputType=Exe, preserving the VSTest or MTP runner (including projects currently using YTest.MTP.XUnit2), incompatible TFMs, async void tests, string-to-Type attributes, custom Fact/Theory/BeforeAfterTest…

managedcode/dotnet-skills · 149 tokens

nunit

Write, run, or repair .NET tests that use NUnit. Use when a repo uses NUnit, [Test], [TestCase], [TestFixture], or NUnit3TestAdapter for VSTest or Microsoft.Testing.Platform execution. USE FOR: writing or reviewing NUnit tests; using [Test], [TestCase], [TestFixture], [SetUp], [TearDown] attributes; configuring…

managedcode/dotnet-skills · 146 tokens

crap-score

Calculates CRAP (Change Risk Anti-Patterns) for a named .NET method, class, or file. USE FOR: explicit CRAP calculation or coverage-and-complexity risk within that named target, including which tests to prioritize. DO NOT USE FOR: project-wide coverage/CRAP, plateaus, or project-wide blockers/priorities…

managedcode/dotnet-skills · 99 tokens

deepeval

Use when discussing or working with DeepEval (the python AI evaluation framework).

sammcj/agentic-coding · 19 tokens