Back to skills
SKILL.md
Unit Testing
ASecurity要给刚改过的代码补单元测试、补齐边界用例时使用。生成测试、运行并汇报覆盖情况。
- 7 stars
- 0 votes
- 0 copies
- 0 views
- Added December 1, 2026
Works with
Security analysis
100/100Pro scans all 4 files and shows the line behind each finding
npx -y skills add code2rich/rigdepot --skill unit-testing --agent claude-codeAre you the author of Unit Testing?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/code2rich-unit-testing-5e870ac2)---
name: unit-testing
description: 要给刚改过的代码补单元测试、补齐边界用例时使用。生成测试、运行并汇报覆盖情况。
---
# 单元测试
## 步骤
1. 找出这次改动涉及的类和方法(`git diff --name-only` 对比目标分支)。
2. 为每个公开方法写测试:正常路径一个,边界和异常各至少一个。边界怎么找见 `references/boundaries.md`。
3. 运行测试,报告写到 `$TEST_REPORT_DIR`。
4. 汇报:新增了哪些测试、哪些失败、覆盖不到的地方和原因。
## 本机配置
`.env.example` 列了要配的项。`SHOP_TEST_API_TOKEN` 是个人密钥,不在本机配置里填。
## 不要做
- 不要为了让测试通过去改被测代码,发现缺陷先报告。
- 不要在测试里写真实的地址和令牌,用 `example.com` 和测试替身。
Files in this skill
- .env.example
- SKILL.md
- meta.yaml
- references/boundaries.md
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.