
This generates unit tests by analyzing your functions and spitting out runnable test code with coverage for normal inputs, edge cases, and error conditions. It adapts to whatever language you're using (Python/pytest, JavaScript/Jest, Go testing) and handles the annoying stuff like mocking external dependencies and writing table-driven tests. The workflow is sensible: it reads your code to understand inputs and outputs, picks a testing strategy based on whether it's a pure function or something with side effects, then writes tests with decent naming. Honestly beats staring at a blank test file trying to remember all the edge cases you should cover, especially for functions that touch databases or APIs.
$ npx -y skills add laolaoshiren/claude-code-skills-zh --skill test-generator --agent claude-codeInstalls into .claude/skills of the current project.
检查目标代码及其:
区分“代码当前行为”和“产品期望行为”。两者冲突或契约不明确且会改变断言时,先列出证据与待确认假设;不要用测试固化猜测。
只覆盖契约或可达路径中真实存在的正常、边界与失败场景。空值、类型错误、超时和数据库异常不是每个函数的固定要求。
每个用例应说明:
优先参数化重复场景,并沿用仓库现有的测试命名、目录、fixture 和断言风格。不要因项目面向中文用户而强制使用中文函数名。
/tmp、换行、大小写、时区或 locale 行为。没有实际运行时,只能说明“已生成、未验证”,不能声称测试通过。
## 测试补充结果
- 目标与契约依据:
- 测试层级与框架:
- 新增或修改文件:
## 用例
| 场景 | 契约依据 | 预期结果 |
|------|----------|----------|
## 验证
- 实际命令与退出状态:
- 相关测试 / 完整测试:
- 基线已有失败:
- 未验证假设与限制:
Sponsors