跳到正文
Skillpedia
测试48k · #5969

test-fixing

它能做什么

这个工具可以帮你查找并修复失败的代码测试中的错误。它会按类型和原因对错误进行分类,从而有条理地逐一修复。

适用场景

  • ✓当你的代码测试失败时。
  • ✓在修改代码后,测试不再通过时。
  • ✓当你需要确保项目的所有测试都正常运行时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/test-fixing/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/test-fixing/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我更新代码后测试失败了,你能帮我修复吗?”

每周 5 个新技能,1 分钟读完。

工作原理

它会先运行所有测试,看看哪些失败了。然后把相似的错误归为一组,每次修复一组,确认一切恢复正常后,再处理下一组。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Test Fixing

Systematically identify and fix all failing tests using smart grouping strategies.

When to Use

  • Explicitly asks to fix tests ("fix these tests", "make tests pass")
  • Reports test failures ("tests are failing", "test suite is broken")
  • Completes implementation and wants tests passing
  • Mentions CI/CD failures due to tests

Systematic Approach

1. Initial Test Run

Run make test to identify all failing tests.

Analyze output for:

  • Total number of failures
  • Error types and patterns
  • Affected modules/files

2. Smart Error Grouping

Group similar failures by:

  • Error type: ImportError, AttributeError, AssertionError, etc.
  • Module/file: Same file causing multiple test failure
  • Root cause: Missing dependencies, API changes, refactoring impacts

Prioritize groups by:

  • Number of affected tests (highest impact first)
  • Dependency order (fix infrastructure before functionality)

3. Systematic Fixing Process

For each group (starting with highest impact):

  1. Identify root cause

    • Read relevant code
    • Check recent changes with git diff
    • Understand the error pattern
  2. Implement fix

    • Use Edit tool for code changes
    • Follow project conventions (see CLAUDE.md)
    • Make minimal, focused changes
  3. Verify fix

    • Run subset of tests for this group
    • Use pytest markers or file patterns:
      uv run pytest tests/path/to/test_file.py -v
      uv run pytest -k "pattern" -v
      
    • Ensure group passes before moving on
  4. Move to next group

4. Fix Order Strategy

Infrastructure first:

  • Import errors
  • Missing dependencies
  • Configuration issues

Then API changes:

  • Function signature changes
  • Module reorganization
  • Renamed variables/functions

Finally, logic issues:

  • Assertion failures
  • Business logic bugs
  • Edge case handling

5. Final Verification

After all groups fixed:

  • Run complete test suite: make test
  • Verify no regressions
  • Check test coverage remains intact

Best Practices

  • Fix one group at a time
  • Run focused tests after each fix
  • Use git diff to understand recent changes
  • Look for patterns in failures
  • Don't move to next group until current passes
  • Keep changes minimal and focused

Example Workflow

User: "The tests are failing after my refactor"

  1. Run make test → 15 failures identified
  2. Group errors:
    • 8 ImportErrors (module renamed)
    • 5 AttributeErrors (function signature changed)
    • 2 AssertionErrors (logic bugs)
  3. Fix ImportErrors first → Run subset → Verify
  4. Fix AttributeErrors → Run subset → Verify
  5. Fix AssertionErrors → Run subset → Verify
  6. Run full suite → All pass ✓

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
常见问题

“失败的测试”是什么意思?

意思是用来检查程序是否正常工作的代码发现了问题,无法确认一切都是正确的。

为什么要把错误分组?

如果多个问题有相同的原因,分组后就可以一次性修复,让过程更快,也更有条理。

什么是“基础设施优先”?

意思是应先修复与基础环境相关的错误(比如缺失的依赖或配置问题),再去修复程序逻辑中的错误。

详情

作者的原始描述

Systematically identify and fix all failing tests using smart grouping strategies. Use when explicitly asks to fix tests (\"fix these tests\", \"make tests pass\"), reports test failures (\"tests are failing\", \"test suite is broken\"), or completes implementation and wants tests passing.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5969
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能