- name
SKILL.md
技能文件保留在发布者的仓库中。
在终端中粘贴复制的命令。它会把这个 SKILL.md 安装到对应的智能体中。
npx skills add JackyST0/awesome-agent-skills --skill unit-test-generator -a cursor -y在终端中粘贴复制的命令。它会把这个 SKILL.md 安装到对应的智能体中。
npx skills add JackyST0/awesome-agent-skills --skill unit-test-generator -a claude-code -y在终端中粘贴复制的命令。它会把这个 SKILL.md 安装到对应的智能体中。
npx skills add JackyST0/awesome-agent-skills --skill unit-test-generator -a codex -y在终端中粘贴复制的命令。它会把这个 SKILL.md 安装到对应的智能体中。
npx skills add JackyST0/awesome-agent-skills --skill unit-test-generator -a grok -y在 Grok Bot 聊天中发送复制的消息。Bot 会从 GitHub 获取这个 SKILL.md,并添加到你所有 Bot 共享的技能中。
Install this skill: https://github.com/JackyST0/awesome-agent-skills/tree/HEAD/examples/unit-test-generator来自发布者
根据源代码自动生成单元测试,支持多种语言和测试框架。
Automatically generate unit tests based on source code, supporting multiple languages and testing frameworks.
当用户请求以下操作时使用此 skill:
使用 templates/test-report.md 模板格式化输出。
Use the templates/test-report.md template to format output.
## 单元测试生成报告 / Unit Test Generation Report
### 分析概述 / Analysis Summary
[代码分析总结]
### 生成的测试 / Generated Tests
[测试代码]
### 测试覆盖说明 / Coverage Notes
- 覆盖的场景
- 建议补充的测试
def divide(a: float, b: float) -> float:
if b == 0:
raise ValueError("Cannot divide by zero")
return a / b
divide 函数执行除法运算,包含除零检查。需要测试正常除法、除零异常、边界值等情况。
import pytest
from your_module import divide
class TestDivide:
"""Tests for the divide function."""
def test_divide_positive_numbers(self):
"""Test division of positive numbers."""
assert divide(10, 2) == 5.0
assert divide(7, 2) == 3.5
def test_divide_negative_numbers(self):
"""Test division with negative numbers."""
assert divide(-10, 2) == -5.0
assert divide(10, -2) == -5.0
assert divide(-10, -2) == 5.0
def test_divide_by_zero_raises_error(self):
"""Test that dividing by zero raises ValueError."""
with pytest.raises(ValueError, match="Cannot divide by zero"):
divide(10, 0)
def test_divide_zero_numerator(self):
"""Test division when numerator is zero."""
assert divide(0, 5) == 0.0
def test_divide_float_precision(self):
"""Test division with floating point numbers."""
assert divide(1, 3) == pytest.approx(0.333333, rel=1e-5)
Automatically generate unit tests based on source code, supporting multiple languages and testing frameworks.
---name: unit-test-generatordescription: Automatically generate unit tests based on source code, supporting multiple languages and testing frameworks.---# examples/unit-test-generator/SKILL.md常见问题
从发布者处下载 examples/unit-test-generator/SKILL.md,或复制路径后打开仓库。PlugMCP 只收录该技能,不托管文件。
发布者将它存放在 https://github.com/JackyST0/awesome-agent-skills。
Claude、Cursor、Codex 和 Grok Build 可以读取你从发布者仓库添加的 SKILL.md。在聊天中发送技能的 GitHub 文件夹链接,Grok Bot 就会安装它。