review-vitest-tests
БесплатноБез исполняемых скриптовНе проверенUse when reviewing Vitest test files (.vitest.ts/.tsx) for quality against Positron's builder pattern, RTL patterns, and conventions. Not for e2e or…
от posit-dev★ 4 361 звезда на GitHubОб этом скилле
Positron Vitest Test Review
Review Vitest test files for quality, maintainability, and adherence to the project's testing patterns. Evaluate them on their own merits with no context about why they were written this way.
Arguments
$ARGUMENTS should contain the test file path(s) to review. For each test file, also identify the corresponding source file under test.
Setup
- Read each test file and its source file.
- Read
.claude/rules/vitest-tests.mdfor patterns, conventions, and common mistakes. For any.vitest.tsxfile under review, also read.claude/rules/vitest-rtl.md. - Read the builder JSDoc:
src/vs/test/vitest/positronTestContainer.ts
Checklist (per test file)
Evaluate each test file against this checklist. Report ONLY items that fail -- don't list passing items. Also flag any cross-file inconsistencies (e.g., same service stubbed differently, different assertion styles for the same pattern).
Weight findings by impact. Correctness bugs (0, 2, 9), missing behavioral coverage (5), flaky/nondeterministic tests (7, 9), and incorrect abstractions (2's private-method-seam and wide-cast checks) matter most -- lead with those in the report. Findings that are purely stylistic (1's naming/import tidiness, 6's consistency) are worth reporting only when there's a concrete maintainability or correctness benefit; don't create churn over preference alone.
0. Test value and falsifiability
For each test, ask: what specific production code change would make it fail, and does that change represent a user-visible or system-observable regression?
Flag any test where the answer is "I'm not sure" or where the test only verifies an implementation detail with no behavioral consequence — e.g., an internal counter value, a private array index, or a call count when the real invariant is a downstream side-effect. Coverage is a side-effect of good tests, not a goal. Every test should guard a specific regression that would matter.
Concrete check: mentally delete or mutate the production code path the test exercises. Would a user or the system notice the breakage? If not, the test is verifying structure, not behavior — flag it with a suggested behavioral rewrite or recommend dropping it.
1. Unused declarations and import bloat
Any variables, emitters, or imports declared but never referenced in a test? Suite-level let variables that only exist for setup wiring should be inlined into the stub objects instead. Also flag excessive imports: if 5+ service identifiers are imported only for .stub() calls, suggest extracting the stubs into a helper function to reduce the import block.
2. Anti-patterns
- Builder adoption + assertion style: scan against the "Builder anti-patterns" table in
.claude/rules/vitest-tests.md. For each match, reportfile:line, the pattern found, and the row's "Use instead" value. Respect the "Exception" column. - Lint: run
npx eslint --max-warnings 0 <file>on every.vitest.*under review. The flag is required -- the pre-commit hook only fails on errors, so warnings accumulate silently without it. Report each finding withfile:lineand the rule name. The active rule sets includeeslint-plugin-testing-library(query/action patterns) andeslint-plugin-jest-dom(matcher preferences —prefer-to-have-focus,prefer-to-have-class,prefer-to-have-text-content, etc.). - Suppression audit:
grep -nE "eslint-disable.*(testing-library|jest-dom)/" <file>. A clean lint run with a disable is not the same as a clean file. For each match, check the adjacent comment (or the commit that added it): does it name a real technical constraint, or is it convenience ("avoiding an await", "tests already passed")? Convenience disables should be rewritten to match the rule, not suppressed. - Wide-interface stub casts:
grep -nE "as unknown as " <file>. Each hit is a candidate forstubInterface<T>()or aNull*/Test*prebuilt -- see the "Avoid{...} as unknown as <Interface>" bullet in.claude/rules/vitest-tests.md. Skip narrowing casts where the runtime value really is the target type (ctx.get(IService) as TestService,getByRole(...) as HTMLInputElement,getActions() as IAction[]). - Private-method test-seams:
grep -nE "type \w+WithPrivates|as \w+WithPrivates" <file>— and any cast pattern that reaches into a class's private members from a test. Each hit is a candidate for the "Avoid private-method test-seams" rule in.claude/rules/vitest-tests.md: extract the private logic to a free exported function, or (for anonymous registered classes) promote to a named exported class. Document the recommended fix in the review finding.
The rules files (vitest-tests.md, vitest-rtl.md) are the single source of truth; this skill intentionally doesn't duplicate lists so they can't drift.
3. Setup weight
Count lines of setup vs number of tests. If the ratio exceeds 10:1, suggest extracting a helper function. If 2+ test files would
Установить review-vitest-tests в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл review-vitest-tests?
Use when reviewing Vitest test files (.vitest.ts/.tsx) for quality against Positron's builder pattern, RTL patterns, and conventions. Not for e2e or Playwright tests.
Как установить скилл review-vitest-tests?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл review-vitest-tests запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic