No slash command · from testing
Reference on test value: expected-value provenance, legitimate mock/db assertions, and the can't-fail/change-detector taxonomy. Use when writing or reviewing tests.
Ships in testing. 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.
None: SKILL.md is the whole skill.
A test is worth keeping when it fails for the bug it guards and passes for any correct
implementation. /tdd:principles (if enabled) carries the wider Beck and
Khorikov doctrine.
Before writing an assertion, name where its expected value comes from:
280 characters accepted, 281 rejected);If the only way to get the value is to run the code under test or repeat its algorithm in the test, there is no independent source and no unit test to write. Test at a level that has one (a property, a round trip against a specified format, an end-to-end outcome), or leave the code untested and say so. Never copy the code's actual output into the expected value: that records whatever the code did.
Its expected value has no independent source unless it comes from the list above. Reading your own code to pick the value copies its output by another route.
Verification record. Claim: LLM-generated test oracles mainly capture the code's actual behavior rather than its expected behavior, and can validate bugs (the first paper also finds them better at detecting faults than EvoSuite's). Basis: https://arxiv.org/abs/2410.21136, https://arxiv.org/abs/2412.14137, https://arxiv.org/abs/2607.22883 (abstracts read). Measured on LLM test generators run on benchmark repositories; the transfer to an agent writing tests mid-task is inferred. Recheck when a study measures an interactive coding agent's own tests, or one of the three papers is revised.
A property is a source only when it comes from the spec, requirement, docstring or issue and is
written down before it runs against the code. A property found by watching what the code does is a
recording, and one that re-implements the code (add(a, b) === a + b) is the restated expectation
this section rules out. A new property needs evidence that it can fail: a mutant it kills
(/mutation-testing:audit --exercised (if enabled)) or a known-bad input marked
expected-fail, such as Hypothesis @example(...).xfail().
Verification record. Claim: a material share of LLM-written property tests are unsound or superficial (a wrong implementation also satisfies them), and Hypothesis documents expected-failing examples as a check that a test does fail on some inputs. Basis: https://aclanthology.org/2026.findings-acl.683/, https://arxiv.org/abs/2307.04346, https://hypothesis.readthedocs.io/en/latest/reference/api.html. Measured on Python libraries and benchmark functions.
When code is replaced, migrated or ported, or pinned before a refactor, the old implementation or output recorded from it is the independent source for the new code, so copying that output is allowed. Such a test is a pin: it proves sameness, not correctness, and keeps any bug the old code had. Name it a pin, and before trusting it break the code under test on purpose and watch it fail. The record is in §4.
A stub, fake or recording standing in for an unmanaged dependency (§2) feeds values the code acts on, so each canned response names its source: a recorded real response replayed read-only in CI, the provider's published schema or sandbox, or a contract test both sides run. A response written from the same guess about the API as the code passes on the shared mistake. A recording is independent only while the implementer cannot rewrite it; a re-recorded or hand-edited one is a new claim to review. Consumer-driven contract tools such as Pact need the provider to run them too, which rules them out for public third-party APIs.
For where Pact does not fit, see
https://docs.pact.io/getting_started/what_is_pact_good_for#what-is-it-not-good-for; correlate
with https://martinfowler.com/bliki/ContractTest.html. For replaying a recording read-only, see
vcrpy's none record mode, https://vcrpy.readthedocs.io/en/latest/usage.html#none.
Asserting that a call happened, and how often, is correct when the dependency is unmanaged
(out-of-process, observable by other systems: a payment API, an email gateway, a message bus) and
the call changes its state: there the call is the behavior, and verifying that the charge
request was sent once (Times.Once) is the test to write. On an internal collaborator, a managed
dependency or a query call the same assertion pins the implementation and breaks on refactor.
Verification record. Claim: only unmanaged dependencies should be mocked, and interactions with them (calls that change their state) are observable behavior to verify. Basis: https://enterprisecraftsmanship.com/posts/when-to-mock/.
A database only your application touches is a managed dependency: test against a real
instance (a container, LocalDB), not a mock or an in-memory fake. After the act step, reading the
resulting row directly (context.Blogs.SingleAsync(...), SELECT ... WHERE id = ?) is legitimate
state verification. What makes such a test weak is its oracle, not the read: expect(row) .toBeDefined() passes for wrong data; assert the fields.
The named exception is the EF Core carve-out: mocking DbContext is acceptable for non-query
writes (verifying that code called Add or SaveChanges()). Never mock DbSet for queries; LINQ
over an in-memory collection does not behave like the provider.
Pointer: Choosing a testing strategy § Mocking or stubbing DbContext and DbSet and its Summary.
Red, green, then refactor, every cycle, one test at a time. Refactoring is not a phase after all the tests are written, and writing every listed test before any implementation is a mistake: bulk tests check imagined behavior. Keep the test list; turn one item into a test at a time.
Verification record. Claim: Canon TDD is five steps (list, one test, make it pass, "Optionally refactor to improve the implementation design", repeat until the list is empty), and "copying actual, computed values & pasting them into the expected values of the test ... defeats double checking". Basis: https://newsletter.kentbeck.com/p/canon-tdd (redirected from tidyfirst.substack.com; published 2023-12-11).
A rewrite pin (§1) is not the copying Beck rules out: its values come from a second implementation, the old one, so the check is double, but on sameness only.
Verification record. Claim: a characterization test documents a system's actual behavior rather than its desired behavior; temporarily sabotaging the code under test confirms each characterization assertion can fail; Jest says to fix a bug before regenerating snapshots so the snapshot does not record it. Basis: https://michaelfeathers.silvrback.com/characterization-testing, https://blog.ploeh.dk/2025/11/03/empirical-characterization-testing/, https://jestjs.io/docs/snapshot-testing.
<folder>./testing:audit rule idsCannot fail (green whatever the code does):
| Rule | Shape | Fix |
|---|---|---|
rule-zero-assertion | a test body with no assertion | assert the behavior |
rule-recomputed-expectation | both sides the same expression: expect(LIMIT).toBe(LIMIT) | take the expected side from §1 |
rule-inert-assertion | an assertion that never runs: unawaited toBeVisible(), assert (x == 1, "msg"), m.called_once_with(...), bare .Should();, Assert.True(true), Assert.NotNull(typeof(T)) | await it, fix the tuple, use assert_called_once_with, assert a value the code computes |
rule-conditional-assertion | every assertion inside an if, a catch or a loop over the result; a C# return; before every assertion | assert unconditionally; check the length first; skip the test instead of returning |
rule-flaky-passes-suite, rule-only-not-forbidden | Playwright retries without failOnFlakyTests; no forbidOnly | set both in the config |
Checks little (can fail, but misses most wrong answers):
| Rule | Shape | Fix |
|---|---|---|
rule-mock-only-oracle | every assertion is a mock interaction | assert a result or state, unless §2 applies |
rule-recomputed-derived | expected rebuilt the way the code computes it: expect(add(a, b)).toBe(a + b), items.reduce(...); passes when test and code share a mistake, and proves no specified value | a hand-computed literal (§1) |
rule-weak-oracle | toBeDefined, is not None, toThrow() alone | assert the value or the exception type |
rule-throw-only-oracle | var w = new Widget(); Assert.NotNull(w);: only a throwing constructor fails it | assert what the constructor sets; cant-fail-ok: <why> for a smoke test kept to prove wiring |
rule-snapshot-only | a snapshot is the only oracle | review it as code; scrub volatile values (times, ids, seeds) with the tool's matcher or scrubber; when your own change breaks it, fix the bug or confirm the diff is intended before regenerating, never re-approve blind (§4) |
A surviving mutant on changed code is one more signal of this class: the changed line was
altered and every test stayed green, so unless the mutant is equivalent (behaves exactly as the
original), no test checks the behavior the mutant changed. Assert that behavior, with an expected
value from §1. /mutation-testing:audit (if enabled) produces the surviving
mutants for a change.
Change detectors (fail on any edit, prove no behavior):
| Rule | Shape | Fix |
|---|---|---|
rule-constant-restatement | expect(X_POST_CHARACTER_LIMIT).toBe(280) | test the boundary (280 accepted, 281 rejected); cant-fail-ok: <why> for an external contract literal |
rule-source-text-read | reading a .tsx file and asserting indexOf order | render or call it |
Judgment only (no rule; the reviewer decides): a stub of a platform API that hides its error
modes (vi.stubGlobal('AudioContext', ...)); mocking an internal collaborator; testing a private
method; a test that breaks on a behavior-preserving refactor; a name that says how, not what; a
snapshot written by hand the same way the code computes it; all tests written before any code.
Also judgment only:
cant-fail-ok: <why>), and a
capability flag is tested by exercising what it promises;toThrow('name is required'),
pytest.raises(ParseError, match="empty"), Assert.That(ex.Message, Is.EqualTo(...))): a
change detector that fails on rewording, since the error type callers branch on is the contract.
Fix: assert the type. When the message is user-facing text or a published error string, it is
the contract: keep the assertion and mark it cant-fail-ok: <why>;toEqual([]), toBeUndefined, is None,
Assert.Empty), and no case in the test (or its table) shows the same code producing it for
another input, so a do-nothing implementation passes. Fix: add the paired case, where a different
input produces the value and the test asserts it exactly, such as
expect(validateOrder(valid).errors).toEqual([]) beside
expect(validateOrder(noSku).errors).toEqual(['sku required']), where the error text is what
the order form shows the user, so the message is the contract. When the absence is the contract
and a paired presence case already exists, keep the test; do not delete or rewrite an absence
assertion for its shape alone. A mock-interaction absence stays under rule-mock-only-oracle and
§2;/testing:write's hollow-out run shows it: swap the subject's
functions for ones that return nothing and expect red.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
9 skills in this plugin
/auditportability-ok: R6 kept-adapter operation - cant-fail-scan.shRead-only: find tests that cannot fail (assertion-free, tautological, vacuous, mock-only, dead asserts, snapshot-only, change detectors, retry-masking configs, test.only). JS/TS, Python, C#, Bash, PowerShell, Go. Use when: 'find tests that prove nothing', 'audit test quality', can't-fail CI gate (--check, --strict), or --persist-findings. Load it to judge any test, even a pasted one./check-visual-parityCheck visual parityHold UI pixel-for-pixel steady through a change: PNG screenshots of listed states before first edit (baseline), then at each green checkpoint counting differing pixels vs pixel_tolerance (compare). Never edits baseline. Use when plan phase has Parity contract line, refactor must leave UI unchanged, 'check visual parity', 'did this change the UI'./cleanupClean up low-value/tautological/vacuous/flaky tests in folder/whole repo's tests via /testing:audit findings: quarantine, rewrite (default), delete, merge, keep per test; mutation gate or --cannot-fail-only; unattended never commits. Use on existing test suites/tests: 'clean up these tests', 'prune the useless tests', 'fix the tests audit flagged'./fix-failingFix failingFind why tests fail, then fix them: test triage, root-cause (never retry blindly), reproduce-fix-retest; `diagnose` changes no code. Use when: 'why does this fail', 'fix the failing tests', 'why is this test flaky', failing/flaky tests, stack traces. Not for authoring: /testing:write; runs: /toolchain:check; profiles: /debugging:analyze-profile./planAnalyze code changes to produce a test plan: classify changed files by test type, identify coverage gaps, and prioritize by regression risk. Use when: 'test plan', 'what needs testing', 'where are the coverage gaps', after /implementation:implement, or PR-prep test coverage checks. Not for writing: /testing:write; running: /toolchain:check./run-e2eRun E2EWhen bundled run resolves in this session, prefer it for quick launch; use for evidenced end-to-end live app verification: start app, drive UI/API/non-UI smoke tests (libs/MCP/hooks/scripts), capture screenshots/logs. Use verifying running app end to end ('e2e', 'smoke test', 'does it actually work'). Not for build/test/lint: /verification:confirm.npx claudepluginhub melodic-software/claude-code-plugins --plugin testingOther plugins' skills for the same job