一键导入
test-add
Add unit tests for a specific source file or function. Use when the user asks to add tests, write tests, or improve test coverage.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add unit tests for a specific source file or function. Use when the user asks to add tests, write tests, or improve test coverage.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Run performance benchmarks measuring function execution time and analysis pipeline throughput.
Refactor recently written or changed code for quality and efficiency. Use after writing or editing code to clean it up.
Run unit tests for the project. Use when the user asks to test, verify, or check code correctness.
| name | test-add |
| description | Add unit tests for a specific source file or function. Use when the user asks to add tests, write tests, or improve test coverage. |
| argument-hint | <source-file-path> |
| disable-model-invocation | true |
| allowed-tools | Read, Glob, Grep, Bash(npx tsc *), Bash(npx mocha *) |
Generate unit tests for a source file in this project.
Read the source file at $ARGUMENTS to understand its exports and logic.
Determine which functions are pure (no VSCode API dependency) and testable without mocking.
vscode.Range, vscode.Diagnostic, vscode.TextDocument, etc.Determine the test file path:
src/<module>/<file>.ts → Test: src/test/<module>/<file>.test.tsWrite tests following these conventions:
suite() and test() (NOT describe/it)assert from "assert"Verify:
npx tsc -p . --outDir out
npx mocha --ui tdd --require out/test/vscode-mock.js "out/test/<module>/**/*.test.js"
src/test/
├── vscode-mock.ts # VSCode API mock (loaded via --require)
├── parser/ # Tests for src/parser/
├── analyzer/ # Tests for src/analyzer/
├── codeActions/ # Tests for src/codeActions/
├── rules/ # Tests for src/rules/
├── benchmark/ # Performance benchmarks
└── fixtures/ # Test data