/josecabralf-skills:write-unit-testsfrom josecabralf-skills
Author unit tests through a prohibitions-and-procedure flow. Use when starting a new unit test, when asked "should I test this?", or when adding tests in a PR. Walks worth-existing → right-instrument → behavior-name → assertion-first → minimum-arrangement → red-then-green. Do not use for reviewing existing tests.
Ships in josecabralf-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Prohibitions first; procedure second. Prohibitions are unconditional. See TEST-SMELLS.md for full diagnosis and repair on each.
If any appears in the test you are about to write, STOP and fix the production code or rescope.
Does the code make a decision and does being right matter?
If skip: write no test.
| Real question | Right tool |
|---|---|
| Holds for all inputs in a class? | Property-based test |
| Matches another team's API? | Contract test |
| Orchestration of collaborators? | Integration test |
| Output stable across versions? | Approval + invariant |
| Survives load / latency / partial failure? | Chaos / canary |
| Type-system-provable? | Move to types |
If a non-unit instrument fits: take that path; write no unit test.
One Given–When–Then sentence describing what the user, caller, or contract would notice. If the sentence reads "method X is called" or "the function exists": reshape the code or the scope.
Hard-code the expected value from the spec or worked example. The assertion references the public contract: return value or observable state.
Add only the setup the assertion needs. Setup ≤ 10× the assertion. Inline values used once; extract a builder only when ≥2 tests share the shape.
Break the production code intentionally; run the test; confirm it fails. Restore; run again; confirm it passes. A test that never failed proves nothing.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
Generated from the plugin's indexed repository (josecabralf/skills) — no native marketplace selected
npx claudepluginhub p/josecabralf-josecabralf-skills21 skills in this plugin
/assess-testAudit existing tests for quality and for whether each should be a different type of test. Use when reviewing a PR that touches tests, when tests are flaky, brittle or slow, or when asked if a test is worth keeping or should be another type. Not for writing new tests./assess-unit-testsDEPRECATED, use assess-test instead. Audit existing unit tests and emit one verdict per test (keep / refactor / delete / wrong-layer) with the named smell and a one-line next action. Use when reviewing a PR that touches tests, when tests are described as flaky / brittle / fragile, when asked "is this test worth keeping?", or when a test-suite audit is requested. Filters out tests that should never have existed before naming smells in the survivors. Do not use for authoring new tests, integration tests, e2e tests, property-based tests, or contract tests./