nx: Skill for Claude Code

.claude/skills/vitest-migration/SKILL.md

vitest-migration is a skill for Claude Code from nrwl/nx. It costs 66 tokens per session (7,187 once invoked), scanned A, original, MIT.

A migration guide for moving unit tests in an Nx monorepo—a repository containing several related packages—from Jest to Vitest.

In plain words
What is it for?
Use it to convert a package's Jest tests, reuse shared setup and source resolution, and run the package's unit tests with Vitest.
Why use it?
It prevents each package from rebuilding shared test setup and avoids configuration choices that make Vitest scan unrelated project files or break package builds.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

This is nrwl/nx's own configuration. It tells Claude Code how to work on nx itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything nx configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is cacheDir: '../../node_modules/.vite/<name>/unit',.

View source ↗ nrwl/nx nx.dev
About the project

Nx is a tool for managing monorepos, which are repositories containing multiple related projects, across TypeScript and other languages. It helps development teams and AI agents run only affected tasks, cache build results, generate code, and coordinate continuous integration. The catalogue add-ons provide agent skills, commands, agents, instructions, and settings for working with Nx.

nrwl/nx · 29,421 stars · on GitHub · nx.dev

Reuse

Borrowing it

Nothing to install: this file belongs to nrwl/nx. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/nrwl/nx/master/.claude/skills/vitest-migration/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/nrwl/nx

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for vitest-migration

README.md
[![agentmods](https://agentmods.dev/badge/skills/nrwl/nx/vitest-migration/github.svg)](https://agentmods.dev/skills/nrwl/nx/vitest-migration)
Your own site
<a href="https://agentmods.dev/skills/nrwl/nx/vitest-migration"><img src="https://agentmods.dev/badge/skills/nrwl/nx/vitest-migration/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for vitest-migration

Your own site · 80×15
<a href="https://agentmods.dev/skills/nrwl/nx/vitest-migration"><img src="https://agentmods.dev/badge/skills/nrwl/nx/vitest-migration.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 66 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 7,187 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00066 $0.07187
Opus 5.5 $0.00026 $0.02875
Sonnet 5.5 $0.00013 $0.01437
Haiku 4.5 $0.00007 $0.00719

Measured 10d ago against content hash fdb93a7b4924, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

vitest-migration scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

vi.mock('child_process', { spy: true });
.claude/skills/vitest-migration/SKILL.md · 567 lines

How it starts

The opening of the file, as written. The whole thing — 567 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Migrate a package's unit tests to Vitest

Move packages/<name>'s unit tests from Jest to Vitest 4, inferred through the @nx/vitest plugin.

Start from packages/workspace, not packages/nx. The shared machinery a sibling package needs already exists — read these first and reuse them as-is:

  • tools/vitest/setup.mts — the port of scripts/unit-test-setup.js; every migrated package loads it as its setupFiles
  • tools/vitest/nx-source-resolver.mts — resolves nx / @nx/* to this repo's source, for both vite and node
  • tools/vitest/tsconfig.json — a leaf tsconfig whose only job is to stop vite's tsconfig lookup. Do not move these files to the workspace root. With no tsconfig beside them, the nearest one is the root solution file, and vite walks its references — reading all ~114 project tsconfigs on every run, which lands as a sandbox violation. tools/vitest is deliberately a plain directory, not an Nx project: adding project.json makes @nx/js:typescript-sync demand a project reference to a test-only tool from each consuming package's published tsconfig.lib.json (composite: false does not suppress it)
  • packages/workspace/vitest.config.mts — the config those two plug into
  • packages/workspace/project.json — test.inputs naming the shared scripts

packages/nx (PR #36754, commit 32dd3fb533) is the original migration but a poor template: it is the one package that imports almost no siblings, so it needs neither the source resolver nor the CJS-channel mocks. Consult it only for vitest-write-guard.cjs and src/internal-testing-utils/cjs-mock.ts. packages/angular-rspack/vitest.config.mts is the simple end of the spectrum (no nx source at all).

Argument

The package name (e.g. js, devkit, workspace). The package lives at packages/<name>/.

Why this is not a find-and-replace

Jest and Vitest disagree on module semantics, not just API names. The mechanical jest.* → vi.* rename is maybe 80% of the diff and 20% of the work. The rest is: which channel a mock reaches (ESM graph vs CJS require()), whether a namespace is frozen, and what resetAllMocks does to a spy. Budget for hand-fixing specs after the codemod.

Read the full file on GitHub · 567 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago Changed fdb93a7b4924
  2. 23d ago Changed · -1 lines 1a50f79d026d
  3. 24d ago First seen · 568 lines · 66 tokens per session scan A 1a4f225254b7

Subscribe to this mod's changes

vitest-migration is a skill published in the GitHub repository nrwl/nx (29,421 stars, last pushed yesterday), licensed MIT. It adds 66 tokens to every session and 7,187 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-25.

Related

Other skills, from other repositories

Cypress v14 Component Testing

Component testing patterns with Cypress v14 including React, Vue, and Angular component mounting, custom mount commands, interaction testing, visual snapshots, and integration with Vite and Webpack bundlers.

PramodDutta/qaskills · 45 tokens

chart-defaults

Find the actual runtime default value of any AG Charts configuration option, and keep JSDoc Default: markers accurate. Use when documenting a default, verifying a change has not altered one, writing tests against default behaviour, or auditing whether a TypeScript comment matches the theme template.

ag-grid/ag-charts · 60 tokens

Angular Testing Patterns

Angular application testing with TestBed, component harness, service testing, directive testing, and Angular-specific testing utilities.

PramodDutta/qaskills · 26 tokens

react-native-testing

Write tests using React Native Testing Library (RNTL) v13 and v14 (@testing-library/react-native). Use when writing, reviewing, or fixing React Native component tests. Covers: render, screen, queries (getBy/getAllBy/queryBy/findBy), Jest matchers, userEvent, fireEvent, waitFor, and async patterns. Supports v13 (React…

callstack/react-native-testing-library · 134 tokens

vitest

Set up Vitest testing in any project — detects type (Cloudflare Workers, React, Node, library), generates vitest.config.ts, test setup, utilities, and a sample test. Covers mocking patterns, coverage config, workspace setup, Jest migration. Use whenever the user mentions adding tests, setting up Vitest, configuring…

jezweb/claude-skills · 87 tokens

verify-work

Verify feature, bug, UI, API, mobile, security, or deployment work against acceptance criteria.

HoangNguyen0403/agent-skills-standard · 23 tokens