Skip to content
Skills Library
Programming · Testing

unit-test

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

Repository
galicia ↗
Licence
MIT
Last repository change
10.11.2026

Assessment and security

86/ 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.
Content21 / 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 10.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

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.

Original author description

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.

How it works

SKILL.md has no level-two headings · 24 lines, 398 words

SKILL.md preview
---
name: unit-test
description: 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.
---

# Unit test

Short evidence, no emojis. No target file named: reply "Please mention the file that you want me to help you write the unit tests for." and stop.

Sphere: one function, class, or component; most isolated of three. Cross-layer data flow belongs in behavioural-test; full user journey in e2e-test. Case fits another sphere: say so, do not write it here.

1. Read target file, its direct collaborators, nearest existing unit tests. Reuse project's runner, assertion library, file naming, test location, helpers, mock style. No existing tests: use runner in project config; none configured: ask user, add no dependency without approval.
2. List cases before writing: every exported function/method, each branch, boundary values (empty, zero, one, max, null/undefined), invalid input, thrown/rejected errors, async ordering. Unreachable or untestable case: state why, do not fake coverage.
3. Write tests. Rules:
   - Arrange-Act-Assert: three blocks in that order, blank line between. Label with `// Arrange`, `// Act`, `// Assert` only if project tests already do. One Act per test.
   - One behaviour per test. Several asserts allowed only when they describe same outcome.
   - Name states unit, condition, expected result. Group by unit under test.
   - Test public behaviour, not private internals or call order, unless call itself is contract.
   - Mock every collaborator outside unit: network, filesystem, clock, randomness, environment, other modules with side effects. Pure helpers stay real. Pin time and randomness. Never mock unit under test.
   - Independent tests: no shared mutable state, no order dependence, reset mocks between tests. Setup hooks only for identical Arrange.
   - No logic in tests: no loops, conditionals, or recomputing expected value with production algorithm. Literal expected values. Table-driven cases allowed when runner supports them.
   - Assert specific value or error type/message, not merely truthy or "did not throw".
   - No fixed sleeps; await condition or use fake timers.
   - Do not change production code to make tests pass. Suspected bug: keep failing test, report to user, ask before fixing.
4. Run new tests alone; show invocation + result. Failure: decide whether test or code wrong, fix test only when test wrong. Rerun until green.
5. Run project lint and type checks on test file; fix every error. Run full relevant suite; new tests must not break others.
6. Repeat 4-5 after each edit. Report cases covered, cases skipped with reason, suspected bugs, commands run. Never claim passing without run output.

Versions

RepositoryScoreLicence
This page · mrlemoos/galicia86MIT
moveju112/skill_verify100MIT
illiaKvanette/menta-lesson-planner86MIT

Database snapshot: 13.11.2026 · package version a86259b7f107 (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-test-design
    Write unit tests that document behavior through explicit arrange-act-assert phases and a single assertion of intent. Use when writing or repairing a unit test that has grown hard to read.
  • 100testing
    Design effective tests and decide what to test: unit vs integration, edge cases, the arrange-act-assert shape, and writing the minimal failing test for a bug. Use when users want tests for code, ask what cases to cover, want to improve coverage meaningfully, or practice TDD.…
  • 100unit-testing-principles-aaa-pattern
    Use this skill when structuring clean, deterministic unit tests following Arrange-Act-Assert principles and strict assertion hygiene.
  • 95tdd
    [UDS] Reference for Test-Driven Development: the Red-Green-Refactor cycle, FIRST principles, and Arrange-Act-Assert structure. Use when: writing a failing test before implementation, structuring a test with Arrange-Act-Assert, checking tests against FIRST. Not for: driving the…
  • 100test-unit
    Write unit and integration tests for a named module or change. Use when "write unit tests" or "add tests for this function". Coverage plan → plan-test-coverage. Mutation score → test-mutation. Browser check → test-playwright.
  • 84tdd-assistant
    [UDS] 测试驱动开发(TDD)的参考资料:红-绿-重构循环、FIRST 原则与 Arrange-Act-Assert 结构。 Use when: 在实现前先写一个会失败的测试、用 Arrange-Act-Assert 组织测试、以 FIRST 检视既有测试。 Not for: 交互式地驱动 RED/GREEN 循环——该部分已移至采用层(XSPEC-095);测量测试覆盖了多少代码——请用 /coverage。 Keywords: TDD, test first, Red Green Refactor, FIRST, Arrange Act…

Feedback and reports

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