testing
БесплатноБез исполняемых скриптовНе проверенTesting patterns for behavior-driven tests. Use when writing tests, creating test factories, structuring test files, or deciding what to test. Do NOT use for…
Об этом скилле
Testing Patterns
For verifying test effectiveness through mutation analysis, load the mutation-testing skill. Use its mutator rules while planning and writing tests, but defer the automated mutation harness until the end-of-phase PR-readiness gate. For evaluating test quality against Dave Farley's properties, load the test-design-reviewer skill.
Core Principle
Test behavior, not implementation. Coverage helps find unexercised code; the repository owns any threshold, and a percentage does not replace meaningful assertions.
Example: Exercise validation through processPayment() when that is the contract under test, rather than testing an internal validator only to move a coverage number.
Fast, Relevant Test Execution
Follow the tdd skill's canonical fast-feedback, watcher lifecycle, process cleanup, monorepo, final-gate, and repository-authority policy. For Vitest seed semantics and reusable-command proof, read its resources/vitest-watch-feedback.md.
Start with an exact selector for RED. For GREEN/REFACTOR, prefer a behaviorally proven repository-owned watcher, then the runner/orchestrator-derived affected scope or affected one-shot. A repository-owned command may deliberately run its complete relevant tier once to seed the runtime graph. Do not hand-pick a smaller ongoing scope, accept zero-test evidence, leave a watcher behind, or substitute watch mode for the complete non-watch PR gate.
Inspect project scripts and installed runner help rather than guessing flags. Representative runner-specific choices:
Preference order:
- Tested repository-owned watch/affected command.
- Native VCS-aware selection when the installed runner and repository configuration have proven its watch behavior.
- Native dependency-aware selection from a complete, mechanically derived changed-source list.
- Runner/orchestrator-selected affected packages/projects, including transitive dependents.
- Exact test file/name only for proving RED or debugging, followed by one of the broader affected scopes for GREEN.
| Runner | GREEN/REFACTOR affected scope | RED/debug-only selector |
|---|---|---|
| Vitest | Repository-owned watcher first. Otherwise use vitest --changed <real-base> --watch only under the tdd skill's version/configuration proof conditions; for one-shot use --run. Use vitest related <all-changed-source-paths> only when that list is derived mechanically |
vitest run <test-file> -t <name> or exact-file watch |
| Jest | jest --watch, adding --changedSince=<base> when the task spans commits; for one-shot use --onlyChanged, --changedSince=<base>, or --findRelatedTests <all-changed-source-paths> with watch disabled |
jest --runTestsByPath <test-file> -t <name> |
| pytest | Use an existing repository affected/watch task. Without one, run the complete owning package/suite plus known consumers and widen when dependency impact is uncertain | pytest path/to/test_file.py::test_name or pytest -k <name> <path> |
| Playwright Test | Prefer the repository script or playwright test --only-changed[=<real-base>] as a runner-selected affected one-shot. A mechanically derived complete affected-project set may be supplied with project filters. For runtime app code not imported by tests, dynamic/non-import dependencies, or shared global inputs, use the repository-mapped affected journey/project set and widen when uncertain |
A file, --grep, --last-failed, or hand-picked project filter used only to prove RED or repair a known failure |
| Go / Rust / JVM | Use the repository's existing affected/watch task or a dependency-graph-derived package/module set including transitive consumers | Exact package/class/test-name selectors chosen only to prove RED or debug |
If the runner lacks a dependency graph, use its exact selector only for RED/debugging. For GREEN/REFACTOR, run the behavior test plus every known consumer and the complete owning suite/project set; widen when impact is uncertain. Do not mistake “changed test files” for “all relevant tests.” The target is the tests affected by changed behavior, whether or not those test files changed.
Vitest related implicitly permits an empty result to pass. Require at least one expected test to execute. Vitest --standalone is not a TDD substitute; follow the canonical TDD policy instead.
Mutation-Aware Test Planning
When planning or writing tests, automatically scan the code under test — new, changed, or existing code you are covering for the first time — against the mutator rules from the mutation-testing skill's resources/mutator-rules.md resource. A good test should fail if a realistic mutant changes the behavior.
Before writing the first assertion, make these two lists from the code you are about to cover. They are where a green suite most often stays green over a broken rule:
- Every comparison against a constant. For each
>,>=,<,<=or===against a
Установить testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл testing?
Testing patterns for behavior-driven tests. Use when writing tests, creating test factories, structuring test files, or deciding what to test. Do NOT use for UI-specific testing (see front-end-testing or react-testing skills).
Как установить скилл testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop 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…
от Anthropicinternal-comms
A 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…
от Anthropicskill-development
This 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…
от Anthropic