test-fixing
它能做什么
这项技能让你的智能体运行测试套件,把失败的测试按相似原因分组,并优先修复最大的一组。适合测试失败的开发者。
适用场景
- ✓当你的测试套件失败,并希望智能体找出并修复问题时。
- ✓当持续集成检查因测试而失败时。
- ✓当你完成一个功能,想在合并前让所有测试通过的时候。
技能链接
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/test-fixing/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 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):
Identify root cause
- Read relevant code
- Check recent changes with
git diff - Understand the error pattern
Implement fix
- Use Edit tool for code changes
- Follow project conventions (see CLAUDE.md)
- Make minimal, focused changes
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
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 diffto 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"
- Run
make test→ 15 failures identified - Group errors:
- 8 ImportErrors (module renamed)
- 5 AttributeErrors (function signature changed)
- 2 AssertionErrors (logic bugs)
- Fix ImportErrors first → Run subset → Verify
- Fix AttributeErrors → Run subset → Verify
- Fix AssertionErrors → Run subset → Verify
- Run full suite → All pass ✓
常见问题
它会修改我的测试还是代码?
两者都可能修改,取决于原因,并且它被要求做最小化、聚焦的修改。
它如何决定先修复哪个?
它从影响测试最多的那一组开始,并先修复共享的设置问题,再处理功能问题。
它需要特定的命令吗?
它首先运行 make test,因此在你的项目中有这个命令时效果最好。
详情
作者的原始描述
Run tests and systematically fix all failing tests using smart error grouping. Use when user asks to fix failing tests, mentions test failures, runs test suite and failures occur, or requests to make tests pass.
热度
- GitHub 星标
- 33k
- 排名
- #8807
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
owasp-security
33k教你的智能体掌握面向网页应用、API、移动端、容器和 AI 智能体的 OWASP 安全指南,以便发现常见弱点并提出修复建议。
agent-management
33k让你的智能体使用 AI Maestro 命令行工具创建、列出、休眠、唤醒、重命名和删除 AI 智能体,管理每个智能体的生命周期。
agent-messaging
33k让你的智能体使用智能体消息协议,在 AI 智能体之间发送、接收和回复带签名的消息,大部分在你自己的电脑上完成。
docs-search
33k让你的智能体搜索自动生成的代码文档,查找函数签名、类定义和注释,从而在修改代码之前核对真实的 API。