Token导航 LogoToken导航

Agent Skill · 研究检索

vitest-dev(Vitest DEV 搜索)

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

vitest-dev 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 71,089。

总安装 196周安装 8GitHub Stars 2下载 63核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:vitest-dev(Vitest DEV 搜索)
来源仓库:https://github.com/bjornmelin/dev-skills
仓库路径:skills/vitest-dev
安装命令:
npx skills add https://github.com/bjornmelin/dev-skills --skill vitest-dev
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/bjornmelin/dev-skills --skill vitest-dev

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于辅助测试设计、自动化测试、用例整理和回归验证。适合编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需确认项目测试框架、运行命令和夹具数据,避免误改真实逻辑。

安装命令:npx skills add https://github.com/bjornmelin/dev-skills --skill vitest-dev。涉及浏览器或外部服务时应区分本地模拟、测试环境和生产环境。

来源仓库内路径:skills/vitest-dev

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/bjornmelin/dev-skills --skill vitest-dev;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

vitest-dev 怎么安装?

在终端执行 npx skills add https://github.com/bjornmelin/dev-skills --skill vitest-dev。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

vitest-dev 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

vitest-dev 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

vitest-dev 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

vitest-dev 用的人多吗?

公开数据是累计安装 196 次,近一周安装 8 次,下载 63 次,GitHub 2 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

vitest-dev 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
vitest-dev

Vitest DEV 搜索 · 本页

1962操作浏览器未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

vitest-dev

A Claude Code skill for producing high-signal, low-flake, fast Vitest suites (TypeScript + Next.js 16) and for shaping Vitest configuration for optimal local DX and CI throughput.

Core outcomes

  1. Correctness first: tests encode business behavior (not implementation details).
  2. Deterministic: no network, no clocks, no global leakage, no order dependencies.
  3. Fast:

- fast feedback locally (watch mode + smart filtering) - scalable CI (parallel workers + sharding + cache + machine-readable reports)

  1. Actionable failures: failures localize root cause quickly.

Default operating procedure

When asked to add or improve tests:

  1. Map the unit under test

- Identify public API / observable behavior - Identify boundaries: I/O, time, randomness, network, database, filesystem, env, global state

  1. Choose the lightest test that gives confidence

- Pure unit test (no framework/runtime) → preferred - Component test in jsdom (React) when DOM behavior is essential - Integration test in Node when multiple modules must cooperate - Browser Mode (real browser) only when DOM fidelity matters (layout/visuals, real events)

  1. Design a minimal test matrix

- happy path(s) - boundary conditions - error paths - key invariants (idempotency, caching semantics, auth gates, etc.)

  1. Implement tests

- arrange/act/assert clarity - isolate side effects and restore mocks - prefer stable assertions (toHaveTextContent, role-based queries, etc.)

  1. Run locally and fix

- run smallest scope first (single file / name filtering)

  1. Harden

- remove flakiness vectors (timers, concurrency, random, hidden network) - ensure tests pass in “run mode” (CI-like)

  1. Optimize

- reduce expensive setup per test file - tune Vitest config: pool, isolate, workers, cache, deps optimization, sharding

  1. Deliver

- include config + scripts changes needed for local + CI - include README notes if non-obvious

Naming and structure conventions

  • Place tests next to code for discoverability:

- src/foo.ts → src/foo.test.ts - src/components/Button.tsx → src/components/Button.test.tsx

  • Use __tests__ for framework-driven routes when colocation is awkward (Next example uses this convention).
  • Prefer describe('<unit>') with focused it('does X when Y').

Vitest execution modes and what to target

  • Local development: vitest (watch mode by default when TTY is detected).
  • CI: vitest run (forces a single run and is non-interactive).

From the Vitest CLI guide, Vitest defaults to watch mode when process.stdout.isTTY is true and falls back to run mode otherwise, while vitest run always runs once. (See: https://vitest.dev/guide/cli)

Configuration baseline

Recommended “default” config goals

  • Use TypeScript path aliases (monorepos and Next apps frequently need this).
  • Choose an environment per project:

- node for backend/unit tests - jsdom (or happy-dom) for React component tests

  • Keep setup lightweight.

Pool choice (speed vs compatibility)

Vitest runs test files using a pool (forks, threads, vmThreads, vmForks). By default (Vitest v4 docs) it uses forks. threads can be faster but may break libraries that use native bindings; forks uses child_process and supports process APIs like process.chdir(). (See: https://vitest.dev/config/pool)

Rule of thumb:

  • Prefer threads for “pure JS/TS” unit tests.
  • Use forks if you use:

- native addons (e.g. Prisma, bcrypt, canvas) - process.* APIs that are not available in threads

  • Avoid VM pools unless you have measured wins and understand the tradeoffs.

Isolation (speed vs global leakage)

test.isolate defaults to true. Disabling can improve performance when tests don’t rely on side effects (often true for Node-only units). (See: https://vitest.dev/config/isolate)

Rule of thumb:

  • Keep isolate: true for frontend/component tests (jsdom) and any suite that touches global state.
  • Consider isolate: false for Node-only pure units *after* you have strong isolation discipline.

File-level and test-level parallelism

- all available parallelism when watch is disabled - half when watch is enabled It also accepts a percentage string like "50%". (See: https://vitest.dev/config/maxworkers)

Cache (CI win)

Vitest caching is enabled by default and uses node_modules/.vite/vitest. (See: https://vitest.dev/config/cache)

For CI, persist this directory between runs (per branch key) for significant speedups.

Next.js 16 integration defaults

Use Next’s recommended baseline:

  • Install (TypeScript): vitest, @vitejs/plugin-react, jsdom, @testing-library/react, @testing-library/dom, vite-tsconfig-paths.
  • Configure test.environment = 'jsdom' with the React + tsconfigPaths plugins.

(See: https://nextjs.org/docs/app/guides/testing/vitest)

Important limitation noted by Next.js: Vitest currently does not support async Server Components; for async components, use E2E tests instead. (See the same Next.js guide above.)

Mocking & test doubles discipline

Preferred hierarchy (from most realistic to most isolated)

  1. Real pure functions (no mocking)
  2. In-memory fakes (e.g., fake repo with a Map)
  3. Contract-driven stubs (minimal, stable)
  4. Spies (vi.spyOn) for verifying interactions
  5. Module mocks (vi.mock) only when necessary

Mock reset policy

  • Default: clean up per test file:

- afterEach(() => vi.restoreAllMocks())

  • If you use global stubs (env/globals), clean them up in afterEach too.

Timers

Use fake timers to avoid slow sleeps. Vitest’s docs show using vi.useFakeTimers() with vi.runAllTimers() / vi.advanceTimersByTime() to speed time-based code. (See: https://vitest.dev/guide/mocking/timers)

Advanced note: if you configure fakeTimers.toFake to include nextTick, it is not supported with --pool=forks because Node’s child_process uses process.nextTick internally and can hang; it is supported with --pool=threads. (See: https://vitest.dev/config/faketimers)

CI reporting and sharding

Reporters

Sharding (multi-machine parallel CI)

Use --shard with the blob reporter and merge at the end. Vitest recommends the blob reporter for sharded runs and provides --merge-reports. (See: https://vitest.dev/guide/reporters)

Using test projects for multi-environment suites

Use test.projects to run multiple configurations in one process (monorepos or mixed environments). Vitest notes the older “workspace” name is deprecated in favor of projects. (See: https://vitest.dev/guide/projects)

Patterns:

  • project A: environment: 'node', pool: 'threads', isolate: false
  • project B: environment: 'jsdom', isolate: true

Deliverables this skill produces

When invoked, this skill can generate or update:

  • Vitest config(s): vitest.config.ts, multi-project configs, CI overrides
  • Test setup: setupTests.ts, test utils, mocks
  • Tests: unit, integration, React component tests, type tests
  • CI scripts: sharding + merging reports, coverage, flake detection
  • Performance tuning recommendations with measurable steps

Output quality gates

Before finalizing, ensure:

  • No test uses real timers (setTimeout waits), real network, or real clock time without explicit control.
  • All mocks/stubs are restored.
  • Tests pass with:

- vitest - vitest run

  • On CI, tests emit machine-readable artifacts (JUnit, JSON, blob merge) if requested.
  • Coverage settings match team goals and don’t create “coverage theater”.

Where to look for authoritative details (official docs)

平台分布

Codex

36.26%
按下载量换算23

Claude

27.34%
按下载量换算17

Cursor

19.13%
按下载量换算12

Gemini CLI

8.39%
按下载量换算5

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills