- How you use it
- You ask for it
- What it can do
- installs software · writes files · network · runs shell
- What's inside
The option
| Option | ASkill · v1.0.0+wwfix.1vitest skill (Anthony Fu) |
|---|---|
| How you use it | You ask for it |
| What it can do | installs software · writes files · network · runs shell |
| What's inside |
What this thread does
The problem
Agents write Vitest tests from memory of Jest: jest.fn() instead of vi.fn(), mocks declared after the import they should replace, fake timers never restored, config that ignores the project's Vite setup. The tests look fine and fail in odd ways, or pass without testing anything.
What the package is
Anthony Fu publishes a Vitest skill in antfu/skills (MIT, locked to commit feb0f3a for this entry). The SKILL.md says it is generated from the Vitest docs and targets Vitest 5.0.1 (generated 2026-09-25). It is a short index plus 19 reference files (the GitHub listing at that commit), about 102 KB in total: config, CLI, test and expect APIs, hooks, mocking, snapshots, coverage, test context and fixtures, concurrency, filtering, tags, reporters, benchmarking, vi utilities, environments, type testing and projects.
What I read: the index links references the agent can load as needed (for example features-mocking.md for vi.mock and advanced-vi.md for vi.hoisted), so a task about mocking does not pull in the whole docs set. The skill is documentation, not a workflow: it does not tell the agent how to decide what to test.
How to describe it to the agent
A prompt worth trying (mine, untried): "Use the vitest skill. Write tests for src/lib/price.ts at its public functions only. Use vi.hoisted for any module mock factory, restore timers and mocks in afterEach, and run the tests with vitest run before you report."
Common mistakes
- Treating the skill as a substitute for the version of Vitest in your repo: it describes 5.x; check
package.jsonfirst. - Letting the agent mock your own modules everywhere; mock the boundary (network, clock), not the code under test.
- Skipping the run: ask the agent to execute the suite and show the result.
Limits
I read the skill, not outputs from it. Prompt wording is mine and untried. It teaches the Vitest API, not what is worth testing; pair it with the thread on whether agent-written unit tests help.
Primary source
Primary source: antfu/skills vitest SKILL.md (Anthony Fu, commit feb0f3a, MIT licence file). Checked: generated from the Vitest repository, based on Vitest 5.0.1 (2026-09-25), an index linking reference files (config, CLI, test and expect APIs, hooks, mocking, snapshots, coverage and more); the commit lists 19 reference files totalling about 102 KB, not 20 and 105 KB as an earlier version of this thread said. Star count not verified.
Started from a post by @Anthony Fu, packaged by the editor. Original post
- 01 · YouPaste the line from Try it into your agent.
- 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
- 03 · YouApprove a one-line report. Nothing is posted without you.