Skip to main content

Manage AI Skills

Docs for Vitest SDK v0.3.3

AI-led project setup installs durable, version-matched LiveDoc guidance automatically. Use this page when installing manually, refreshing skills after a package update, or adding another AI tool. Skills stay inside the repository so they can be reviewed, committed, and shared without affecting other projects.

One Command​

From your project directory, run:

npx livedoc-vitest-setup

An interactive menu lets you choose one or more AI tools. The default is all supported tools.

Non-Interactive (CI)​

Install for selected tools without a menu:

npx livedoc-vitest-setup --tool copilot,codex,claude

Install for all tools:

npx livedoc-vitest-setup --tool all

Supported AI Tools​

AI ToolInstalled?
GitHub Copilot (VS Code/CLI)✅
OpenAI Codex✅
Claude Code✅
Roo Code✅
Cursor✅
Windsurf✅
tip

The installer places skill files in your repository. Commit them and every developer on the team benefits automatically. Repository scope also keeps the skill aligned with this project's LiveDoc version.


Where Files Are Installed​

The installer places skill instruction files in tool-specific locations:

AI ToolLocation
GitHub Copilot.github/skills/livedoc-vitest/
OpenAI Codex.agents/skills/livedoc-vitest/
Claude Code.claude/skills/livedoc-vitest/
Roo Code.roo/skills/livedoc-vitest/
Cursor.cursor/rules/livedoc-vitest/
Windsurf.windsurf/rules/livedoc-vitest/

Manual Fallback​

If npx doesn't work in your environment, copy the files manually. The skill files are bundled in the npm package under tools/skills/. Find them in your node_modules:

node_modules/@swedevtools/livedoc-vitest/tools/skills/

Copy the contents (SKILL.md, VALIDATION.md, examples/, and resources/) to the appropriate directory from the table above.


What the Skill Provides​

Once installed, your AI assistant will:

  • Choose the correct pattern — feature/scenario for BDD, specification/rule for MSpec
  • Use correct imports — lowercase step keywords with proper ESM/globals setup
  • Write self-documenting tests — all inputs and expected outputs embedded in step titles
  • Extract values correctly — using ctx.step.values, ctx.step.params, ctx.step.table, or ctx.example
  • Name files properly — using the .Spec.ts convention
  • Organize folder structure — structuring tests for clean viewer hierarchy
  • Configure coverage — installing the matching provider, enabling Vitest and LiveDoc collection, setting thresholds, and diagnosing missing artifacts

Ask AI to Configure Coverage​

The installed skill can configure a project from a prompt such as:

Configure this LiveDoc Vitest project for line, branch, function, and statement coverage in the Viewer using the V8 provider.

The assistant should:

  1. Inspect the installed Vitest version.
  2. Install the matching @vitest/coverage-v8 version.
  3. Enable test.coverage with provider v8.
  4. Enable coverage on LiveDocSpecReporter.
  5. Run npx vitest run --coverage.
  6. Confirm the Viewer receives the in-memory coverage map and all expected metrics.

For Istanbul, explicitly request that provider so the assistant installs @vitest/coverage-istanbul instead. See Code Coverage for the complete setup.

Example: Before and After​

Without the skill, an AI assistant might write:

import { describe, it, expect } from 'vitest';

describe('Shipping', () => {
it('should apply free shipping for Australian orders over 100', () => {
const cart = new Cart({ country: 'Australia', total: 100 });
cart.calculate();
expect(cart.shippingType).toBe('Free');
});
});

With the skill, the same request produces:

import { feature, scenario, given, when, then } from '@swedevtools/livedoc-vitest';

feature('Shipping Costs', () => {
scenario('Free shipping for Australian orders over 100', () => {
let cart: Cart;

given("the customer is from 'Australia'", (ctx) => {
cart = new Cart({ country: ctx.step.values[0] });
});

when("the order totals '100.00' dollars", (ctx) => {
cart.total = ctx.step.values[0];
cart.calculate();
});

then("shipping type is 'Free'", (ctx) => {
expect(cart.shippingType).toBe(ctx.step.values[0]);
});
});
});

Verifying the Installation​

After installing, ask your AI assistant to write a LiveDoc test. It should:

  • Use feature/scenario or specification/rule — not describe/it
  • Import from @swedevtools/livedoc-vitest — not plain vitest
  • Embed test data in step titles with single quotes
  • Extract values using ctx.step.values or ctx.step.params
  • Name the file with a .Spec.ts extension

If the assistant doesn't follow these patterns, verify the skill files were installed to the correct location for your tool.