用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/luokai0/ai-agent-skills-by-luo-kai --skill auto-test命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | auto-test |
| description | 自动生成单元测试。分析代码逻辑,自动生成 pytest (Python)、JUnit (Java)、Jest (JavaScript) 等测试框架的测试用例。支持覆盖率报告生成。 |
智能自动生成单元测试,提升代码覆盖率,减少手动测试工作量。
# 分析项目并生成测试
python3 scripts/generate-tests.py --path /path/to/project --framework pytest
# 生成覆盖率报告
python3 scripts/generate-tests.py --path . --coverage --output coverage.html
# 仅分析不生成(预览)
python3 scripts/generate-tests.py --path . --dry-run
| 参数 | 说明 | 默认 |
|---|---|---|
--path | 项目路径 | . |
--framework | 测试框架 | pytest |
--coverage | 生成覆盖率 | false |
--output | 输出文件/目录 | ./tests/ |
--dry-run | 仅预览 | false |
--exclude | 排除目录 | node_modules,vendor,target |
| 语言 | 框架 | 状态 |
|---|---|---|
| Python | pytest, unittest | ✅ 完整 |
| Java | JUnit 4/5, TestNG | ✅ 完整 |
| JavaScript/TypeScript | Jest, Vitest, Mocha | ✅ 完整 |
| Go | testing | ✅ 完整 |
| Rust | cargo test | ✅ 完整 |
| C# | NUnit, xUnit | 🚧 开发中 |
# 生成的测试 (pytest)
def test_process_order_valid():
"""测试有效订单处理"""
order = Order(id=1, items=[...], total=100.0)
result = process_order(order)
assert result.status == "completed"
assert result.processed_at is not None
def test_process_order_invalid_total():
"""测试无效订单总金额"""
order = Order(id=2, items=[...], total=-10.0)
with pytest.raises(InvalidOrderError):
process_order(order)
def test_process_order_empty_items():
"""测试空购物车"""
order = Order(id=3, items=[], total=0.0)
with pytest.raises(EmptyCartError):
process_order(order)
pre-commit hook,提交前自动生成测试--dry-run 预览,避免覆盖现有测试