test-generation

test-generation is a skill for Claude Code, Codex from laonayan/tdd-mcp-server. It costs 32 tokens per session (499 once invoked), scanned A, original, MIT.

A guide for generating tests from requirements or existing code, covering normal inputs, boundary cases, and errors. It uses Arrange-Act-Assert, a common pattern for setting up a test, running the action, and checking the result.

In plain words
What is it for?
Creating unit and regression tests, naming expected behaviour clearly, covering error paths, and checking test quality after generation.
Why use it?
It turns vague requirements into separate, readable checks and helps avoid tests that depend on one another or assert implementation details.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Creating unit and regression tests, naming expected behaviour clearly, covering error paths, and checking test quality after generation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/laonayan/tdd-mcp-server/test-generation
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add laonayan/tdd-mcp-server --skill test-generation
Clone the repo
git clone --depth 1 https://github.com/laonayan/tdd-mcp-server

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for test-generation

README.md
[![agentmods](https://agentmods.dev/badge/skills/laonayan/tdd-mcp-server/test-generation/github.svg)](https://agentmods.dev/skills/laonayan/tdd-mcp-server/test-generation)
Your own site
<a href="https://agentmods.dev/skills/laonayan/tdd-mcp-server/test-generation"><img src="https://agentmods.dev/badge/skills/laonayan/tdd-mcp-server/test-generation/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for test-generation

Your own site · 80×15
<a href="https://agentmods.dev/skills/laonayan/tdd-mcp-server/test-generation"><img src="https://agentmods.dev/badge/skills/laonayan/tdd-mcp-server/test-generation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 499 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00032 $0.00499
Opus 5.5 $0.00013 $0.00200
Sonnet 5.5 $0.00006 $0.00100
Haiku 4.5 $0.00003 $0.00050

Measured 4d ago against content hash 3a8966bd88b3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

test-generation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/test-generation/SKILL.md · 65 lines

What it actually says

测试生成指南

适用场景

  • 需求: {{REQUIREMENTS}} {% if EXISTING_CODE %}
  • 既有代码上下文: 需针对现有行为生成回归测试 {% endif %}

生成流程

1. 行为拆解

把需求拆成可独立验证的行为单元,每个行为产出三类测试:

  1. Happy path — 正常输入的预期输出
  2. 边界条件 — 空值、零、极大值、单元素、并发
  3. 错误路径 — 非法输入、依赖失败、超时

2. AAA 结构(Arrange-Act-Assert)

it('should 返回两数之和', () => {
  // Arrange
  const calc = new Calculator();
  // Act
  const result = calc.add(5, 3);
  // Assert
  expect(result).toBe(8);
});

3. 命名规范

should <预期行为> when <条件>——读测试名即可理解规格,例如:

  • should reject expired token when JWT validation runs
  • should return empty array when no matches found

4. 覆盖目标

维度 最低要求
语句覆盖 ≥ 80%
分支覆盖 ≥ 75%
错误路径 每个抛错点至少 1 个测试

反模式清单

  • ❌ 测试依赖执行顺序或共享可变状态
  • ❌ 断言模糊(expect(x).toBeDefined() 滥用)
  • ❌ 一个测试验证多个行为
  • ❌ mock 掉被测对象本身

生成后自检

  • 每个测试独立可运行
  • 失败信息可读(能定位到行为)
  • 无对实现细节(私有方法)的断言
  • 运行一次全部通过(在实现存在的回归场景)
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 65 lines · 32 tokens per session scan A 3a8966bd88b3

Subscribe to this mod's changes

test-generation is a skill published in the GitHub repository laonayan/tdd-mcp-server (2 stars, last pushed yesterday), licensed MIT. It adds 32 tokens to every session and 499 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-12.

Related

test-generation compared with skills from other repositories

test-generation next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
test-generationlaonayan/tdd-mcp-serverSkill2yesterdayMITA32Claude Code, Codex
test-masterJeffallan/claude-skillsSkill12kyesterdayMITA104Claude Code
migrate-xunit-to-xunit-v3dotnet/skillsSkill6.2kyesterdayMITA149Claude Code
go-testingGentleman-Programming/gentle-aiSkill9.2ktodayMITA26Claude Code, Codex
principle-test-behavior-not-implementationmichael-denyer/pstack-claudeSkill4.4k3d agoMITA50Claude Code
dart-testdartsim/dartSkill1.2kyesterdayBSD-2-ClauseA18Claude Code, Codex
test-generatorrshankras/claude-code-apple-skillsSkill8957d agoMITA33Claude Code