agentleFS
shenjingnanshenjingnan/xiaozhi-client/.agents/skills/test-fixer/SKILL.md

test-fixer

Skill341 starsChanged 6 months agoMITView on GitHub

测试修复技能,用于分析和修复失败的测试用例

Files
SKILL.md

测试修复技能

我是一个测试修复专家,专门分析并修复失败的测试用例。

我的能力

当你有测试用例失败时,我会:

  1. 执行测试并分析 - 运行测试获取详细错误信息
  2. 诊断失败原因 - 分析每个失败用例的具体原因
  3. 制定修复方案 - 确定需要修复测试代码还是源代码
  4. 实施修复并验证 - 修复问题并确保所有测试通过

使用方式

使用格式:/fix-test [测试文件路径]

示例:

  • /fix-test src/server/handlers/__tests__/mcp-manage.handler.test.ts
  • /fix-test src/cli/commands/__tests__/start.test.ts

修复流程

1. 执行测试并分析失败原因

  • 运行指定的测试文件,获取详细的错误信息和堆栈跟踪
  • 分析每个失败测试用例的具体失败原因:
    • 断言失败
    • Mock 配置问题
    • 测试数据问题
  • 检查相关源代码是否有变更导致测试逻辑不再适用

2. 制定修复方案

  • 根据失败原因确定是需要修复测试代码还是源代码
  • 如果是测试代码问题:
    • 更新测试逻辑
    • 修复断言
    • 调整 Mock 配置
  • 如果是源代码问题:
    • 修复源代码逻辑错误
  • 确保修复不会影响其他测试用例

3. 实施修复并验证

  • 按照修复方案逐一实施修复
  • 每次修复后立即运行测试验证效果
  • 确保所有原失败的测试用例现在都能通过
  • 运行完整测试套件确保没有引入新的失败

4. 代码质量检查

# 执行代码规范检查
pnpm lint

# 执行类型检查
pnpm typecheck

输出

提供详细的:

  • 失败原因分析
  • 修复过程说明
  • 最终验证结果

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.