/unit-test: Unit tests + red phase (TDD step 4)
SkillDev toolsStep 4 of the Weft TDD workflow. Use after /type-tests: writes co-located *.test.ts unit tests against the mocked surface, covering every acceptance criterion, error path, and edge case, then runs them and confirms they FAIL (red phase) before handing off to /implement.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the /unit-test: Unit tests + red phase (TDD step 4) skill
What this skill tells your AI
The instructions your AI receives, as published by stefvw93/weft in .claude/skills/unit-test/SKILL.md and read by ahel’s review.
Write the feature's unit tests against the mock surface, then prove they fail before any implementation exists.
When to run
- Previous step:
/type-tests(test file written, or explicit skip recorded). - Next step:
/implement. - Gate (exit): a recorded red run:
vp run testexecuted, every new test failing. A new test that passes againstdeclaremocks is a test bug and must be fixed before handoff.
Procedure
-
Read the spec. Tests are written against the acceptance criteria in the co-located
specs.mdand the mocked API surface. Nothing else. -
Write co-located tests (
feature.ts→feature.test.ts).__tests__/directories are allowed for compound/integration tests and shared fixtures/helpers. -
Naming:
describefor grouping,it/testfor cases. Test case names must match or reference acceptance criteria fromspecs.md. A reviewer should be able to trace every criterion to a test by name. -
Coverage requirements (all mandatory):
- Every acceptance criterion in
specs.md. - Happy paths and error paths.
- Every tagged error in the feature's Effect error union: each expected failure gets a test.
- Edge cases defined in the spec.
- Every acceptance criterion in
-
Effect testing: use Effect testing utilities for Effect code (e.g.
Effect.runPromise/test clock/TestContextas appropriate). Follow repo idioms:pipe(effect, ...), specific imports, noimport * as X. -
Red phase (mandatory):
- Run
vp run test(never barevp test: the pack rule). - Confirm every new test fails.
declaremocks have no runtime implementation, so failures are expected; a passing new test is vacuous (asserting nothing, or not exercising the surface). Fix the test. - Confirm the tests fail for the right reason (missing implementation), not for compile errors or broken imports.
- Report the red run result to the user (counts of new failing tests) before handoff.
- Run
-
Hand off. Next step is
/implement.
Rules
- Tests target the public surface defined by the mocks. Do not reach into internals that the spec doesn't name.
- If writing tests reveals the spec or mock surface is wrong: pause rule. Back to
/spec+/mockfirst, then re-enter here. - Browser-dependent behavior is not tested here: that's
/e2e(*.browser.test.tsfiles are excluded fromvp run test).
Signals
- GitHub stars
- 44
- Forks
- 1
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
unit-test-stefvw93- Source
- github.com/stefvw93/weft