Agent skill

Test Cleaner

by shenjingnan in shenjingnan/xiaozhi-client

“测试清理技能,用于分析并清理超出测试范围或低价值的测试用例”

— description from SKILL.md by shenjingnan
MITAuto-check passedDevelopment

Install Test Cleaner

skills CLI
$ npx skills add shenjingnan/xiaozhi-client --skill test-cleaner -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install shenjingnan/xiaozhi-client test-cleaner --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/shenjingnan/xiaozhi-client.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/test-cleaner .claude/skills/test-cleaner && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
test-cleaner
GitHub stars
341
Token cost
~595 tokens
SKILL.md length
81 words
Files
1
Skills in repo
16
Repo updated
First seen
Licence
MIT

At a glance

  • Works in 4 steps: 分析测试文件 - 扫描并识别问题测试用例 → 生成分析报告 - 详细列出问题和建议 → 等待用户确认 - 在执行清理前获得明确确认 → …
  • SKILL.md covers 我的能力, 使用方式, 分析流程 and 执行阶段, plus 3 more sections
  • Calls pnpm and git

About this skill

Test Cleaner is a skill in shenjingnan/xiaozhi-client (341 stars). Its SKILL.md is about 595 tokens. Licence: MIT.

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. 分析测试文件 - 扫描并识别问题测试用例
  2. 生成分析报告 - 详细列出问题和建议
  3. 等待用户确认 - 在执行清理前获得明确确认
  4. 执行清理 - 删除问题用例并验证结果

What it can do on your machine

Read from SKILL.md and the folder at commit fe3c382. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pnpm
    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pnpm and git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Test Cleaner loads about 595 tokens when it runs. Until then it costs about 11 tokens; SKILL.md has 81 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~11
When it runs · the whole SKILL.md, loaded when a task matches
~595

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from shenjingnan/xiaozhi-client at commit fe3c382, republished under its MIT licence (© shenjingnan). 81 words, ~595 tokens.

Download SKILL.mdSave it as .claude/skills/test-cleaner/SKILL.md (or your agent's skills folder).
name
test-cleaner
description
测试清理技能,用于分析并清理超出测试范围或低价值的测试用例

测试清理技能

我是一个测试清理专家,专门分析并清理超出测试职责范围或低价值的测试用例。

我的能力

当你需要清理测试用例时,我会:

  1. 分析测试文件 - 扫描并识别问题测试用例
  2. 生成分析报告 - 详细列出问题和建议
  3. 等待用户确认 - 在执行清理前获得明确确认
  4. 执行清理 - 删除问题用例并验证结果

使用方式

使用格式:/test-cleanup [路径]

示例:

  • /test-cleanup - 分析整个项目的测试文件
  • /test-cleanup src/server/handlers - 分析特定模块
  • /test-cleanup src/server/handlers/__tests__/mcp-manage.handler.test.ts - 分析特定文件

分析流程

扫描阶段
  1. 识别测试文件:查找目标路径下所有的 *.test.ts 文件
  2. 解析导入关系:提取每个测试文件的导入语句
  3. 分类测试模块:单元测试、集成测试、端到端测试
问题识别

严重问题(应立即删除):

  • 超纲测试:在消费者测试中测试外部依赖的内部实现
    • 判断标准:测试用例验证的是外部依赖的行为而非当前模块的职责

警告问题(建议删除或重构):

  • 重复测试:已在提供者模块中覆盖的单元功能
    • 判断标准:测试用例在依赖模块中已存在类似的覆盖

建议优化(可选改进):

  • 低价值测试:不提供独特价值的测试用例
    • 判断标准:测试失败时无法提供有价值的调试信息

过度 Mock:

  • 问题模式:Mock 了不应 Mock 的内部实现细节
    • 判断标准:Mock 破坏了测试的真实性和价值
分析报告格式
markdown
# 测试用例清理分析报告

## 分析范围
- 路径: `<指定路径>`
- 测试文件数: X
- 问题用例数: Y

## 严重问题(应删除)
### 文件: src/server/handlers/__tests__/mcp-manage.handler.test.ts
#### 问题: 超纲测试 - 重复测试 TypeFieldNormalizer
- **位置**: 第 45-67 行
- **问题**: 测试了外部依赖中已完整覆盖的单元功能
- **建议**: 删除这些测试用例

## 清理总结
- 可删除测试用例: X 个
- 可优化测试用例: Y 个

执行阶段

用户确认
  1. 展示分析报告
  2. 询问是否确认执行清理
  3. 等待用户确认后才进行修改
清理操作

如果用户确认,执行以下操作:

bash
# 创建备份分支
git checkout -b test-cleanup-backup-$(date +%Y%m%d)

# 删除问题测试
# 根据报告中的位置信息,删除超出范围的测试用例

# 验证测试
pnpm test <指定路径>

# 生成覆盖率报告
pnpm test:coverage
回滚选项
bash
# 如果清理导致问题,可以回滚
git checkout main
git branch -D test-cleanup-backup-$(date +%Y%m%d)

示例分析

超纲测试示例

问题代码:

typescript
// ❌ 超纲测试
import { normalizeTypeField } from "@/lib/mcp-core/utils/type-field-normalizer";

describe("MCPManageHandler", () => {
  describe("normalizeTypeField", () => {
    it("应该正确处理 null 类型字段", () => {
      // 这是工具函数的单元测试,不应该在 handler 测试中
    });
  });
});

清理建议:

typescript
// ✅ 正确范围
describe("MCPManageHandler", () => {
  describe("handleListTools", () => {
    it("应该正确调用 normalizeTypeField 处理工具定义", () => {
      // 验证 handler 在业务场景中正确使用了外部依赖
    });
  });
});

注意事项

  • 谨慎删除:如果不确定测试的价值,先标记为"建议优化"而非直接删除
  • 保留集成测试:删除超纲的单元测试时,确保保留必要的集成测试
  • 覆盖率监控:清理后确保整体测试覆盖率仍符合 80% 的要求
  • 中文描述:所有测试用例描述必须使用中文
  • 路径别名:修改测试代码时使用正确的路径别名

质量检查

bash
# 类型检查
pnpm typecheck

# 代码规范检查
pnpm lint

# 运行测试
pnpm test

# 生成覆盖率报告
pnpm test:coverage

© shenjingnan, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/test-cleaner of shenjingnan/xiaozhi-client.

Open the folder on GitHubat commit fe3c382

Compare with similar skills

Test Cleaner next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Test Cleaner compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Test Cleaner this skillshenjingnan/xiaozhi-client341—~595Automated safety check: PassMIT
Vercel Composition Patternssupabase/supabase111k58 repos~726Automated safety check: PassMIT
Finishing a Development Branchobra/superpowers297k5 repos~1.9kAutomated safety check: PassMIT
Typescript Advanced Typesrolling-scopes/rsschool-app10k25 repos~4.2kAutomated safety check: PassMPL-2.0
PR Babysitteropeninterpreter/openinterpreter69k3 repos~4.2kAutomated safety check: PassApache-2.0
Code Review ChecklistshareAI-lab/learn-claude-code78k4 repos~1.1kAutomated safety check: PassMIT

Similar skills

  • Official

    React composition patterns that scale. An agent skill from supabase/supabase.

    111k GitHub starsUsed in 58 repos~726 tokens
    DevelopmentAuto-check passed
  • Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.

    297k GitHub starsUsed in 5 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Typescript Advanced Types

    rolling-scopes/rsschool-app

    Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.

    10k GitHub starsUsed in 25 repos~4.2k tokens
    DevelopmentAuto-check passed
  • PR Babysitter

    openinterpreter/openinterpreter

    Watches an open GitHub pull request until it merges, handling review comments, diagnosing CI failures and retrying flaky checks along the way.

    69k GitHub starsUsed in 3 repos~4.2k tokens
    DevelopmentAuto-check passed
  • Code Review Checklist

    shareAI-lab/learn-claude-code

    Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.

    78k GitHub starsUsed in 4 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Greploop

    onyx-dot-app/onyx

    Iteratively improves a PR (GitHub), MR (GitLab), or shelved changelist (Perforce) until Greptile gives it a 5/5 confidence score with zero unresolved comments.

    32k GitHub starsUsed in 4 repos~3.3k tokens
    DevelopmentAuto-check passed

More from shenjingnan/xiaozhi-client

All 16 skills in this repo
  • E2E Coverage Analyzer

    shenjingnan/xiaozhi-client

    分析当前分支 git 改动,检查 e2e 测试用例覆盖情况,并可补充缺失的测试用例. An agent skill from shenjingnan/xiaozhi-client.

    341 GitHub stars~954 tokensUpdated 1 mo ago
    Auto-check passed
  • Fix Comment

    shenjingnan/xiaozhi-client

    GitHub 评论修复技能,用于获取 PR 的 Copilot 评论并分析修复问题. An agent skill from shenjingnan/xiaozhi-client.

    341 GitHub stars~873 tokensUpdated 1 mo ago
    Auto-check passed
  • API Docs

    shenjingnan/xiaozhi-client

    文档自动生成

    341 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • CI Validator

    shenjingnan/xiaozhi-client

    CI检查验证和质量保障

    341 GitHub stars~2.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Commit

    shenjingnan/xiaozhi-client

    生成代码评审友好的 commit 信息

    341 GitHub stars~1.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Dev Workflow Checker

    shenjingnan/xiaozhi-client

    开发流程检查技能,确保代码修改后执行必要的质量检查

    341 GitHub stars~464 tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about Test Cleaner

How do I install Test Cleaner in Claude Code?

Run `npx skills add shenjingnan/xiaozhi-client --skill test-cleaner -a claude-code`. Or copy the skill folder (.agents/skills/test-cleaner in shenjingnan/xiaozhi-client) into .claude/skills/test-cleaner in your project. Claude Code loads it when a task matches its description.

How do I install Test Cleaner in Codex?

Run `npx skills add shenjingnan/xiaozhi-client --skill test-cleaner -a codex`. Or copy the skill folder (.agents/skills/test-cleaner in shenjingnan/xiaozhi-client) into .agents/skills/test-cleaner in your project. Codex loads it when a task matches its description.

Can I use Test Cleaner in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add shenjingnan/xiaozhi-client --skill test-cleaner -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/test-cleaner, .gemini/skills/test-cleaner, .github/skills/test-cleaner and .opencode/skills/test-cleaner in your project.

What does Test Cleaner need to run?

Going by SKILL.md and its folder, Test Cleaner needs the command-line tools its instructions call (pnpm and git).

Does Test Cleaner access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Test Cleaner safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Test Cleaner use?

Test Cleaner is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Test Cleaner use?

About 595 tokens (SKILL.md is roughly 2.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Test Cleaner?

Skills that share tags, products or a category with Test Cleaner: Vercel Composition Patterns (supabase/supabase, 111k stars), Finishing a Development Branch (obra/superpowers, 297k stars), Typescript Advanced Types (rolling-scopes/rsschool-app, 10k stars) and PR Babysitter (openinterpreter/openinterpreter, 69k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Test Cleaner?

shenjingnan (a GitHub user) maintains it in shenjingnan/xiaozhi-client, which has 341 GitHub stars. The repository holds 16 skills in this directory. The repository was last updated on September 3, 2026.

Source: shenjingnan/xiaozhi-client on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.