← 返回 Skills 市场
281
总下载
1
收藏
0
当前安装
4
版本数
在 OpenClaw 中安装
/install setup-unit-test
功能描述
One-click initialization of an AI-driven unit testing environment for frontend projects (supports React/Vue/pure TypeScript/Next.js). Automatically detects p...
安全使用建议
This skill appears to do what it says (set up Vitest, Testing Library, MSW, config files, and pre-commit checks) and ships readable scripts. Before installing: 1) Confirm you have Node, Git, and your package manager available — the metadata doesn't declare these but the scripts need them. 2) Inspect the exact files it will write (.husky/pre-commit, vitest.config.ts, .claude/commands/*) and back up your existing pre-commit hook; the installer will modify your git hooks. 3) Be cautious with AUTO_GEN_TEST: enabling it or invoking the injected /gen-unit-test or /fix-test commands can cause source files to be sent to the external AI for test generation/repair — only enable that if you are comfortable sending code to the AI service and have reviewed the prompt templates in .claude/commands. 4) Run the tool in a disposable branch or test repo first so you can review generated tests and any automatic changes. If you need higher assurance, ask the author for a manifest of exact file changes or for the skill to declare required binaries and the AUTO_GEN_TEST env var in metadata.
功能分析
Type: OpenClaw Skill
Name: setup-unit-test
Version: 2.0.2
The skill bundle provides a legitimate utility for initializing unit testing environments (Vitest, MSW, Husky) in frontend projects. It uses scripts like `detect-framework.mjs` and `check-missing-tests.mjs` to automate configuration and Git hooks, and it injects AI prompt templates for test generation. All operations, including shell execution for package installation and file system modifications, are clearly documented and strictly aligned with the stated purpose of the tool.
能力评估
Purpose & Capability
The skill's files and SKILL.md align with a unit-test automation tool: detection script, test-check script, prompts, and config generation. However, the declared metadata lists no required binaries or environment variables while the runtime instructions and shipped scripts assume node, git, and a package manager (npm/yarn/pnpm). The absence of declared required binaries is a discrepancy worth noting but not necessarily malicious.
Instruction Scope
SKILL.md instructs the agent to read package.json, write config files, run package-manager installs, and modify Husky pre-commit hooks. The injected .claude/commands include workflows that recursively scan source files, read source code, generate tests, run vitest, and attempt automatic repair — which implies the project source code may be transmitted to an external AI when those commands are invoked. Auto-generation is disabled by default, but enabling AUTO_GEN_TEST or invoking the generated commands will expose project code to the AI service; this is scope creep relative to purely local setup and is a potential data-exfiltration vector.
Install Mechanism
There is no install spec (instruction-only) and the skill ships only small local scripts and prompt templates. No remote downloads, obfuscated code, or unusual install steps are present. This limits supply-chain risk; all executed code is included in the skill bundle and runs locally.
Credentials
The skill declares no required credentials or config paths (appropriate). It does reference an environment toggle AUTO_GEN_TEST (not declared in metadata) which controls whether the pre-commit hook will invoke automatic test generation (and thereby may send code to the external AI). No secrets are requested, but enabling auto-generation can expose project contents to the agent/AI service — the user should verify that is acceptable.
Persistence & Privilege
The skill does modify project state: it writes config files under the project (vitest config, tests setup), writes .claude/commands templates, copies scripts, and updates .husky/pre-commit. Those are project-scoped changes and expected for this purpose but can be sensitive (git hooks executing code on commits). The skill is not always-enabled and does not request global/system privileges.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install setup-unit-test - 安装完成后,直接呼叫该 Skill 的名称或使用
/setup-unit-test触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.0.2
- Switched all automation and detection scripts from JavaScript (`.js`) to modern ECMAScript modules (`.mjs`) for better compatibility and future-proofing.
- Enhanced detection: environment script now collects OS info and adds Next.js support.
- Upgraded config: `vitest-tsconfig-paths` plugin is default for instant tsconfig alias resolution.
- Broader framework support: works with React, Vue, TypeScript, and detects Next.js projects.
- Dependency list updated: adds `@vitest/ui` (visual UI) and smarter test environment presets.
- Automation improvements: new test checking script (`check-missing-tests.mjs`) is more robust and cross-platform.
- Changelist includes only real modifications based on user-provided inputs.
v2.0.1
- Added a Security & Permissions section to the documentation, detailing required file system, shell, and git operations.
- Clarified that all scripts run locally and do not transmit project data externally (except via explicit Claude commands).
- No changes to functionality or code; this update is documentation only.
v2.0.0
- Updated all documentation and configuration from Chinese to English for broader accessibility.
- No file or functionality changes in this version—this is a documentation-only update.
- All workflow steps, configuration files, and usage instructions are now in English.
- Existing features and integration steps remain unchanged.
v1.0.0
setup-unit-test v1.0.0
- Initial release: one-click AI-driven unit test setup for front-end projects (React, Vue, TypeScript).
- Detects project framework and language, installs Vitest + Testing Library + MSW, generates config files.
- Adds Claude custom commands (/gen-unit-test, /fix-test) for AI-based test generation and repair.
- Configures npm scripts, Husky pre-commit hook with lint-staged, and supports optional AI auto-generation of missing tests.
- Provides demo test for quick verification and outputs a summary on completion.
元数据
常见问题
Unit Test Automation 是什么?
One-click initialization of an AI-driven unit testing environment for frontend projects (supports React/Vue/pure TypeScript/Next.js). Automatically detects p... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 281 次。
如何安装 Unit Test Automation?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install setup-unit-test」即可一键安装,无需额外配置。
Unit Test Automation 是免费的吗?
是的,Unit Test Automation 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Unit Test Automation 支持哪些平台?
Unit Test Automation 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Unit Test Automation?
由 hibehero(@hibehero)开发并维护,当前版本 v2.0.2。
推荐 Skills