.claude/skills/test-creator/SKILL.md
测试创建技能,用于生成符合项目标准的测试用例
npx skillsauth add shenjingnan/xiaozhi-client test-creatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
我是一个测试创建专家,专门为 xiaozhi-client 项目生成符合标准的测试用例。
当你需要创建测试用例时,我会:
使用格式:/test-create [测试类型] [目标文件或模块]
示例:
/test-create mcp-tool "core/unified-server"/test-create cli-command "cli/commands/start"/test-create transport "transports/websocket-adapter"/test-create utility "utils/config-parser"/test-create type "types/xiaozhi-config"/test-create service "managers/connection-manager"import { describe, expect, it, beforeEach, afterEach, vi } from "vitest";
// 导入要测试的模块(使用项目路径别名)
import { TargetClass, TargetFunction } from "@/module/target-module";
// 导入类型定义
import type { TargetType } from "@/module/target-module";
describe("测试描述", () => {
beforeEach(() => {
// 测试前的准备工作
});
afterEach(() => {
// 测试后的清理工作
vi.clearAllMocks();
});
describe("功能分组", () => {
it("应该正确处理基本场景", async () => {
// 基础功能测试
});
it("应该正确处理边界条件", async () => {
// 边界条件测试
});
it("应该正确处理错误情况", async () => {
// 错误处理测试
});
});
});
基于 xiaozhi-client 项目覆盖率目标(80% 分支、函数、行、语句):
# 运行所有测试
pnpm test
# 运行特定测试文件
pnpm test apps/backend/{module}/{target}.test.ts
# 生成覆盖率报告
pnpm test:coverage
pnpm typecheck # TypeScript类型检查
pnpm lint # 代码规范和格式检查
pnpm spellcheck # 拼写检查
pnpm check:all # 运行所有质量检查
development
TypeScript严格模式检查
tools
Todo 管理技能,用于管理架构演进过程中的待办事项
testing
测试修复技能,用于分析和修复失败的测试用例
testing
测试清理技能,用于分析并清理超出测试范围或低价值的测试用例