test-generator SKILL.md skillA

test-generator from laolaoshiren/claude-code-skills-zh is an agent skill: a SKILL.md folder an AI agent loads when a task calls for it.

Install it, pinned
mdr add laolaoshiren/claude-code-skills-zh/test-generator@git:20260715.81812dc

Pins git:20260715.81812dc in mdr.lock. Pin the fingerprint instead.

Audit grade
A, 17 of 17 checks passed
Kind
SKILL.md skill
Repository
laolaoshiren/claude-code-skills-zh
Path
skills/test-generator/SKILL.md
Versions recorded
2
Latest version
git:20260715.81812dc, committed Jul 15, 2026
First version recorded
Apr 18, 2026
Size
3,786 bytes
Repository stars
869
License
MIT

依据真实代码契约生成并验证单元测试或集成测试。用于用户要求为函数、类、接口或缺陷补测试、提高覆盖率、生成回归用例或完善测试策略时;先读取现有测试与调用方,不猜测空值、异常或超时行为,不自动安装框架或访问生产依赖。.

Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.

What the file says

# 测试生成器

## 工作流程

### 1. 读取真实契约

检查目标代码及其:

- 类型定义、公开文档、调用方和错误处理路径。
- 现有测试、fixture、测试配置、依赖清单和项目测试命令。
- 输入输出、副作用、状态变化、并发语义和系统边界。
- 适用的仓库规则、Git 状态及本轮允许修改的范围。

区分“代码当前行为”和“产品期望行为”。两者冲突或契约不明确且会改变断言时,先列出证据与待确认假设;不要用测试固化猜测。

### 2. 选择测试层级

- 纯逻辑优先使用快速、确定的单元测试。
- 在系统边界隔离时间、随机数、文件系统、网络或第三方服务,避免 mock 被测模块的内部实现。
- 需要验证真实组件协作时使用集成测试,可采用临时目录、测试数据库或受控服务,并确保资源隔离和清理。
- 修复缺陷时先写能复现真实问题的最小回归用例,再验证修复。

只覆盖契约或可达路径中真实存在的正常、边界与失败场景。空值、类型错误、超时和数据库异常不是每个函数的固定要求。

### 3. 设计用例

每个用例应说明:

- 对应的契约、缺陷或分支。
- 输入与环境安排。
- 可观察结果,而非内部实现细节。
- 必要的清理和跨用例隔离。

优先参数化重复场景,并沿用仓库现有的测试命名、目录、fixture 和断言风格。不要因项目面向中文用户而强制使用中文函数名。

### 4. 实现最小测试

- 只修改目标测试文件和确有必要的 fixture。
- 不为了让测试通过而随意修改生产代码;若发现产品缺陷,单独报告或按用户要求修复。
- 不复制未经核实的示例期望值,也不把实现细节写成永久契约。
- Windows 与 Linux 使用路径 API、系统临时目录和显式编码,不硬编码分隔符、`/tmp`、换行、大小写、时区或 locale 行为。

### 5. 运行与复验

1. 先运行新增或目标测试,确认失败信息与预期一致。
2. 先检查项目脚本是否会下载依赖、访问外部服务或改变共享状态,再按改动风险运行相关测试;必要时运行完整测试、类型检查或覆盖率命令,潜在外部副作用需先获授权。
3. 检查 Git diff,确认没有快照、缓存、覆盖率产物或无关文件。
4. 将基线已有失败与本轮新增失败分开记录。

没有实际运行时,只能说明“已生成、未验证”,不能声称测试通过。

## 安全与授权边界

- 未经明确授权,不安装或升级测试框架,不修改 lockfile、全局测试配置、CI 或生产代码。
- 未经明确授权,不访问真实网络、生产数据库、云服务或含真实凭据的环境。
- 测试数据不得包含真实个人信息、Token、Cookie、密码或客户数据。
- 测试必须可重复,不依赖执行顺序,并清理创建的临时资源。
- 目标文件已有用户修改时,先检查是否重叠,避免覆盖。
…

Read the whole file at its exact version.

How to install

The exact contents, by fingerprint
mdr add laolaoshiren/claude-code-skills-zh/test-generator@sha256:99b8c93fe91b9b57

The line at the top of this page pins the label git:20260715.81812dc, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.

Badge

mdr badge

[![mdr](https://markdownregistry.com/badge/art_4hucjmllwupxy2g7.svg)](https://markdownregistry.com/a/art_4hucjmllwupxy2g7)

6 badge image fetches in 30 days. What the badge shows.

Versions

The registry has recorded 2 versions of this file, between Apr 18, 2026 and Jul 15, 2026, about one every 88 days.

versioncommittedcommitsizeaudit
git:20260715.81812dc latest2026-07-15 81812dc 3,786 BA view · diff
git:20260418.e63f0462026-04-18 e63f046 3,054 BA view

Audit of the latest version

A  17 of 17 checks passed. Fixed automatic checks with no AI involved, so the same checks give the same answer every run.
  • pass: Frontmatter block present
  • pass: Frontmatter declares a name
  • pass: Frontmatter declares a description
  • pass: Size between 200 bytes and 200 KB (3786 bytes)
  • pass: No zero-width or bidi control characters
  • pass: No instruction hidden inside an HTML comment
  • pass: No link to an exfiltration or paste host
  • pass: No credential-shaped string
  • pass: No instruction to send local credentials anywhere
  • pass: No text hidden with inline styles
  • pass: No prompt-injection phrasing
  • pass: No curl or wget piped into a shell
  • pass: No recursive delete of root, home or parent
  • pass: No instruction to read or print local credentials
  • pass: No base64 blob over 200 characters
  • pass: No link to a raw IP address
  • pass: No script tag

Source

GitHub

laolaoshiren/claude-code-skills-zh · 869 stars · license MIT · pushed 2026-09-22 · branch main

API

GET https://markdownregistry.com/api/v1/artifacts/art_4hucjmllwupxy2g7
GET https://markdownregistry.com/api/v1/resolve?ref=laolaoshiren/claude-code-skills-zh/test-generator
GET https://markdownregistry.com/api/v1/blob/99b8c93fe91b9b576f4f8316932508f21998c74d5ded42c7727c99bd755e7044

Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.

Guides: the SKILL.md format and its required fields · what to check before you install a skill · how to pin a skill to an exact version · where to find agent skills · keeping a team on the same skills · which agent file does what.

More from laolaoshiren/claude-code-skills-zh

api-tester SKILL.md skill
laolaoshiren/claude-code-skills-zh · skills/api-tester/SKILL.md · 依据真实 OpenAPI、路由实现和现有测试生成并验证 API 测试。用于用户要求测试接口、补集成测试、验证 API 契约、生成回归用例或排查接口兼容性时;区分“生成测试”和“执行请求”的授权,不猜测状态码、响应结构或…
git:20260716.e06495d · audit A · 869 stars
changelog-gen SKILL.md skill
laolaoshiren/claude-code-skills-zh · skills/changelog-gen/SKILL.md · Changelog 生成器 - 从 Git 历史自动生成 CHANGELOG
git:20260713.6d2b008 · audit A · 869 stars
db-migrator SKILL.md skill
laolaoshiren/claude-code-skills-zh · skills/db-migrator/SKILL.md · 数据库迁移助手 - Schema 对比、迁移脚本生成
git:20260713.6d2b008 · audit A · 869 stars
dep-auditor SKILL.md skill
laolaoshiren/claude-code-skills-zh · skills/dep-auditor/SKILL.md · 审计 Node.js、Python、Go、Rust、JVM、Ruby 项目的依赖漏洞、版本健康度与许可证事实;当用户要求检查 package.json、lockfile、requirements、go.mod、Cargo.toml、pom…
git:20260718.456f951 · audit A · 869 stars
ds-mapper SKILL.md skill
laolaoshiren/claude-code-skills-zh · skills/ds-mapper/SKILL.md · 项目目录结构地图 - 生成带说明的可视化目录树,快速理解任意代码库
git:20260421.2086438 · audit A · 869 stars
env-manager SKILL.md skill
laolaoshiren/claude-code-skills-zh · skills/env-manager/SKILL.md · 环境变量管理器:扫描、校验、同步 .env 文件,生成安全配置模板
git:20260713.6d2b008 · audit A · 869 stars
error-translator SKILL.md skill
laolaoshiren/claude-code-skills-zh · skills/error-translator/SKILL.md · 编程错误消息翻译专家 — 将英文错误消息翻译成中文,解释原因并提供修复方案
git:20260421.c1b858a · audit A · 869 stars
eslint-fix SKILL.md skill
laolaoshiren/claude-code-skills-zh · skills/eslint-fix/SKILL.md · 安全诊断并修复 ESLint error、warning 和配置兼容问题。用于用户要求运行 lint、解释 ESLint 报错、限定范围自动修复或迁移 ESLint…
git:20260715.81812dc · audit A · 869 stars
git-workflow SKILL.md skill
laolaoshiren/claude-code-skills-zh · skills/git-workflow/SKILL.md · 安全处理 Git 状态检查、提交信息、commit、分支、push、PR 和 rebase。用于用户要求检查改动、生成或创建提交、管理分支、推送、发起 PR 或整理历史时;严格区分每个动作的授权,并保护工作树中已有和无关的修改。
git:20260715.81812dc · audit A · 869 stars
github-actions-gen SKILL.md skill
laolaoshiren/claude-code-skills-zh · skills/github-actions-gen/SKILL.md · 分析真实项目并生成或修订安全、可验证的 GitHub Actions workflow;当用户要求创建 CI、测试矩阵、构建、Release、部署、缓存、Secrets、OIDC、PR 自动化或排查 workflow 配置时使用
git:20260722.bac2f9d · audit A · 869 stars
i18n-helper SKILL.md skill
laolaoshiren/claude-code-skills-zh · skills/i18n-helper/SKILL.md · 国际化/本地化助手 — 扫描代码中的硬编码文本、生成 i18n 配置、批量翻译
git:20260415.28119e9 · audit A · 869 stars
log-analyzer SKILL.md skill
laolaoshiren/claude-code-skills-zh · skills/log-analyzer/SKILL.md · 日志分析助手 — 智能解析日志文件,识别异常模式,定位问题根因
git:20260415.28119e9 · audit A · 869 stars

Every file in laolaoshiren/claude-code-skills-zh

Other files named test-generator

test-generator SKILL.md skill
jellydn/my-ai-tools · configs/cline/skills/test-generator/SKILL.md · Generate comprehensive tests for code changes
git:20260710.ba92170 · audit A · 128 stars
test-generator SKILL.md skill
jellydn/my-ai-tools · configs/amp/skills/test-generator/SKILL.md · Generate comprehensive tests for code changes
git:20260710.ba92170 · audit A · 128 stars
test-generator SKILL.md skill
jellydn/my-ai-tools · configs/kimi-code/skills/test-generator/SKILL.md · Generate comprehensive tests for code changes
git:20260710.ba92170 · audit A · 128 stars
test-generator SKILL.md skill
phuhao00/bony-agent · .agent/skills/test-generator/SKILL.md · Generates unit tests using pytest. Invoke when user asks to create tests for a file or function.
git:20260617.47f66a5 · audit A · 19 stars
test-generator SKILL.md skill
phuhao00/bony-agent · electron/resources/agent-skills/test-generator/SKILL.md · Generates unit tests using pytest. Invoke when user asks to create tests for a file or function.
git:20260617.47f66a5 · audit A · 19 stars
test-generator SKILL.md skill
chainlesschain/chainlesschain · desktop-app-vue/src/main/ai-engine/cowork/skills/builtin/test-generator/SKILL.md · 测试生成技能 - 单元测试创建、Mock生成、覆盖率分析
v1.0.0 · audit A · 11 stars

Browse by kind, by grade A, or by owner.