Test Value
Reference on what makes a test worth keeping: expected-value provenance, legitimate call-count and database checks, and the can't-fail/change-detector…
от melodic-software★ 34 звезды на GitHub
Установить Test Value в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Test value
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.
1. Every expected value names its independent source
Before writing an assertion, name where its expected value comes from:
- a literal the requirement states (
280 characters accepted, 281 rejected); - a worked example from the spec, the issue or the API contract;
- the bug report, for a regression test (the value the reporter expected);
- a value computed by hand, outside the code under test;
- a known fixture whose content the test did not derive from the code.
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.
A test you wrote from code you just wrote
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 stated before it runs
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.
In a rewrite, the old code is the source and the test is a pin
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 canned response names its source
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.
2. Call counts are legitimate at unmanaged, state-changing boundaries
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 interact
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Test Value?
Reference on what makes a test worth keeping: expected-value provenance, legitimate call-count and database checks, and the can't-fail/change-detector taxonomy keyed to /testing:audit rule ids. Use when writing/reviewing tests or asking 'is this test worth keeping', 'is this test tautological', or 'should I assert this mock call'.
Как установить скилл Test Value?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Test Value запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…