About vitest-evals
A skill for authoring and reviewing Vitest evaluation suites using a harness to run systems and ordinary assertions to check results. It covers AI SDK and Pi AI integrations, judges, tool recording and replay, and assertions over session history and spans.
Key features
- 01Author evaluations with describeEval and a harness
- 02Assert on output, tool calls, and messages
- 03Inspect spans and failed spans
- 04Configure judges and track usage
- 05Set up tool recording and replay
Use cases
- 01Write Vitest evaluations for AI applications
- 02Build a harness for a custom application
- 03Evaluate tool calls and session behavior
- 04Diagnose missing traces or evaluation failures
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ getsentry/ vitest-evals --skill vitest-evalsAfter installing, type/vitest-evalsin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
README.mdSOURCES.mdSPEC.mdreferences/custom-harness.mdharness-ai-sdk.mdharness-pi-ai.mdjudges-and-assertions.mdsuite-authoring.mdtool-replay.mdtroubleshooting.mdutilities.mdDetails
From the project READMEvitest-evals
Use the harness-backed API as the only authoring model.
First Steps
- Read the package, app, or eval file being changed.
- Identify the runtime target, then open only the needed reference.
- Keep suites close to Vitest: one harness per
describeEval(...), explicitrun(...)inside each test, ordinaryexpect(...)assertions over the returned result.
Reference Router
| Need | Open |
|---|---|
| Write or review a normal eval suite | references/suite-authoring.md |
Build a custom app Harness without a first-party adapter | references/custom-harness.md |
Integrate AI SDK generateText, generateObject, tools, or an AI SDK-style agent | references/harness-ai-sdk.md |
| Integrate a Pi AI or Pi Mono-style agent | references/harness-pi-ai.md |
Add custom judges, suite judges, built-in judges, or toSatisfyJudge(...) assertions | references/judges-and-assertions.md |
| Assert on message, tool-call, or span history | references/utilities.md |
| Configure tool recording or replay | references/tool-replay.md |
| Diagnose failures, missing traces, odd output, or choose verification commands | references/troubleshooting.md |
Runtime Defaults
- Import
describeEval(...), judges, and helpers fromvitest-evals. - Bind exactly one
harnessto a suite. - Call
run(input)where the test should execute the system. - Assert on
result.outputfor app-facing behavior. - Use
toolCalls(result)and message helpers for normalized session assertions. - Use
spans(result),spansByKind(result, kind), andfailedSpans(result)for span assertions. - Keep
HarnessRun,NormalizedSession, usage, artifacts, and tool records JSON-serializable. - Report known tokens and USD cost in
run.usage. OmitcostUsdwhen unknown; use0only when the run is known to be free. - Keep rubric text and parsing in the judge. Put provider calls in a
judgeHarness, then call them throughctx.runJudge(...)so usage is recorded. - Put scenario-owned criteria on the input value. Put direct-check expected values in Vitest case rows. Pass per-case judge criteria through explicit matcher options, and suite-wide criteria through judge config.
- Custom judges should use
createJudge(...)for stable reporter labels.
Verification
Prefer the smallest command that covers the edited files:
| Task | Command |
|---|---|
| Lint file | pnpm exec biome lint path/to/file.ts |
| Format file | pnpm exec biome format --write path/to/file.ts |
| Test file | pnpm exec vitest run path/to/file.test.ts -c vitest.config.ts |
| Eval file | pnpm exec vitest run path/to/file.eval.ts -c vitest.config.ts --reporter=./packages/vitest-evals/src/reporter.ts |
| Type surface | pnpm typecheck |
| Package build | pnpm build |
Comments
Markdown supported