Skip to content
Skills Library
Programming · Testing

unit-test-engineer

/unit-test-engineer

Designs and writes fast, deterministic unit tests that assert behaviour, cover boundaries and negative cases, and fail when the code is wrong. Use when adding or improving unit tests for existing or new code.

Licence
MIT
Last repository change
02.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 02.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Designs and writes fast, deterministic unit tests that assert behaviour, cover boundaries and negative cases, and fail when the code is wrong. Use when adding or improving unit tests for existing or new code.

Original author description

Designs and writes fast, deterministic unit tests that assert behaviour, cover boundaries and negative cases, and fail when the code is wrong. Use when adding or improving unit tests for existing or new code.

How it works

  1. Purpose
  2. When to invoke
  3. Required input
  4. Execution instructions
  5. Expected output
  6. Validation checklist
  7. Example usage
  8. Sample prompts
  9. Common mistakes
  10. Related skills
Original SKILL.md headings · 107 lines, 559 words
SKILL.md preview
---
name: unit-test-engineer
description: "Designs and writes fast, deterministic unit tests that assert behaviour, cover boundaries and negative cases, and fail when the code is wrong. Use when adding or improving unit tests for existing or new code."
license: MIT
metadata:
  activity: testing
  difficulty: beginner
  frameworks: "JUnit 5, Mockito, pytest, Vitest"
  version: "1.0"
---

# Unit Test Engineer

## Purpose

Produce unit tests that catch defects, not tests that merely execute lines. Strong assertions, minimal mocking and clear naming.

## When to invoke

- Existing code has little or no unit test coverage.
- Tests pass but mutation or review shows weak assertions.
- New code needs tests in the style of the project.

## Required input

- Code under test and its documented behaviour.
- Existing test files for style and fixtures.
- Scenario matrix, if available.

If a required input is missing, ask for it. Do not guess.

## Execution instructions

1. Read the code and list its observable behaviours: return values, state changes, thrown errors, calls to collaborators.
2. Name each test after the behaviour, for example `rejects_negative_quantity` rather than `test1`.
3. Structure tests as arrange, act, assert. One behaviour per test.
4. Cover boundaries (below, at, above), negative inputs, empty and null inputs, and each branch.
5. Assert on specific values and error types, never only `is not None` or `no exception`.
6. Mock only true boundaries (network, clock, randomness, database). Prefer real collaborators or fakes for pure logic.
7. Use parameterised tests for input tables. Keep test data minimal and meaningful.
8. Run the tests, report results. Check that at least one assertion would fail if the logic were inverted.

## Expected output

- Test file(s) in the project style.
- Table mapping behaviours and scenarios to tests.
- Executed test run output.
- Behaviours deliberately not tested, with reasons.

## Validation checklist

- [ ] Tests are deterministic: no sleeping, real clock or network.
- [ ] Each assertion checks an exact expected value or error.
- [ ] Boundary values appear on both sides of each limit.
- [ ] Mocks are limited to external boundaries.
- [ ] Deliberately breaking the code (invert a condition) makes a test fail.

## Example usage

Input:

> Function: `discount_for_tier(tier)` returns 0.0, 0.05, 0.10 for BASIC, SILVER, GOLD.

Illustrative output (abridged, hand-written for this guide, not captured from a model run):

```text
Parameterised test: BASIC -> 0.0, SILVER -> 0.05, GOLD -> 0.10 (exact values).
`unknown_tier_is_rejected`: asserts `ValueError` with the tier in the message.
`none_tier_is_rejected`.
Not tested: formatting of the log line (no behaviour contract).
```

## Sample prompts

```text
Write unit tests for the code below using [framework]. Follow the style of [EXISTING TEST FILE]. Cover each branch, boundary values below/at/above each limit, null/empty inputs and error cases. Assert exact values. Mock only [BOUNDARIES]. Run them and report the output. Code: [CODE]
```

```text
Review these tests for weak assertions and missing boundaries. For each weakness show a mutation of the code that the test would not catch, then propose a stronger assertion: [TESTS]
```

## Common mistakes

- Asserting that a mock was called with the arguments the code already passes (tests the implementation, not behaviour).
- Mocking the class under test or pure logic.
- Chasing coverage percentage with assertion-free tests.
- Sharing mutable fixtures across tests.

## Related skills

- [TDD Engineer](../tdd-engineer/SKILL.md)
- [Mutation Testing Specialist](../mutation-testing-specialist/SKILL.md)
- [Integration Test Engineer](../integration-test-engineer/SKILL.md)

## Related resources

Handbook:

- [Chapter 5: Test Driven Development](../../../handbook/05_test_driven_development/README.md)

Prompts:

- [Unit Test Generation](../../../prompts/testing/unit-test-generation.md)
- [Boundary Testing](../../../prompts/testing/boundary-testing.md)
- [Negative Testing](../../../prompts/testing/negative-testing.md)
- [Test Data Builder Design](../../../prompts/testing/test-data-builder-design.md)

Workflows:

- [Write unit and integration tests](../../../workflows/07_unit_and_integration_testing.md)
- [Build a new feature](../../../workflows/01_feature_development.md)

Examples:

- [examples/python/README.md](../../../examples/python/README.md) scenario S7 (weak assertions)

Versions

RepositoryScoreLicence
This page · arijeetganguli/ai-kaarkhana100MIT
arijeetganguli/ai-kaarkhana100MIT

Database snapshot: 13.11.2026 · package version e9180a2e987c (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90unit-testing
    Writes unit tests for code that already exists — choosing what deserves a test, what the cases are, and how to assert without welding the test to the implementation. Use this whenever the user asks for tests, unit tests, more coverage, or tests for a specific function or module,…
  • 86unit-test
    Writes isolated unit tests for a named file using Arrange-Act-Assert. Use when user requests unit tests, test coverage, or missing test cases for a file.
  • 100writing-unit-tests
    Writes and reviews focused, deterministic unit tests that verify behavior through public interfaces instead of implementation details. Use whenever tests are added to code that already exists, and when the request mentions unit tests, test coverage, edge cases, mocks or test…
  • 100test-strategy
    Decides what to test and at which level, then writes fast, deterministic tests that check behavior rather than implementation details. Use when planning how a feature or system should be tested, choosing between unit, integration, contract and end-to-end tests, deciding what to…
  • 95write-tests
    Write high-quality unit tests (Vitest) and E2E tests (Playwright) following senior test-engineering practices. Use this skill whenever asked to write tests, add test coverage, create test cases, fix failing tests, add missing assertions, test a new feature, write specs, or cover…
  • 100unit-test-writer
    Write focused unit tests for a function, class or module: one behaviour per test, Arrange-Act-Assert, descriptive names, boundary and error cases, no I/O, fast and deterministic; in the project's existing framework (pytest, JUnit 5, xUnit/NUnit, Jest/Vitest, PHPUnit, Go…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.