From 3e1db3d6f2810928a6a1e3f37a1f2980c1f74779 Mon Sep 17 00:00:00 2001 From: Julian Lechner Date: Thu, 24 Sep 2026 19:11:09 +0200 Subject: [PATCH] docs(skill): clarify unit test triggers --- .../implementation/unit-test-write/SKILL.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/shared/skills/implementation/unit-test-write/SKILL.md b/shared/skills/implementation/unit-test-write/SKILL.md index 020ab53..b5ffa0f 100644 --- a/shared/skills/implementation/unit-test-write/SKILL.md +++ b/shared/skills/implementation/unit-test-write/SKILL.md @@ -1,10 +1,19 @@ --- name: unit-test-write -description: Add focused unit tests for isolated behavior. +description: Use when adding or changing tests for one isolated function, component, or decision. Use integration-test-write when behavior must cross an application or service boundary. --- # Unit Test Write -Identify the behavior and important boundary cases, then add focused deterministic tests. +Use when adding or updating tests for one isolated function, component, or decision. -Prefer observable behavior over implementation details. Report the checks that were run. +## Workflow + +1. Read the requirement and implementation. Identify the observable result that defines success and the boundary conditions most likely to fail. +2. Follow the repository's existing test framework, naming, setup, and assertion style. Avoid new dependencies or fixtures when a small test can express the behavior. +3. Cover the normal case and the smallest meaningful set of boundary or failure cases. Include a regression case for a reported defect. +4. Assert public behavior and useful error outcomes rather than private call order, incidental wording, or internal data layout. +5. Keep each test deterministic. Control time, randomness, filesystem state, and external services when they affect the result. +6. Run the focused test and report its result. Broaden verification only when shared behavior or connected components are affected. + +Do not add tests that duplicate existing coverage or require production code to expose test-only hooks without a clear reason.