Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

author-vitest-tests

БесплатноБез исполняемых скриптовНе проверен

Use when writing or adding Vitest tests for Positron src/vs/ or extensions/ code, checking a branch/PR for test-coverage gaps, or testing React components…

posit-devот posit-dev★ 4 361 звезда на GitHub

Об этом скилле

Positron Vitest Test Authoring

Write tests for Positron source code, then have them independently reviewed.

Arguments

$ARGUMENTS may contain:

  • A file path (e.g., src/vs/.../myComponent.tsx) -- write tests for this specific file
  • --branch <branch-name> to analyze all changes on a branch
  • A PR number (e.g., #12242 or 12242) to analyze a pull request
  • A PR URL (e.g., https://github.com/posit-dev/positron/pull/12242)

Phase 1: Branch/PR Analysis

Skip this phase if the argument is a specific source file path -- go directly to Phase 2 Prepare.

Run this phase when the argument is a branch name, PR number, or PR URL, or the user asks "what tests should I write?" without naming a file. Spawn an analysis subagent to produce a structured test plan -- this keeps the analysis work out of the main agent's context.

Agent({
  description: "Analyze PR for test recommendations",
  prompt: "<analysis prompt below, with arguments filled in>"
})

Analysis subagent prompt


Analyze the changes from <PR number, branch, or "current branch"> and produce a test plan for the Positron IDE.

Step 1: Get the diff.

: gh pr diff <number> --name-only and gh pr diff <number> for full content. : git fetch origin <branch> && git diff main...origin/<branch> --name-only --diff-filter=ACMR : git diff main...HEAD --name-only --diff-filter=ACMR

Step 2: Verify code exists on the current branch.

For each new symbol (method, class, interface member) in the diff:

  • grep -rq "<symbol>" <file> to confirm it exists in the working tree
  • git log --oneline --grep="revert" -- <file> to check for post-merge reverts
  • Skip any file where changes no longer exist

Step 3: Read the testing guide.

Read the Testing section of CLAUDE.md (the "Where should I put my test?" decision table), .claude/rules/vitest-tests.md for core patterns, and the JSDoc on PositronTestContainerBuilder in src/vs/test/vitest/positronTestContainer.ts for presets. For React component work, also read .claude/rules/vitest-rtl.md.

Step 4: Classify each file.

Skip: test files, type-only files, configs, docs, action-only files, files with reverted changes.

For each Positron source file in src/vs/:

  1. Determine the test pattern using the CLAUDE.md decision table:
    • Pure function/class, no services -> Plain test
    • Service/class needing DI -> Builder (createTestContainer())
    • React component (.tsx) with props only -> RTL prop-driven (setupRTLRenderer())
    • React component using usePositronReactServicesContext() -> RTL service-context (withReactServices() + setupRTLRenderer(() => ctx.reactServices))
  2. Check if a .vitest.ts or .vitest.tsx already exists
  3. Determine the lowest builder preset that covers its dependencies
  4. Note any extra .stub() calls needed beyond the preset
  5. Check if the class is exported
  6. For upstream (Microsoft copyright) files, flag with warning

Step 5: Return the test plan as structured output.

Format your response as:

Tests to write: For each: file path, pattern (plain/builder/RTL prop-driven/RTL service-context), preset + reasoning (why this is the lowest viable preset -- name the key dependencies that require it), extra stubs needed, what to test, whether class is exported

Tests to extend: For each: existing test file path, current preset + why it's sufficient (or what changes are needed), what new cases are needed

Already covered: Brief list

Upstream warnings: Any modified upstream files


After analysis subagent returns

Present the test plan to the dev. Ask: "Want me to write/extend these tests?"

Wait for confirmation before proceeding to Phase 2.

Phase 2: Writing

Prepare

Gather the context you need before drafting the plan:

  1. Read the source file and 1-2 existing tests in the same directory for patterns.
  2. Check the "Where should I put my test?" decision table in CLAUDE.md:
    • First, confirm Vitest is the right category for this source. If the table points at Core Mocha, Extension Host Mocha, or E2E Playwright, stop -- this skill can't help; tell the dev which test type fits.
    • Second, within Vitest, use the same table to pick the pattern: plain / builder / RTL prop-driven / RTL service-context.
  3. Skim the builder JSDoc in src/vs/test/vitest/positronTestContainer.ts for preset method names and hierarchy. Start low and let errors guide you up.

Draft the test plan and confirm with the dev (MANDATORY)

Before writing any test code, present a plan and wait for explicit confirmation. This lets the dev steer scope before effort is sunk -- drop cases they don't care about, add cases you missed, reshape groupings to match how the feature is actually used.

Format the plan like this:

Plan for <file>:

Pattern: <plain / builder / RTL prop-driven / RTL service-context>

Полный SKILL.md на GitHub

Установить author-vitest-tests в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл author-vitest-tests?

Use when writing or adding Vitest tests for Positron src/vs/ or extensions/ code, checking a branch/PR for test-coverage gaps, or testing React components with RTL.

Как установить скилл author-vitest-tests?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл author-vitest-tests запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить author-vitest-tests с